tenant-schema-isolation-complete-view
Onur Tirtir 2023-10-16 14:55:29 +03:00
parent 26c27a9fbf
commit 01b2bf5e3c
1 changed files with 7 additions and 15 deletions

View File

@ -49,8 +49,7 @@ typedef struct NodeToPlacementGroupHashEntry
/* /*
* Whether given node is allowed to have any shards. * Whether given node is allowed to have any shards.
* *
* This is not just WorkerNode->shouldHaveShards but also takes into account * Inherited from WorkerNode->shouldHaveShards.
* whether the node is being drained.
*/ */
bool shouldHaveShards; bool shouldHaveShards;
@ -74,8 +73,7 @@ typedef struct NodeToPlacementGroupHashEntry
static void InitRebalancerPlacementSeparationContext( static void InitRebalancerPlacementSeparationContext(
RebalancerPlacementSeparationContext *context, RebalancerPlacementSeparationContext *context,
List *activeWorkerNodeList, List *activeWorkerNodeList,
List *rebalancePlacementList, List *rebalancePlacementList);
WorkerNode *drainWorkerNode);
static void TryAssignPlacementGroupsToNodeGroups( static void TryAssignPlacementGroupsToNodeGroups(
RebalancerPlacementSeparationContext *context, RebalancerPlacementSeparationContext *context,
List *activeWorkerNodeList, List *activeWorkerNodeList,
@ -137,8 +135,7 @@ PrepareRebalancerPlacementSeparationContext(List *activeWorkerNodeList,
static void static void
InitRebalancerPlacementSeparationContext(RebalancerPlacementSeparationContext *context, InitRebalancerPlacementSeparationContext(RebalancerPlacementSeparationContext *context,
List *activeWorkerNodeList, List *activeWorkerNodeList,
List *rebalancePlacementList, List *rebalancePlacementList)
WorkerNode *drainWorkerNode)
{ {
HTAB *nodePlacementGroupHash = context->nodePlacementGroupHash; HTAB *nodePlacementGroupHash = context->nodePlacementGroupHash;
@ -152,15 +149,10 @@ InitRebalancerPlacementSeparationContext(RebalancerPlacementSeparationContext *c
hash_search(nodePlacementGroupHash, &workerNode->groupId, HASH_ENTER, hash_search(nodePlacementGroupHash, &workerNode->groupId, HASH_ENTER,
NULL); NULL);
bool shouldHaveShards = workerNode->shouldHaveShards; nodePlacementGroupHashEntry->shouldHaveShards =
if (drainWorkerNode && drainWorkerNode->groupId == workerNode->groupId) workerNode->shouldHaveShards;
{
shouldHaveShards = false;
}
nodePlacementGroupHashEntry->shouldHaveShards = shouldHaveShards;
nodePlacementGroupHashEntry->allowedToSeparateAnyPlacementGroup = nodePlacementGroupHashEntry->allowedToSeparateAnyPlacementGroup =
shouldHaveShards; workerNode->shouldHaveShards;
nodePlacementGroupHashEntry->assignedPlacementGroup = NULL; nodePlacementGroupHashEntry->assignedPlacementGroup = NULL;
/* /*
@ -188,7 +180,7 @@ InitRebalancerPlacementSeparationContext(RebalancerPlacementSeparationContext *c
* plans the moves. * plans the moves.
*/ */
if (!shouldHaveShards) if (!workerNode->shouldHaveShards)
{ {
/* we can't assing any shardgroup placements to the node anyway */ /* we can't assing any shardgroup placements to the node anyway */
continue; continue;