--- bin/Replicate 2003/08/10 13:51:54 1.9 +++ bin/Replicate 2003/10/29 18:00:18 1.11 @@ -23,6 +23,7 @@ my ($help,$masterhost,$masterport,$masteruser,$masterpassword, $slavehost,$slaveport,$slaveuser,$slavepassword); my $snapshot = ".__Snapshot"; +my $mserver = 0; my $result = GetOptions( "debug!" => \$debug, "verbose!" => \$verbose, "help" => \$help, @@ -31,6 +32,7 @@ "slavehost=s" => \$slavehost, "slaveport=i" => \$slaveport, "slaveuser=s" => \$slaveuser, "slavepassword=s" => \$slavepassword, "snapshot=s" => \$snapshot, + "masterserver=i" => \$mserver, ); if (defined($help) || (scalar(@ARGV) < 2)) { @@ -39,6 +41,7 @@ --masterhost=hostname --masterport=port --masteruser=username --masterpassword=string --snapshot=snapshot + [--masterserver=master_number] "; exit ((scalar(@ARGV) < 2)? 1:0); } @@ -54,6 +57,7 @@ my $master = $ARGV[0] || "master"; my $slave = $ARGV[1] || "slave"; +my $tables = $#ARGV < 2 ? undef : { map {($_, undef)} @ARGV[2..$#ARGV] }; # first, let's check if a instance is alrealy running @@ -127,14 +131,14 @@ if ($slaveId < 0) { unlink $fname; - die "\n>>>>>>>>>>>>> ERROR\n"; + die "\n>>>>>>>>>>>>> ERROR: GetSlaveID returned $slaveId < 0\n"; } SyncSync($mconn, $sconn); my $outf = new IO::File; open $outf, ">$snapshot"; print "\n>>>>>>>>>>>>> Prepare Snapshot\n\n" if ($verbose); -my $res = PrepareSnapshot($mconn, $sconn, $outf, $slaveId); +my $res = PrepareSnapshot($mconn, $sconn, $outf, $mserver, $slaveId, $tables); close $outf; if ($res < 0) { unlink $fname; @@ -151,7 +155,7 @@ my $inpf = new IO::File; open $inpf, "<$snapshot"; print "\n>>>>>>>>>>>>> Apply Snapshot\n\n" if ($verbose); -$res = ApplySnapshot($sconn, $inpf); +$res = ApplySnapshot($sconn, $inpf, $tables); close $inpf; if ($res < 0) { unlink $fname;