1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

rserv replication toolkit from Vadim Mikheev.

This commit is contained in:
Thomas G. Lockhart
2000-12-20 17:22:35 +00:00
parent 96edf0c185
commit 54f2b601ef
19 changed files with 2644 additions and 0 deletions

View File

@ -0,0 +1,55 @@
# -*- perl -*-
# GetSyncID
# Vadim Mikheev, (c) 2000, PostgreSQL Inc.
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
use lib "@LIBDIR@";
use Pg;
use Getopt::Long;
use RServ;
$| = 1;
my $verbose = 1;
$result = GetOptions("debug!", "verbose!", "help",
"host=s", "user=s", "password=s");
my $debug = $opt_debug || 0;
my $verbose = $opt_verbose if (defined($opt_verbose));
if (defined($opt_help) || (scalar(@ARGV) < 1)) {
print "Usage: $0 --host=name --user=name --password=string slavedb\n";
exit ((scalar(@ARGV) < 1)? 1: 0);
}
my $dbname = $ARGV[0];
my $sinfo = "dbname=$dbname";
$sinfo = "$sinfo host=$opt_host" if (defined($opt_host));
$sinfo = "$sinfo user=$opt_user" if (defined($opt_user));
$sinfo = "$sinfo password=$opt_password" if (defined($opt_password));
if ($verbose) { print "Connecting to '$sinfo'\n" };
my $conn = Pg::connectdb($sinfo);
$res = GetSyncID($conn);
die "ERROR\n" if $res < 0;
if (! defined $res)
{
printf STDERR "No SyncID found\n";
}
else
{
print("Last SyncID applied: ") if ($verbose);
printf "%d", $res;
print("\n") if ($verbose);
}
exit(0);