From 89c1ccb7a5592c705122f01922baadc5aaecb60f Mon Sep 17 00:00:00 2001 From: Onder Kalaci Date: Mon, 30 May 2022 12:45:00 +0200 Subject: [PATCH] Show that no metadata is sent when disabled --- .../expected/multi_cluster_management.out | 46 +++++++++++++++++++ .../regress/sql/multi_cluster_management.sql | 20 ++++++++ 2 files changed, 66 insertions(+) diff --git a/src/test/regress/expected/multi_cluster_management.out b/src/test/regress/expected/multi_cluster_management.out index fce2bcbd2..cb3fe3a5d 100644 --- a/src/test/regress/expected/multi_cluster_management.out +++ b/src/test/regress/expected/multi_cluster_management.out @@ -1190,6 +1190,52 @@ WHERE logicalrelid = 'test_dist_non_colocated'::regclass GROUP BY nodeport ORDER SELECT * from master_set_node_property('localhost', :worker_2_port, 'bogusproperty', false); ERROR: only the 'shouldhaveshards' property can be set using this function +SELECT nextval('pg_catalog.pg_dist_groupid_seq') AS last_group_id_cls \gset +SELECT nextval('pg_catalog.pg_dist_node_nodeid_seq') AS last_node_id_cls \gset +BEGIN; + -- show that we do not send any metadata to any nodes if not enabled + SET LOCAL citus.log_remote_commands TO ON; + SET LOCAL citus.grep_remote_commands TO '%pg_dist%'; + SET citus.enable_metadata_sync TO OFF; + SELECT start_metadata_sync_to_all_nodes(); + start_metadata_sync_to_all_nodes +--------------------------------------------------------------------- + t +(1 row) + + DROP TABLE test_dist, test_ref, test_dist_colocated, test_dist_non_colocated; + SELECT 1 FROM citus_remove_node('localhost', :worker_1_port); + ?column? +--------------------------------------------------------------------- + 1 +(1 row) + + SELECT 1 FROM citus_remove_node('localhost', :worker_2_port); + ?column? +--------------------------------------------------------------------- + 1 +(1 row) + + SELECT 1 FROM citus_add_node('localhost', :worker_1_port); +NOTICE: issuing SELECT metadata ->> 'server_id' AS server_id FROM pg_dist_node_metadata +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx + ?column? +--------------------------------------------------------------------- + 1 +(1 row) + + SELECT 1 FROM citus_add_node('localhost', :worker_2_port); +NOTICE: issuing SELECT metadata ->> 'server_id' AS server_id FROM pg_dist_node_metadata +DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx + ?column? +--------------------------------------------------------------------- + 1 +(1 row) + +ROLLBACK; +-- keep the rest of the tests inact that depends node/group ids +ALTER SEQUENCE pg_catalog.pg_dist_groupid_seq RESTART :last_group_id_cls; +ALTER SEQUENCE pg_catalog.pg_dist_node_nodeid_seq RESTART :last_node_id_cls; DROP TABLE test_dist, test_ref, test_dist_colocated, test_dist_non_colocated; BEGIN; SELECT start_metadata_sync_to_all_nodes(); diff --git a/src/test/regress/sql/multi_cluster_management.sql b/src/test/regress/sql/multi_cluster_management.sql index 4162ad7c6..6d9b9c589 100644 --- a/src/test/regress/sql/multi_cluster_management.sql +++ b/src/test/regress/sql/multi_cluster_management.sql @@ -482,6 +482,26 @@ WHERE logicalrelid = 'test_dist_non_colocated'::regclass GROUP BY nodeport ORDER SELECT * from master_set_node_property('localhost', :worker_2_port, 'bogusproperty', false); +SELECT nextval('pg_catalog.pg_dist_groupid_seq') AS last_group_id_cls \gset +SELECT nextval('pg_catalog.pg_dist_node_nodeid_seq') AS last_node_id_cls \gset + +BEGIN; + -- show that we do not send any metadata to any nodes if not enabled + SET LOCAL citus.log_remote_commands TO ON; + SET LOCAL citus.grep_remote_commands TO '%pg_dist%'; + SET citus.enable_metadata_sync TO OFF; + SELECT start_metadata_sync_to_all_nodes(); + DROP TABLE test_dist, test_ref, test_dist_colocated, test_dist_non_colocated; + SELECT 1 FROM citus_remove_node('localhost', :worker_1_port); + SELECT 1 FROM citus_remove_node('localhost', :worker_2_port); + SELECT 1 FROM citus_add_node('localhost', :worker_1_port); + SELECT 1 FROM citus_add_node('localhost', :worker_2_port); +ROLLBACK; + +-- keep the rest of the tests inact that depends node/group ids +ALTER SEQUENCE pg_catalog.pg_dist_groupid_seq RESTART :last_group_id_cls; +ALTER SEQUENCE pg_catalog.pg_dist_node_nodeid_seq RESTART :last_node_id_cls; + DROP TABLE test_dist, test_ref, test_dist_colocated, test_dist_non_colocated; BEGIN;