Make sure citus_is_coordinator works on read replicas

pull/6057/head
Onder Kalaci 2022-07-13 14:11:18 +02:00
parent 8ab696f7e2
commit b2e9a5baf1
3 changed files with 5 additions and 5 deletions

View File

@ -1687,7 +1687,7 @@ citus_is_coordinator(PG_FUNCTION_ARGS)
bool isCoordinator = false;
if (GetLocalGroupId() == COORDINATOR_GROUP_ID &&
ActivePrimaryNodeCount() > 0)
ActiveReadableNodeCount() > 0)
{
isCoordinator = true;
}

View File

@ -94,12 +94,12 @@ ActivePrimaryNonCoordinatorNodeCount(void)
/*
* ActivePrimaryNodeCount returns the number of groups with a primary in the cluster.
* ActiveReadableNodeCount returns the number of nodes in the cluster.
*/
uint32
ActivePrimaryNodeCount(void)
ActiveReadableNodeCount(void)
{
List *nodeList = ActivePrimaryNodeList(NoLock);
List *nodeList = ActiveReadableNodeList();
return list_length(nodeList);
}

View File

@ -72,7 +72,7 @@ extern WorkerNode * WorkerGetRoundRobinCandidateNode(List *workerNodeList,
uint64 shardId,
uint32 placementIndex);
extern uint32 ActivePrimaryNonCoordinatorNodeCount(void);
extern uint32 ActivePrimaryNodeCount(void);
extern uint32 ActiveReadableNodeCount(void);
extern List * ActivePrimaryNonCoordinatorNodeList(LOCKMODE lockMode);
extern List * ActivePrimaryNodeList(LOCKMODE lockMode);
extern List * ActivePrimaryRemoteNodeList(LOCKMODE lockMode);