Steve Simms steve
Mon Jan 31 22:52:09 PST 2005
The use of $SETNAME to refer to the name of the cluster is confusing, since 
the word "set" is more closely associated with groups of tables, so I've 
done a global replacement in tools/altperl to change it to $CLUSTER_NAME.

I've also changed a few of the usage/error messages to refer to them as 
clusters rather than sets, where appropriate.

-- 
Steve Simms <steve at deefs.net>
http://www.deefs.net
-------------- next part --------------
Index: README
===================================================================
RCS file: /home/cvs/slony1-engine/tools/altperl/README,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 README
--- README	31 Jan 2005 22:12:49 -0000	1.1.1.1
+++ README	31 Jan 2005 22:43:30 -0000
@@ -41,9 +41,9 @@
 This configuration should be set up in the file represented in the
 environment variable SLONYNODES.
 
- $SETNAME represents the name of the cluster.  In each database
+ $CLUSTER_NAME represents the name of the cluster.  In each database
   involved in the replication set, you will find the namespace
-  "_$SETNAME" that contains Slony-I's configuration tables
+  "_$CLUSTER_NAME" that contains Slony-I's configuration tables
 
  $MASTERNODE is the number of the "master" node.  It defaults to 1, if
  not otherwise set.
Index: create_set.pl
===================================================================
RCS file: /home/cvs/slony1-engine/tools/altperl/create_set.pl,v
retrieving revision 1.2
diff -u -r1.2 create_set.pl
--- create_set.pl	31 Jan 2005 22:39:23 -0000	1.2
+++ create_set.pl	31 Jan 2005 22:43:44 -0000
@@ -30,9 +30,9 @@
 }
 print OUTFILE "
 try {
-      create set (id = $set, origin = $MASTERNODE, comment = 'Set $set for $SETNAME');
+      create set (id = $set, origin = $MASTERNODE, comment = 'Set $set for $CLUSTER_NAME');
 } on error {
-      echo 'Could not create subscription set $set for $SETNAME!';
+      echo 'Could not create subscription set $set for $CLUSTER_NAME!';
       exit -1;
 }
 ";
Index: restart_nodes.pl
===================================================================
RCS file: /home/cvs/slony1-engine/tools/altperl/restart_nodes.pl,v
retrieving revision 1.2
diff -u -r1.2 restart_nodes.pl
--- restart_nodes.pl	31 Jan 2005 22:39:31 -0000	1.2
+++ restart_nodes.pl	31 Jan 2005 22:43:28 -0000
@@ -11,7 +11,7 @@
   my $dsn = $DSN[$node];
   open(SLONIK, ">$FILE");
   print SLONIK qq{
-	cluster name = $SETNAME ;
+	cluster name = $CLUSTER_NAME ;
 	node $node admin conninfo = '$dsn';
 	restart node $node;
     };
Index: show_configuration.pl
===================================================================
RCS file: /home/cvs/slony1-engine/tools/altperl/show_configuration.pl,v
retrieving revision 1.2
diff -u -r1.2 show_configuration.pl
--- show_configuration.pl	31 Jan 2005 22:39:32 -0000	1.2
+++ show_configuration.pl	31 Jan 2005 22:43:27 -0000
@@ -18,7 +18,7 @@
 }
 
 print qq{
-Slony-I Cluster: $SETNAME
+Slony-I Cluster: $CLUSTER_NAME
 Logs stored under $LOGDIR
 Slony Binaries in: $SLON_BIN_PATH
 };
Index: slon-tools.pm
===================================================================
RCS file: /home/cvs/slony1-engine/tools/altperl/slon-tools.pm,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 slon-tools.pm
--- slon-tools.pm	31 Jan 2005 22:12:49 -0000	1.1.1.1
+++ slon-tools.pm	31 Jan 2005 22:43:22 -0000
@@ -69,7 +69,7 @@
 # This is the usual header to a slonik invocation that declares the
 # cluster name and the set of nodes and how to connect to them.
 sub genheader {
-  my $header = "cluster name = $SETNAME;\n";
+  my $header = "cluster name = $CLUSTER_NAME;\n";
   foreach my $node (@NODES) {
     if ($DSN[$node]) {
       my $dsn = $DSN[$node];
@@ -120,7 +120,7 @@
   my $tpid;
   my ($dbname, $dbport, $dbhost) = ($DBNAME[$nodenum], $PORT[$nodenum], $HOST[$nodenum]);
   #  print "Searching for PID for $dbname on port $dbport\n";
-  my $command =  ps_args() . "| egrep \"[s]lon .*$SETNAME\" | egrep \"host=$dbhost dbname=$dbname.*port=$dbport\" | sort -n | awk '{print \$2}'";
+  my $command =  ps_args() . "| egrep \"[s]lon .*$CLUSTER_NAME\" | egrep \"host=$dbhost dbname=$dbname.*port=$dbport\" | sort -n | awk '{print \$2}'";
   #print "Command:\n$command\n";
   open(PSOUT, "$command|");
   while ($tpid = <PSOUT>) {
@@ -137,9 +137,9 @@
   my $cmd;
   `mkdir -p $LOGDIR/slony1/node$nodenum`;
   if ($APACHE_ROTATOR) {
-    $cmd = "$SLON_BIN_PATH/slon -s 1000 -d2 $SETNAME '$dsn' 2>&1 | $APACHE_ROTATOR \"$LOGDIR/slony1/node$nodenum/" . $dbname . "_%Y-%m-%d_%H:%M:%S.log\" 10M&";
+    $cmd = "$SLON_BIN_PATH/slon -s 1000 -d2 $CLUSTER_NAME '$dsn' 2>&1 | $APACHE_ROTATOR \"$LOGDIR/slony1/node$nodenum/" . $dbname . "_%Y-%m-%d_%H:%M:%S.log\" 10M&";
   } else {
-    $cmd = "$SLON_BIN_PATH/slon -s 1000 -d2 $SETNAME '$dsn' 2>&1 > $LOGDIR/slony1/node$nodenum/$dbname.log &";
+    $cmd = "$SLON_BIN_PATH/slon -s 1000 -d2 $CLUSTER_NAME '$dsn' 2>&1 > $LOGDIR/slony1/node$nodenum/$dbname.log &";
   }
   print "Invoke slon for node $nodenum - $cmd\n";
   system $cmd;
@@ -154,10 +154,10 @@
 #   my $query = qq{
 #   select now() - ev_timestamp > '$killafter'::interval as event_old, now() - ev_timestamp as age,
 #        ev_timestamp, ev_seqno, ev_origin as origin
-# from _$SETNAME.sl_event events, _$SETNAME.sl_subscribe slony_master
+# from _$CLUSTER_NAME.sl_event events, _$CLUSTER_NAME.sl_subscribe slony_master
 #   where 
 #      events.ev_origin = slony_master.sub_provider and
-#      not exists (select * from _$SETNAME.sl_subscribe providers
+#      not exists (select * from _$CLUSTER_NAME.sl_subscribe providers
 #                   where providers.sub_receiver = slony_master.sub_provider and
 #                         providers.sub_set = slony_master.sub_set and
 #                         slony_master.sub_active = 't' and
@@ -172,23 +172,23 @@
 select * from 
 (select now() - con_timestamp < '$killafter'::interval, now() - con_timestamp as age,
        con_timestamp
-from _$SETNAME.sl_confirm c, _$SETNAME.sl_subscribe slony_master
+from _$CLUSTER_NAME.sl_confirm c, _$CLUSTER_NAME.sl_subscribe slony_master
   where c.con_origin = slony_master.sub_provider and
-             not exists (select * from _$SETNAME.sl_subscribe providers
+             not exists (select * from _$CLUSTER_NAME.sl_subscribe providers
                   where providers.sub_receiver = slony_master.sub_provider and
                         providers.sub_set = slony_master.sub_set and
                         slony_master.sub_active = 't' and
                         providers.sub_active = 't') and
-        c.con_received = _$SETNAME.getLocalNodeId('_$SETNAME') and
+        c.con_received = _$CLUSTER_NAME.getLocalNodeId('_$CLUSTER_NAME') and
         now() - con_timestamp < '$killafter'::interval
 limit 1) as slave_confirmed_events
 union all (select
 now() - con_timestamp < '$killafter'::interval, now() - con_timestamp as age,
        con_timestamp
-from _$SETNAME.sl_confirm c, _$SETNAME.sl_subscribe slony_master
-  where c.con_origin = _$SETNAME.getLocalNodeId('_$SETNAME') and
-             exists (select * from _$SETNAME.sl_subscribe providers
-                  where providers.sub_provider = _$SETNAME.getLocalNodeId('_$SETNAME') and
+from _$CLUSTER_NAME.sl_confirm c, _$CLUSTER_NAME.sl_subscribe slony_master
+  where c.con_origin = _$CLUSTER_NAME.getLocalNodeId('_$CLUSTER_NAME') and
+             exists (select * from _$CLUSTER_NAME.sl_subscribe providers
+                  where providers.sub_provider = _$CLUSTER_NAME.getLocalNodeId('_$CLUSTER_NAME') and
                         slony_master.sub_active = 't') and
         now() - con_timestamp < '$killafter'::interval
 limit 1)
@@ -207,8 +207,8 @@
 # to a sl_subscribe entry that is not yet active.
 sub node_is_subscribing {
   my $see_if_subscribing = qq {
-select * from "_$SETNAME".sl_event e, "_$SETNAME".sl_subscribe s
-where ev_origin = "_$SETNAME".getlocalnodeid('_$SETNAME') and  -- Event on local node
+select * from "_$CLUSTER_NAME".sl_event e, "_$CLUSTER_NAME".sl_subscribe s
+where ev_origin = "_$CLUSTER_NAME".getlocalnodeid('_$CLUSTER_NAME') and  -- Event on local node
       ev_type = 'SUBSCRIBE_SET' and                            -- Event is SUBSCRIBE SET
       --- Then, match criteria against sl_subscribe
       sub_set = ev_data1 and sub_provider = ev_data2 and sub_receiver = ev_data3 and
Index: slon.env
===================================================================
RCS file: /home/cvs/slony1-engine/tools/altperl/slon.env,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 slon.env
--- slon.env	31 Jan 2005 22:12:49 -0000	1.1.1.1
+++ slon.env	31 Jan 2005 22:43:26 -0000
@@ -7,7 +7,7 @@
   require $ENV{"SLONYNODES"};
 } else {
   # Define environment locally...
-  $SETNAME=flex2test;
+  $CLUSTER_NAME=flex2test;
   $LOGDIR='/opt/logs/slon';
   $SLON_BIN_PATH='/opt/OXRS/dbs/pgsql74/bin';
   #$APACHE_ROTATOR="/opt/OXRS/apache/rotatelogs";   # optional path to Apache rotatelog tool
Index: slon_kill.pl
===================================================================
RCS file: /home/cvs/slony1-engine/tools/altperl/slon_kill.pl,v
retrieving revision 1.2
diff -u -r1.2 slon_kill.pl
--- slon_kill.pl	31 Jan 2005 22:39:34 -0000	1.2
+++ slon_kill.pl	31 Jan 2005 22:44:34 -0000
@@ -29,7 +29,7 @@
 require '@@PGLIBDIR@@/slon-tools.pm';
 require $SLON_ENV_FILE;
 
-print "slon_kill.pl...   Killing all slon and slon_watchdog instances for setname $SETNAME\n";
+print "slon_kill.pl...   Killing all slon and slon_watchdog instances for the cluster $CLUSTER_NAME\n";
 print "1.  Kill slon watchdogs\n";
 # kill the watchdog
 
@@ -43,7 +43,7 @@
 
 # kill the slon daemon
 $found="n";
-open(PSOUT, ps_args() . " | egrep \"[s]lon .*$SETNAME\" | sort -n | awk '{print \$2}'|");
+open(PSOUT, ps_args() . " | egrep \"[s]lon .*$CLUSTER_NAME\" | sort -n | awk '{print \$2}'|");
 shut_off_processes();
 close(PSOUT);
 if ($found eq 'n') {
@@ -55,11 +55,11 @@
   while ($pid = <PSOUT>) {
     chomp $pid;
     if (!($pid)) {
-      print "No slon_watchdog is running for set $SETNAME!\n";
+      print "No slon_watchdog is running for the cluster $CLUSTER_NAME!\n";
     } else {
       $found="y";
       kill 9, $pid;
-      print "slon_watchdog for set $SETNAME killed - PID [$pid]\n";
+      print "slon_watchdog for cluster $CLUSTER_NAME killed - PID [$pid]\n";
     }
   }
 }
Index: slon_start.pl
===================================================================
RCS file: /home/cvs/slony1-engine/tools/altperl/slon_start.pl,v
retrieving revision 1.2
diff -u -r1.2 slon_start.pl
--- slon_start.pl	31 Jan 2005 22:39:36 -0000	1.2
+++ slon_start.pl	31 Jan 2005 22:44:55 -0000
@@ -52,7 +52,7 @@
 
 $pid = get_pid($node);
 if ($pid) {
-  die "Slon is already running for the '$SETNAME' set\n";
+  die "Slon is already running for the '$CLUSTER_NAME' cluster.\n";
 }
 
 my $dsn    = $DSN[$nodenum];
@@ -61,9 +61,9 @@
 $pid = get_pid($node);
 
 unless ($pid) {
-  print "Slon failed to start for cluster $SETNAME, node $node\n";
+  print "Slon failed to start for cluster $CLUSTER_NAME, node $node\n";
 } else {
-  print "Slon successfully started for cluster $SETNAME, node $node\n";
+  print "Slon successfully started for cluster $CLUSTER_NAME, node $node\n";
   print "PID [$pid]\n";
   if ($START_WATCHDOG) {
     print "Start the watchdog process as well...\n";
Index: slon_watchdog.pl
===================================================================
RCS file: /home/cvs/slony1-engine/tools/altperl/slon_watchdog.pl,v
retrieving revision 1.2
diff -u -r1.2 slon_watchdog.pl
--- slon_watchdog.pl	31 Jan 2005 22:39:38 -0000	1.2
+++ slon_watchdog.pl	31 Jan 2005 22:45:36 -0000
@@ -52,12 +52,12 @@
     # Next, restart the slon process to service the node
     start_slon($nodenum);
     $pid = get_pid($node);
-    print SLONLOG "WATCHDOG: Restarted slon for set $SETNAME, PID $pid\n";
+    print SLONLOG "WATCHDOG: Restarted slon for the $CLUSTER_NAME cluster, PID $pid\n";
   } else {
     open(LOG, ">>$LOGDIR/slon_watchdog.log");
     print LOG "\n";
     system "date >> $LOGDIR/slon_watchdog.log";
-    print LOG "Found slon daemon running for set $SETNAME, PID $pid\n";
+    print LOG "Found slon daemon running for the $CLUSTER_NAME cluster, PID $pid\n";
     print LOG "Looks Ok\n";
     print LOG "Sleeping for $sleep seconds\n";
   }
Index: slon_watchdog2.pl
===================================================================
RCS file: /home/cvs/slony1-engine/tools/altperl/slon_watchdog2.pl,v
retrieving revision 1.2
diff -u -r1.2 slon_watchdog2.pl
--- slon_watchdog2.pl	31 Jan 2005 22:39:37 -0000	1.2
+++ slon_watchdog2.pl	31 Jan 2005 22:43:21 -0000
@@ -17,7 +17,7 @@
   $nodenum = $1;
 }
 
-log_to_watchdog_log("Invoking watchdog for $SETNAME node $nodenum");
+log_to_watchdog_log("Invoking watchdog for $CLUSTER_NAME node $nodenum");
 while (1) {
   my $res = query_slony_status($nodenum);    # See where the node stands
   my $eventsOK;
@@ -53,7 +53,7 @@
 
   # If the node needs a swift kick in the "RESTART", then submit that to slonik
   if ($kick eq "YES") {
-    log_to_watchdog_log("submit slonik to restart $SETNAME node $nodenum");
+    log_to_watchdog_log("submit slonik to restart $CLUSTER_NAME node $nodenum");
     open(SLONIK, "|$SLON_BIN_PATH/slonik");
     print SLONIK genheader();
     print SLONIK "restart node $node\n";
@@ -61,7 +61,7 @@
   }
   if ($restart eq "YES") {
     if ($pid) {
-      log_to_watchdog_log("terminate slon daemon for $SETNAME node $nodenum");
+      log_to_watchdog_log("terminate slon daemon for $CLUSTER_NAME node $nodenum");
       # Kill slon until dead...
       kill 2, $pid;
       sleep 3;
Index: uninstall_nodes.pl
===================================================================
RCS file: /home/cvs/slony1-engine/tools/altperl/uninstall_nodes.pl,v
retrieving revision 1.2
diff -u -r1.2 uninstall_nodes.pl
--- uninstall_nodes.pl	31 Jan 2005 22:39:40 -0000	1.2
+++ uninstall_nodes.pl	31 Jan 2005 22:43:19 -0000
@@ -16,12 +16,12 @@
 run_slonik_script($FILE);
 
 foreach my $node (@NODES) {
-  foreach my $command ("drop schema _$SETNAME cascade;") {
+  foreach my $command ("drop schema _$CLUSTER_NAME cascade;") {
     print $command, "\n";
     print `echo "$command" | psql -h $HOST[$node] -U $USER[$node] -d $DBNAME[$node] -p $PORT[$node]`;
   }
   foreach my $t (@SERIALTABLES) {
-    my $command = "alter table $t drop column \\\"_Slony-I_" . $SETNAME . "_rowID\\\";";
+    my $command = "alter table $t drop column \\\"_Slony-I_" . $CLUSTER_NAME . "_rowID\\\";";
     print $command, "\n";
     print `echo "$command" | psql -h $HOST[$node] -U $USER[$node] -d $DBNAME[$node] -p $PORT[$node]`;
   }


More information about the Slony1-general mailing list