Document the EXECUTE ONLY ON list of nodes syntax
authorSteve Singer <ssinger@ca.afilias.info>
Thu, 17 Apr 2014 13:54:14 +0000 (09:54 -0400)
committerSteve Singer <ssinger@ca.afilias.info>
Thu, 17 Apr 2014 13:55:06 +0000 (09:55 -0400)
Also add a regression test to test this

clustertest/regression/testddl/testddl.js
doc/adminguide/slonik_ref.sgml

index 5bacb95d44fbb3aa8e0c5efe00a306850971a51d..1cd1e7cc0cf24770c269a6977f54f9484986f78c 100644 (file)
@@ -192,6 +192,38 @@ function execute_on_subscriber(coordinator)
     
 }
 
+
+function execute_only_on_list(coordinator)
+{
+    /**
+     * Perform an EXECUTE SCRIPT with a subscriber (a non-provider)
+     * and verify that the DDL changes replicate to all other nodes.
+     */
+    var premable = get_slonik_preamble();
+    var slonikScript = 'EXECUTE SCRIPT('
+       + 'SQL=\'CREATE TABLE test_only_on(id serial, value text);\''
+       + ' ,EVENT NODE=3,execute only on=\'1,2,3\');\n'
+        + 'sync(id=3);\n wait for event(origin=3, confirmed=all, wait on=3);\n';
+    
+    run_slonik('execute_on_subscriber.create',coordinator,preamble,slonikScript);
+    /**
+     * Now drop the table on nodes 1 and 2. 
+     * That will fail if the CREATE did not propogate
+     */
+    slonikScript = 'EXECUTE SCRIPT('
+       + 'SQL=\'DROP TABLE test_only_on;\''
+       + ' ,EVENT NODE=2, EXECUTE ONLY ON=2);\n' 
+       + 'EXECUTE SCRIPT('
+       + 'SQL=\'DROP TABLE test_only_on;\''
+       + ' ,EVENT NODE=1, EXECUTE ONLY ON=1);\n' 
+       + 'EXECUTE SCRIPT('
+       + 'SQL=\'DROP TABLE test_only_on;\''
+       + ' ,EVENT NODE=3, EXECUTE ONLY ON=3);\n' ;
+            
+    run_slonik('execute_on_subscriber.drop',coordinator,preamble,slonikScript);
+    
+}
+
 function do_test(coordinator) {
 
        var numrows = random_number(150,350);
@@ -229,6 +261,8 @@ function do_test(coordinator) {
        trigger_function(coordinator);
        wait_for_sync(coordinator);
        execute_on_subscriber(coordinator);
+        wait_for_sync(coordinator);
+        execute_only_on_list(coordinator);
 }
 
 function get_compare_queries() {
index eff6d86cb64ed353538c11d35e3a741975a26782..e2a03cfdb4b0a2b7f9d66852fdb94053ca37d4d7 100644 (file)
@@ -2816,8 +2816,9 @@ FAILOVER(
      </varlistentry>
      <varlistentry><term><literal> EXECUTE ONLY ON = ival
        </literal></term> <listitem><para> (Optional) The ID of the only
-       node to actually execute the script.  This option causes the
-       script to be propagated by all nodes but executed only by one.
+       node to actually execute the script. This can be a single node value or a comma separated
+        list of nodes. This option causes the
+       script to be propagated by all nodes but executed only on the specified nodes.
        The default is to execute the script on all nodes that are
        subscribed to the set.</para></listitem>
       
@@ -2845,6 +2846,12 @@ EXECUTE SCRIPT (
    FILENAME = '/tmp/changes_2008-04-01.sql',
    EVENT NODE = 1
 );
+
+EXECUTE SCRIPT (
+   FILENAME = '/tmp/changes_2008-04-01.sql',
+   EVENT NODE = 1,
+   EXECUTE ONLY ON='1,2,3'
+);
     </programlisting>
    </refsect1>
    <refsect1> <title> Locking Behaviour </title>