Adds the necessary regress tests

pull/7720/head
German Eichberger 2025-03-17 21:14:53 +00:00
parent b801d358b5
commit e15a94ec3b
2 changed files with 30 additions and 0 deletions

View File

@ -25,6 +25,15 @@ SELECT citus_is_coordinator();
t
(1 row)
-- I am primary node (fails beacuse not set in pg_dist)
select citus_is_primary_node();
WARNING: could not find the current node in pg_dist_node
DETAIL: If this is the coordinator node, consider adding it into the metadata by using citus_set_coordinator_host() UDF. Otherwise, if you're going to use this node as a worker node for a new cluster, make sure to add this node into the metadata from the coordinator by using citus_add_node() UDF.
citus_is_primary_node
---------------------------------------------------------------------
(1 row)
-- make sure coordinator is always in metadata.
SELECT citus_set_coordinator_host('localhost');
citus_set_coordinator_host
@ -32,6 +41,13 @@ SELECT citus_set_coordinator_host('localhost');
(1 row)
-- I am primary node
select citus_is_primary_node();
citus_is_primary_node
---------------------------------------------------------------------
t
(1 row)
-- workers are not coordinator
SELECT result FROM run_command_on_workers('SELECT citus_is_coordinator()');
result
@ -40,6 +56,14 @@ SELECT result FROM run_command_on_workers('SELECT citus_is_coordinator()');
f
(2 rows)
-- primary workers are primary node
SELECT result FROM run_command_on_workers('SELECT citus_is_primary_node()');
result
---------------------------------------------------------------------
t
t
(2 rows)
-- get the active nodes
SELECT master_get_active_worker_nodes();
master_get_active_worker_nodes

View File

@ -14,12 +14,18 @@ RESET citus.metadata_sync_mode;
-- I am coordinator
SELECT citus_is_coordinator();
-- I am primary node
select citus.citus_is_primary_node();
-- make sure coordinator is always in metadata.
SELECT citus_set_coordinator_host('localhost');
-- workers are not coordinator
SELECT result FROM run_command_on_workers('SELECT citus_is_coordinator()');
-- primary workers are primary node
SELECT result FROM run_command_on_workers('SELECT citus_is_primary_node()');
-- get the active nodes
SELECT master_get_active_worker_nodes();