mirror of https://github.com/citusdata/citus.git
Make sure citus_is_coordinator works on read replicas
parent
8ab696f7e2
commit
b2e9a5baf1
|
@ -1687,7 +1687,7 @@ citus_is_coordinator(PG_FUNCTION_ARGS)
|
|||
bool isCoordinator = false;
|
||||
|
||||
if (GetLocalGroupId() == COORDINATOR_GROUP_ID &&
|
||||
ActivePrimaryNodeCount() > 0)
|
||||
ActiveReadableNodeCount() > 0)
|
||||
{
|
||||
isCoordinator = true;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue