mirror of https://github.com/citusdata/citus.git
properly assign conflicting placements
parent
7e9a186fa2
commit
2fc1411da4
|
@ -279,21 +279,20 @@ NodeToPlacementGroupHashAssignNodes(HTAB *nodePlacementGroupHash,
|
|||
}
|
||||
}
|
||||
|
||||
bool emitWarning = false;
|
||||
|
||||
/*
|
||||
* For the shard placement groups that could not be assigned to their
|
||||
* current node, assign them to any other node that is available.
|
||||
*/
|
||||
int availableNodeIdx = 0;
|
||||
ShardPlacement *unassignedShardPlacement = NULL;
|
||||
foreach_ptr(unassignedShardPlacement, unassignedPlacementList)
|
||||
{
|
||||
bool separated = false;
|
||||
while (!separated && availableNodeIdx < list_length(availableWorkerList))
|
||||
{
|
||||
WorkerNode *availableWorkerNode =
|
||||
(WorkerNode *) list_nth(availableWorkerList, availableNodeIdx);
|
||||
availableNodeIdx++;
|
||||
|
||||
WorkerNode *availableWorkerNode = NULL;
|
||||
foreach_ptr(availableWorkerNode, availableWorkerList)
|
||||
{
|
||||
if (NodeToPlacementGroupHashAssignNode(nodePlacementGroupHash,
|
||||
availableWorkerNode->groupId,
|
||||
unassignedShardPlacement,
|
||||
|
@ -306,11 +305,15 @@ NodeToPlacementGroupHashAssignNodes(HTAB *nodePlacementGroupHash,
|
|||
|
||||
if (!separated)
|
||||
{
|
||||
ereport(WARNING, (errmsg("could not separate all shard placements "
|
||||
"that need a separate node")));
|
||||
return;
|
||||
emitWarning = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (emitWarning)
|
||||
{
|
||||
ereport(WARNING, (errmsg("could not separate all shard placements "
|
||||
"that need a separate node")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue