Skip to content

Commit

Permalink
properly assign conflicting placements
Browse files Browse the repository at this point in the history
  • Loading branch information
onurctirtir committed Oct 10, 2023
1 parent 7e9a186 commit 2fc1411
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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")));
}
}


Expand Down

0 comments on commit 2fc1411

Please sign in to comment.