diff --git a/src/backend/distributed/metadata/node_metadata.c b/src/backend/distributed/metadata/node_metadata.c index 219a2aeb0..4759c1712 100644 --- a/src/backend/distributed/metadata/node_metadata.c +++ b/src/backend/distributed/metadata/node_metadata.c @@ -743,11 +743,10 @@ SyncTableMetadataCommandList(WorkerNode *workerNode) List *commandList = NIL; /* - * Remove shell tables and pg_dist_* metadata. + * Remove shell tables first. */ commandList = list_concat(commandList, DetachPartitionCommandList()); - commandList = lappend(commandList, REMOVE_ALL_CITUS_TABLES_COMMAND); - commandList = lappend(commandList, DELETE_ALL_DISTRIBUTED_OBJECTS); + commandList = lappend(commandList, REMOVE_ALL_CLUSTERED_TABLES_ONLY_COMMAND); /* * Propagate node wide objects. It includes only roles for now. @@ -767,6 +766,11 @@ SyncTableMetadataCommandList(WorkerNode *workerNode) */ commandList = list_concat(commandList, InterTableRelationshipCommandList()); + commandList = lappend(commandList, DELETE_ALL_DISTRIBUTED_OBJECTS); + commandList = lappend(commandList, DELETE_ALL_PLACEMENTS); + commandList = lappend(commandList, DELETE_ALL_SHARDS); + commandList = lappend(commandList, DELETE_ALL_PARTITIONS); + /* * Finally create pg_dist_* entries */ diff --git a/src/test/regress/sql/citus_local_tables_mx.sql b/src/test/regress/sql/citus_local_tables_mx.sql index cbc73c0ca..b5e3e5770 100644 --- a/src/test/regress/sql/citus_local_tables_mx.sql +++ b/src/test/regress/sql/citus_local_tables_mx.sql @@ -35,7 +35,11 @@ FOR EACH ROW EXECUTE FUNCTION dummy_function(); -- Show that we can activate node successfully. That means, we create -- the function that trigger needs in mx workers too. +set citus.log_remote_commands to true; +set citus.worker_min_messages to debug4; SELECT citus_activate_node('localhost', :worker_1_port); +reset citus.log_remote_commands; +reset citus.worker_min_messages; CREATE EXTENSION seg; ALTER TRIGGER dummy_function_trigger ON citus_local_table DEPENDS ON EXTENSION seg;