diff --git a/src/backend/distributed/metadata/node_metadata.c b/src/backend/distributed/metadata/node_metadata.c index b5423a8a2..d040514bc 100644 --- a/src/backend/distributed/metadata/node_metadata.c +++ b/src/backend/distributed/metadata/node_metadata.c @@ -787,7 +787,6 @@ SyncDistributedObjectsToNode(WorkerNode *workerNode) return; } - EnsureNoModificationsHaveBeenDone(); EnsureSequentialModeMetadataOperations(); Assert(ShouldPropagate()); diff --git a/src/backend/distributed/metadata/pg_get_object_address_12_13_14.c b/src/backend/distributed/metadata/pg_get_object_address_12_13_14.c index f2d66fb59..c2a8e29e3 100644 --- a/src/backend/distributed/metadata/pg_get_object_address_12_13_14.c +++ b/src/backend/distributed/metadata/pg_get_object_address_12_13_14.c @@ -402,8 +402,7 @@ ErrorIfCurrentUserCanNotDistributeObject(ObjectType type, ObjectAddress *addr, bool skipAclCheck = false; Oid idToCheck = InvalidOid; - /* Since we don't handle sequences like object, add it separately */ - if (!(SupportedDependencyByCitus(addr) || type == OBJECT_SEQUENCE)) + if (!SupportedDependencyByCitus(addr)) { ereport(ERROR, (errmsg("Object type %d can not be distributed by Citus", type))); } diff --git a/src/test/regress/expected/multi_replicate_reference_table.out b/src/test/regress/expected/multi_replicate_reference_table.out index e77ce2df1..aa5d10149 100644 --- a/src/test/regress/expected/multi_replicate_reference_table.out +++ b/src/test/regress/expected/multi_replicate_reference_table.out @@ -464,7 +464,11 @@ SELECT create_reference_table('replicate_reference_table_insert'); BEGIN; INSERT INTO replicate_reference_table_insert VALUES(1); SELECT 1 FROM master_add_node('localhost', :worker_2_port); -ERROR: cannot open new connections after the first modification command within a transaction + ?column? +--------------------------------------------------------------------- + 1 +(1 row) + ROLLBACK; DROP TABLE replicate_reference_table_insert; -- test COPY then adding a new node in a transaction @@ -479,7 +483,11 @@ SET citus.enable_local_execution = 'off'; BEGIN; COPY replicate_reference_table_copy FROM STDIN; SELECT 1 FROM master_add_node('localhost', :worker_2_port); -ERROR: cannot open new connections after the first modification command within a transaction + ?column? +--------------------------------------------------------------------- + 1 +(1 row) + ROLLBACK; RESET citus.enable_local_execution; DROP TABLE replicate_reference_table_copy; @@ -494,7 +502,11 @@ SELECT create_reference_table('replicate_reference_table_ddl'); BEGIN; ALTER TABLE replicate_reference_table_ddl ADD column2 int; SELECT 1 FROM master_add_node('localhost', :worker_2_port); -ERROR: cannot open new connections after the first modification command within a transaction + ?column? +--------------------------------------------------------------------- + 1 +(1 row) + ROLLBACK; DROP TABLE replicate_reference_table_ddl; -- test DROP table after adding new node in a transaction diff --git a/src/test/regress/expected/start_stop_metadata_sync.out b/src/test/regress/expected/start_stop_metadata_sync.out index 3cbbf1572..1f82c60cb 100644 --- a/src/test/regress/expected/start_stop_metadata_sync.out +++ b/src/test/regress/expected/start_stop_metadata_sync.out @@ -156,7 +156,7 @@ SELECT * FROM test_matview; (1 row) SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'events%' ORDER BY logicalrelid::text; - logicalrelid | partmethod | partkey | colocationid | repmodel | autoconverted + logicalrelid | partmethod | partkey | colocationid | repmodel | autoconverted --------------------------------------------------------------------- events | h | {VAR :varno 1 :varattno 1 :vartype 1184 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location -1} | 1390012 | s | f events_2021_feb | h | {VAR :varno 1 :varattno 1 :vartype 1184 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location -1} | 1390012 | s | f @@ -468,7 +468,9 @@ BEGIN; (1 row) SELECT start_metadata_sync_to_node('localhost', :worker_1_port); -ERROR: cannot open new connections after the first modification command within a transaction +ERROR: cannot execute metadata syncing operation because there was a parallel operation on a distributed table in the transaction +DETAIL: When modifying metadata, Citus needs to perform all operations over a single connection per node to ensure consistency. +HINT: Try re-running the transaction with "SET LOCAL citus.multi_shard_modify_mode TO 'sequential';" ROLLBACK; -- this is safe because start_metadata_sync_to_node already switches to -- sequential execution @@ -539,7 +541,11 @@ BEGIN; -- sync at the end of the tx SELECT start_metadata_sync_to_node('localhost', :worker_1_port); -ERROR: cannot open new connections after the first modification command within a transaction + start_metadata_sync_to_node +--------------------------------------------------------------------- + +(1 row) + ROLLBACK; -- multi-shard commands are not allowed with start_metadata_sync BEGIN; @@ -576,7 +582,11 @@ BEGIN; -- sync at the end of the tx SELECT start_metadata_sync_to_node('localhost', :worker_1_port); -ERROR: cannot open new connections after the first modification command within a transaction + start_metadata_sync_to_node +--------------------------------------------------------------------- + +(1 row) + ROLLBACK; -- cleanup \c - - - :master_port