/usr/bin/slonik_merge_sets is in slony1-2-bin 2.0.7-3build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | #!/usr/bin/perl
#
# Author: Christopher Browne
# Copyright 2004-2009 Afilias Canada
use Getopt::Long;
# Defaults
$CONFIG_FILE = '/etc/slony1/slon_tools.conf';
$SHOW_USAGE = 0;
# Read command-line options
GetOptions("config=s" => \$CONFIG_FILE,
"help" => \$SHOW_USAGE);
my $USAGE =
"Usage: merge_sets [--config file] node# targetset# srcset#
Merges the contents of the second set into the first one.
When completed, the second set no longer exists.
";
if ($SHOW_USAGE) {
print $USAGE;
exit 0;
}
require '/usr/share/slony1/slon-tools.pm';
require $CONFIG_FILE;
my ($node, $set1, $set2) = @ARGV;
if ($node =~ /^(?:node)?(\d+)$/) {
# Set name is in proper form
$node = $1;
} else {
print "Valid node names are node1, node2, ...\n\n";
die $USAGE;
}
die $USAGE unless $set1;
$set1 = get_set($set1) or die "Non-existent set specified.\n";
die $USAGE unless $set2;
$set2 = get_set($set2) or die "Non-existent set specified.\n";
my ($dbname, $dbhost) = ($DBNAME[$MASTERNODE], $HOST[$MASTERNODE]);
my $slonik = '';
$slonik .= genheader();
$slonik .= " try {\n";
$slonik .= " merge set (id = $set1, add id = $set2, origin = $node);\n";
$slonik .= " } on error {\n";
$slonik .= " echo 'Failure to merge set $set2 into $set1 with origin $node';\n";
$slonik .= " exit 1;\n";
$slonik .= " }\n";
$slonik .= " echo 'Replication set $set2 merged into $set1 on origin $node. Set $set2 no longer exists.';\n";
run_slonik_script($slonik, 'MERGE SET');
|