CVS User Account cvsuser
Fri Oct 1 21:43:28 PDT 2004
Log Message:
-----------
Vivek Khera's changes that add the $MASTERNODE variable which allows the 
scripts that need to know which node is "master" to have a value other
than 1.

Tags:
----
REL_1_0_STABLE

Modified Files:
--------------
    slony1-engine/tools/altperl:
        README (r1.6.2.1 -> r1.6.2.2)
        create_set.pl (r1.6.2.1 -> r1.6.2.2)
        drop_node.pl (r1.4.2.1 -> r1.4.2.2)
        init_cluster.pl (r1.4.2.1 -> r1.4.2.2)
        slon.env (r1.5.2.1 -> r1.5.2.2)
        uninstall_nodes.pl (r1.2.2.1 -> r1.2.2.2)

-------------- next part --------------
Index: drop_node.pl
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/tools/altperl/drop_node.pl,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -Ltools/altperl/drop_node.pl -Ltools/altperl/drop_node.pl -u -w -r1.4.2.1 -r1.4.2.2
--- tools/altperl/drop_node.pl
+++ tools/altperl/drop_node.pl
@@ -19,7 +19,7 @@
 print SLONIK genheader();
 print SLONIK qq{
 try {
-      drop node (id = $node);
+      drop node (id = $node, event node = $MASTERNODE);
 } on error {
       echo 'Failed to drop node $node from cluster';
       exit 1;
Index: create_set.pl
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/tools/altperl/create_set.pl,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -Ltools/altperl/create_set.pl -Ltools/altperl/create_set.pl -u -w -r1.6.2.1 -r1.6.2.2
--- tools/altperl/create_set.pl
+++ tools/altperl/create_set.pl
@@ -36,7 +36,7 @@
 
 print OUTFILE "
 try {
-      create set (id = $set, origin = 1, comment = 'Set $set for $SETNAME');
+      create set (id = $set, origin = $MASTERNODE, comment = 'Set $set for $SETNAME');
 } on error {
       echo 'Could not create subscription set $set for $SETNAME!';
       exit -1;
@@ -60,7 +60,7 @@
 foreach my $table (@SERIALTABLES) {
   $table = ensure_namespace($table);
   print OUTFILE "
-		set add table (set id = $set, origin = 1, id = $TABLE_ID, full qualified name = '$table', comment = 'Table $table without primary key', key=serial);
+		set add table (set id = $set, origin = $MASTERNODE, id = $TABLE_ID, full qualified name = '$table', comment = 'Table $table without primary key', key=serial);
                 echo 'Add unkeyed table $table';
 "; 
   $TABLE_ID++;
@@ -69,7 +69,7 @@
 foreach my $table (@PKEYEDTABLES) {
   $table = ensure_namespace($table);
   print OUTFILE "
-		set add table (set id = $set, origin = 1, id = $TABLE_ID, full qualified name = '$table', comment = 'Table $table with primary key');
+		set add table (set id = $set, origin = $MASTERNODE, id = $TABLE_ID, full qualified name = '$table', comment = 'Table $table with primary key');
                 echo 'Add primary keyed table $table';
 ";
   $TABLE_ID++;
@@ -79,7 +79,7 @@
   my $key = $KEYEDTABLES{$table};
   $table = ensure_namespace($table);
   print OUTFILE "
-		set add table (set id = $set, origin = 1, id = $TABLE_ID, full qualified name = '$table', key='$key', comment = 'Table $table with candidate primary key $key');
+		set add table (set id = $set, origin = $MASTERNODE, id = $TABLE_ID, full qualified name = '$table', key='$key', comment = 'Table $table with candidate primary key $key');
                 echo 'Add candidate primary keyed table $table';
 ";
   $TABLE_ID++;
@@ -99,7 +99,7 @@
 foreach my $seq (@SEQUENCES) {
   $seq = ensure_namespace($seq);
   print OUTFILE "
-                set add sequence (set id = $set, origin = 1, id = $SEQID, full qualified name = '$seq', comment = 'Sequence $seq');
+                set add sequence (set id = $set, origin = $MASTERNODE, id = $SEQID, full qualified name = '$seq', comment = 'Sequence $seq');
                 echo 'Add sequence $seq';
 ";
   $SEQID++;
Index: init_cluster.pl
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/tools/altperl/init_cluster.pl,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -Ltools/altperl/init_cluster.pl -Ltools/altperl/init_cluster.pl -u -w -r1.4.2.1 -r1.4.2.2
--- tools/altperl/init_cluster.pl
+++ tools/altperl/init_cluster.pl
@@ -14,7 +14,7 @@
 
 my ($dbname, $dbhost)=($DBNAME[1], $HOST[1]);
 print SLONIK "
-   init cluster (id = 1, comment = 'Node $node - $dbname\@$dbhost');
+   init cluster (id = $MASTERNODE, comment = 'Node $node - $dbname\@$dbhost');
 ";
 close SLONIK;
 run_slonik_script($FILE);
@@ -23,9 +23,9 @@
 print SLONIK genheader();
 
 foreach my $node (@NODES) {
-  if ($node > 1) {		# skip the first one; it's already initialized!
+  if ($node != $MASTERNODE) {		# skip the master node; it's already initialized!
     my ($dbname, $dbhost) = ($DBNAME[$node], $HOST[$node]);
-    print SLONIK "   store node (id = $node, comment = 'Node $node - $dbname\@$dbhost');\n";
+    print SLONIK "   store node (id = $node, event node = $MASTERNODE, comment = 'Node $node - $dbname\@$dbhost');\n";
   }
 }
 
Index: uninstall_nodes.pl
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/tools/altperl/uninstall_nodes.pl,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -Ltools/altperl/uninstall_nodes.pl -Ltools/altperl/uninstall_nodes.pl -u -w -r1.2.2.1 -r1.2.2.2
--- tools/altperl/uninstall_nodes.pl
+++ tools/altperl/uninstall_nodes.pl
@@ -10,7 +10,7 @@
 open(SLONIK, ">$FILE");
 print SLONIK genheader();
 print SLONIK qq{
-	uninstall node (id=1);
+	uninstall node (id=$MASTERNODE);
 };
 close SLONIK;
 run_slonik_script($FILE);
Index: slon.env
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/tools/altperl/slon.env,v
retrieving revision 1.5.2.1
retrieving revision 1.5.2.2
diff -Ltools/altperl/slon.env -Ltools/altperl/slon.env -u -w -r1.5.2.1 -r1.5.2.2
--- tools/altperl/slon.env
+++ tools/altperl/slon.env
@@ -64,5 +64,7 @@
 	      "seq2",
 	      "seq3"
 	     );	
-
 }
+
+$MASTERNODE ||= 1;   # Set only if not already set above
+1;
Index: README
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/tools/altperl/README,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -Ltools/altperl/README -Ltools/altperl/README -u -w -r1.6.2.1 -r1.6.2.2
--- tools/altperl/README
+++ tools/altperl/README
@@ -45,6 +45,8 @@
   involved in the replication set, you will find the namespace
   "_$SETNAME" that contains Slony-I's configuration tables
 
+ $MASTERNODE is the number of the "master" node.  It defaults to 1, if
+ not otherwise set.
 
  Set Level Configuration
 -----------------------------------


More information about the Slony1-commit mailing list