mirror of https://github.com/citusdata/citus.git
Allow start_metadata_sync_to_node in a transaction block
parent
a16c333dfc
commit
cfea11b137
|
@ -86,8 +86,6 @@ start_metadata_sync_to_node(PG_FUNCTION_ARGS)
|
||||||
EnsureSchemaNode();
|
EnsureSchemaNode();
|
||||||
EnsureSuperUser();
|
EnsureSuperUser();
|
||||||
|
|
||||||
PreventTransactionChain(true, "start_metadata_sync_to_node");
|
|
||||||
|
|
||||||
workerNode = FindWorkerNode(nodeNameString, nodePort);
|
workerNode = FindWorkerNode(nodeNameString, nodePort);
|
||||||
|
|
||||||
if (workerNode == NULL)
|
if (workerNode == NULL)
|
||||||
|
|
|
@ -313,6 +313,7 @@ RESET citus.shard_replication_factor;
|
||||||
RESET citus.replication_model;
|
RESET citus.replication_model;
|
||||||
-- Check that repeated calls to start_metadata_sync_to_node has no side effects
|
-- Check that repeated calls to start_metadata_sync_to_node has no side effects
|
||||||
\c - - - :master_port
|
\c - - - :master_port
|
||||||
|
BEGIN;
|
||||||
SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
|
SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
|
||||||
start_metadata_sync_to_node
|
start_metadata_sync_to_node
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
@ -325,6 +326,7 @@ SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
\c - - - :worker_1_port
|
\c - - - :worker_1_port
|
||||||
SELECT * FROM pg_dist_local_group;
|
SELECT * FROM pg_dist_local_group;
|
||||||
groupid
|
groupid
|
||||||
|
@ -388,18 +390,6 @@ SELECT count(*) FROM pg_trigger WHERE tgrelid='mx_testing_schema.mx_test_table':
|
||||||
1
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- Make sure that start_metadata_sync_to_node cannot be called inside a transaction
|
|
||||||
\c - - - :master_port
|
|
||||||
BEGIN;
|
|
||||||
SELECT start_metadata_sync_to_node('localhost', :worker_2_port);
|
|
||||||
ERROR: start_metadata_sync_to_node cannot run inside a transaction block
|
|
||||||
ROLLBACK;
|
|
||||||
SELECT hasmetadata FROM pg_dist_node WHERE nodeport=:worker_2_port;
|
|
||||||
hasmetadata
|
|
||||||
-------------
|
|
||||||
f
|
|
||||||
(1 row)
|
|
||||||
|
|
||||||
-- Check that the distributed table can be queried from the worker
|
-- Check that the distributed table can be queried from the worker
|
||||||
\c - - - :master_port
|
\c - - - :master_port
|
||||||
SET citus.shard_replication_factor TO 1;
|
SET citus.shard_replication_factor TO 1;
|
||||||
|
|
|
@ -119,8 +119,10 @@ RESET citus.replication_model;
|
||||||
|
|
||||||
-- Check that repeated calls to start_metadata_sync_to_node has no side effects
|
-- Check that repeated calls to start_metadata_sync_to_node has no side effects
|
||||||
\c - - - :master_port
|
\c - - - :master_port
|
||||||
|
BEGIN;
|
||||||
SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
|
SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
|
||||||
SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
|
SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
|
||||||
|
COMMIT;
|
||||||
\c - - - :worker_1_port
|
\c - - - :worker_1_port
|
||||||
SELECT * FROM pg_dist_local_group;
|
SELECT * FROM pg_dist_local_group;
|
||||||
SELECT * FROM pg_dist_node ORDER BY nodeid;
|
SELECT * FROM pg_dist_node ORDER BY nodeid;
|
||||||
|
@ -130,14 +132,6 @@ SELECT * FROM pg_dist_shard_placement ORDER BY shardid;
|
||||||
\d mx_testing_schema.mx_test_table
|
\d mx_testing_schema.mx_test_table
|
||||||
SELECT count(*) FROM pg_trigger WHERE tgrelid='mx_testing_schema.mx_test_table'::regclass;
|
SELECT count(*) FROM pg_trigger WHERE tgrelid='mx_testing_schema.mx_test_table'::regclass;
|
||||||
|
|
||||||
-- Make sure that start_metadata_sync_to_node cannot be called inside a transaction
|
|
||||||
\c - - - :master_port
|
|
||||||
BEGIN;
|
|
||||||
SELECT start_metadata_sync_to_node('localhost', :worker_2_port);
|
|
||||||
ROLLBACK;
|
|
||||||
|
|
||||||
SELECT hasmetadata FROM pg_dist_node WHERE nodeport=:worker_2_port;
|
|
||||||
|
|
||||||
-- Check that the distributed table can be queried from the worker
|
-- Check that the distributed table can be queried from the worker
|
||||||
\c - - - :master_port
|
\c - - - :master_port
|
||||||
SET citus.shard_replication_factor TO 1;
|
SET citus.shard_replication_factor TO 1;
|
||||||
|
|
Loading…
Reference in New Issue