pull/7720/head
Onur Tirtir 2025-03-14 18:19:50 +03:00
parent 5307653577
commit c375b58335
2 changed files with 5 additions and 4 deletions

View File

@ -1665,6 +1665,7 @@ citus_is_coordinator(PG_FUNCTION_ARGS)
PG_RETURN_BOOL(isCoordinator);
}
/*
* citus_is_primary_node returns whether the current node is a primary for
* a given group_id. We consider the node a primary if it has
@ -1675,14 +1676,13 @@ citus_is_primary_node(PG_FUNCTION_ARGS)
{
CheckCitusVersion(ERROR);
bool isPrimary = false;
int32 groupId = GetLocalGroupId();
WorkerNode *workerNode = PrimaryNodeForGroup(groupId, NULL);
if (workerNode == NULL)
{
ereport(WARNING, (errmsg("could not find the current node in pg_dist_node"),
errdetail("If this is the coordinator node, consider adding it "
"into the metadata by using citus_set_coordinator_host() "
"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 "
@ -1690,11 +1690,12 @@ citus_is_primary_node(PG_FUNCTION_ARGS)
PG_RETURN_NULL();
}
isPrimary = workerNode->nodeId == GetLocalNodeId();
bool isPrimary = workerNode->nodeId == GetLocalNodeId();
PG_RETURN_BOOL(isPrimary);
}
/*
* EnsureParentSessionHasExclusiveLockOnPgDistNode ensures given session id
* holds Exclusive lock on pg_dist_node.

View File

@ -39,5 +39,5 @@ DROP FUNCTION citus_internal.update_placement_metadata(bigint, integer, integer)
DROP FUNCTION citus_internal.update_relation_colocation(oid, int);
DROP FUNCTION citus_internal.start_replication_origin_tracking();
DROP FUNCTION citus_internal.stop_replication_origin_tracking();
DROP FUNCTION citus_internal.is_replication_origin_tracking_active();
DROP FUNCTION citus_internal.is_replication_origin_tracking_active();
#include "../udfs/citus_finish_pg_upgrade/12.1-1.sql"