diff --git a/src/test/regress/expected/check_mx.out b/src/test/regress/expected/check_mx.out index 6a030bc31..5b5aad5da 100644 --- a/src/test/regress/expected/check_mx.out +++ b/src/test/regress/expected/check_mx.out @@ -10,3 +10,29 @@ SELECT bool_and(metadatasynced) FROM pg_dist_node WHERE noderole = 'primary'; t (1 row) +-- Create the necessary test utility function +CREATE OR REPLACE FUNCTION activate_node_snapshot() + RETURNS text[] + LANGUAGE C STRICT + AS 'citus'; +-- Following tests capture the difference between the metadata in the worker nodes and the +-- coordinator. It is expected to see no rows. However if the tests fail, we list the +-- problematic queries in the activate_node_snapshot() result set. +-- list all metadata that is missing in the worker nodes +SELECT unnest(activate_node_snapshot()) + EXCEPT +SELECT unnest(result::text[]) AS unnested_result +FROM run_command_on_workers($$SELECT activate_node_snapshot()$$); + unnest +--------------------------------------------------------------------- +(0 rows) + +-- list all the metadata that is missing on the coordinator +SELECT unnest(result::text[]) AS unnested_result +FROM run_command_on_workers($$SELECT activate_node_snapshot()$$) + EXCEPT +SELECT unnest(activate_node_snapshot()); + unnested_result +--------------------------------------------------------------------- +(0 rows) + diff --git a/src/test/regress/sql/check_mx.sql b/src/test/regress/sql/check_mx.sql index 6c9b2b664..f2da78316 100644 --- a/src/test/regress/sql/check_mx.sql +++ b/src/test/regress/sql/check_mx.sql @@ -1,3 +1,25 @@ SHOW citus.enable_metadata_sync; SELECT bool_and(metadatasynced) FROM pg_dist_node WHERE noderole = 'primary'; + +-- Create the necessary test utility function +CREATE OR REPLACE FUNCTION activate_node_snapshot() + RETURNS text[] + LANGUAGE C STRICT + AS 'citus'; + +-- Following tests capture the difference between the metadata in the worker nodes and the +-- coordinator. It is expected to see no rows. However if the tests fail, we list the +-- problematic queries in the activate_node_snapshot() result set. + +-- list all metadata that is missing in the worker nodes +SELECT unnest(activate_node_snapshot()) + EXCEPT +SELECT unnest(result::text[]) AS unnested_result +FROM run_command_on_workers($$SELECT activate_node_snapshot()$$); + +-- list all the metadata that is missing on the coordinator +SELECT unnest(result::text[]) AS unnested_result +FROM run_command_on_workers($$SELECT activate_node_snapshot()$$) + EXCEPT +SELECT unnest(activate_node_snapshot());