Check activate snapshot consistency between nodes in check_mx

velioglu/metadata_consistency
Burak Velioglu 2022-03-14 10:30:58 +03:00
parent 37fafd007c
commit 53e89e8d1f
No known key found for this signature in database
GPG Key ID: F6827E620F6549C6
2 changed files with 48 additions and 0 deletions

View File

@ -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)

View File

@ -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());