Make sure citus_is_coordinator works on read replicas

(cherry picked from commit b2e9a5baf1)
release-11.0_july_13
Onder Kalaci 2022-07-13 14:11:18 +02:00
parent 06d6ffbb6e
commit 06e55df141
3 changed files with 5 additions and 5 deletions

View File

@ -1687,7 +1687,7 @@ citus_is_coordinator(PG_FUNCTION_ARGS)
bool isCoordinator = false; bool isCoordinator = false;
if (GetLocalGroupId() == COORDINATOR_GROUP_ID && if (GetLocalGroupId() == COORDINATOR_GROUP_ID &&
ActivePrimaryNodeCount() > 0) ActiveReadableNodeCount() > 0)
{ {
isCoordinator = true; 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 uint32
ActivePrimaryNodeCount(void) ActiveReadableNodeCount(void)
{ {
List *nodeList = ActivePrimaryNodeList(NoLock); List *nodeList = ActiveReadableNodeList();
return list_length(nodeList); return list_length(nodeList);
} }

View File

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