mirror of https://github.com/citusdata/citus.git
Add AppendDistributedTablePlacementNodeList function
parent
145112f3a0
commit
7e30e717ef
|
@ -166,7 +166,7 @@ master_create_empty_shard(PG_FUNCTION_ARGS)
|
||||||
uint64 shardId = GetNextShardId();
|
uint64 shardId = GetNextShardId();
|
||||||
|
|
||||||
/* if enough live groups, add an extra candidate node as backup */
|
/* if enough live groups, add an extra candidate node as backup */
|
||||||
List *workerNodeList = DistributedTablePlacementNodeList(NoLock);
|
List *workerNodeList = AppendDistributedTablePlacementNodeList(NoLock);
|
||||||
|
|
||||||
if (list_length(workerNodeList) > ShardReplicationFactor)
|
if (list_length(workerNodeList) > ShardReplicationFactor)
|
||||||
{
|
{
|
||||||
|
|
|
@ -499,6 +499,19 @@ DistributedTablePlacementNodeList(LOCKMODE lockMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* AppendDistributedTablePlacementNodeList returns a list of all active, primary
|
||||||
|
* worker nodes that can store new data, i.e shouldstoreshards is 'true', and are
|
||||||
|
* not the coordinator
|
||||||
|
*/
|
||||||
|
List *
|
||||||
|
AppendDistributedTablePlacementNodeList(LOCKMODE lockMode)
|
||||||
|
{
|
||||||
|
EnsureModificationsCanRun();
|
||||||
|
return FilterActiveNodeListFunc(lockMode, NodeCanHaveAppendDistTablePlacements);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NodeCanHaveDistTablePlacements returns true if the given node can have
|
* NodeCanHaveDistTablePlacements returns true if the given node can have
|
||||||
* shards of a distributed table.
|
* shards of a distributed table.
|
||||||
|
@ -515,6 +528,22 @@ NodeCanHaveDistTablePlacements(WorkerNode *node)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NodeCanHaveAppendDistTablePlacements returns true if the given node can have
|
||||||
|
* shards of a distributed table, and is not the coordinator
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
NodeCanHaveAppendDistTablePlacements(WorkerNode *node)
|
||||||
|
{
|
||||||
|
if (!NodeIsPrimary(node))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return node->shouldHaveShards && (node->groupId != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ActiveReadableNonCoordinatorNodeList returns a list of all nodes in workerNodeHash
|
* ActiveReadableNonCoordinatorNodeList returns a list of all nodes in workerNodeHash
|
||||||
* that are readable nodes This method excludes coordinator.
|
* that are readable nodes This method excludes coordinator.
|
||||||
|
|
|
@ -79,7 +79,9 @@ extern List * ReferenceTablePlacementNodeList(LOCKMODE lockMode);
|
||||||
extern WorkerNode * CoordinatorNodeIfAddedAsWorkerOrError(void);
|
extern WorkerNode * CoordinatorNodeIfAddedAsWorkerOrError(void);
|
||||||
extern void ErrorIfCoordinatorNotAddedAsWorkerNode(void);
|
extern void ErrorIfCoordinatorNotAddedAsWorkerNode(void);
|
||||||
extern List * DistributedTablePlacementNodeList(LOCKMODE lockMode);
|
extern List * DistributedTablePlacementNodeList(LOCKMODE lockMode);
|
||||||
|
extern List * AppendDistributedTablePlacementNodeList(LOCKMODE lockMode);
|
||||||
extern bool NodeCanHaveDistTablePlacements(WorkerNode *node);
|
extern bool NodeCanHaveDistTablePlacements(WorkerNode *node);
|
||||||
|
extern bool NodeCanHaveAppendDistTablePlacements(WorkerNode *node);
|
||||||
extern uint32 ActiveReadableNonCoordinatorNodeCount(void);
|
extern uint32 ActiveReadableNonCoordinatorNodeCount(void);
|
||||||
extern List * ActiveReadableNonCoordinatorNodeList(void);
|
extern List * ActiveReadableNonCoordinatorNodeList(void);
|
||||||
extern List * ActiveReadableNodeList(void);
|
extern List * ActiveReadableNodeList(void);
|
||||||
|
|
Loading…
Reference in New Issue