From: Steve Singer Date: Thu, 17 Apr 2014 13:54:14 +0000 (-0400) Subject: Document the EXECUTE ONLY ON list of nodes syntax X-Git-Url: http://git.postgresql.org/gitweb/edit?a=commitdiff_plain;h=0efd65187fb7ede1ad97eb377f98f0f1bef06f8a;p=slony1-engine.git Document the EXECUTE ONLY ON list of nodes syntax Also add a regression test to test this --- diff --git a/clustertest/regression/testddl/testddl.js b/clustertest/regression/testddl/testddl.js index 5bacb95d..1cd1e7cc 100644 --- a/clustertest/regression/testddl/testddl.js +++ b/clustertest/regression/testddl/testddl.js @@ -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() { diff --git a/doc/adminguide/slonik_ref.sgml b/doc/adminguide/slonik_ref.sgml index eff6d86c..e2a03cfd 100644 --- a/doc/adminguide/slonik_ref.sgml +++ b/doc/adminguide/slonik_ref.sgml @@ -2816,8 +2816,9 @@ FAILOVER( EXECUTE ONLY ON = ival (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. @@ -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' +); Locking Behaviour