From 31b5de42b404fd599d9ba175ca1838b51d8ffb9f Mon Sep 17 00:00:00 2001 From: Nils Dijk Date: Fri, 1 Dec 2023 15:07:00 +0000 Subject: [PATCH] fix non-blocking shardsplits double shardgroup id consumption --- .../distributed/operations/shard_split.c | 37 ------------------- 1 file changed, 37 deletions(-) diff --git a/src/backend/distributed/operations/shard_split.c b/src/backend/distributed/operations/shard_split.c index bb0aacfa0..2083eaf70 100644 --- a/src/backend/distributed/operations/shard_split.c +++ b/src/backend/distributed/operations/shard_split.c @@ -132,7 +132,6 @@ static void UpdateDistributionColumnsForShardGroup(List *colocatedShardList, char distributionMethod, int shardCount, uint32 colocationId); -static void PopulateShardgroupIdsWithNewIds(List *shardGroupSplitIntervalListList); static void InsertSplitChildrenShardgroupMetadata(List *shardGroupSplitIntervalListList); static void InsertSplitChildrenShardMetadata(List *shardGroupSplitIntervalListList, List *workersForPlacementList); @@ -632,9 +631,6 @@ BlockingShardSplit(SplitOperation splitOperation, DropShardListMetadata(sourceColocatedShardIntervalList); - /* allocate and assign new shardgroups to newly created shardIntervals */ - PopulateShardgroupIdsWithNewIds(shardGroupSplitIntervalListList); - InsertSplitChildrenShardgroupMetadata(shardGroupSplitIntervalListList); /* Insert new shard and placement metdata */ @@ -1219,39 +1215,6 @@ UpdateDistributionColumnsForShardGroup(List *colocatedShardList, } -static void -PopulateShardgroupIdsWithNewIds(List *shardGroupSplitIntervalListList) -{ - List *firstShardIntervals = NULL; - List *currentShardIntervals = NULL; - foreach_ptr(currentShardIntervals, shardGroupSplitIntervalListList) - { - if (!firstShardIntervals) - { - /* on the first loop we assign new shardgroupId's */ - firstShardIntervals = currentShardIntervals; - ShardInterval *shardInterval = NULL; - foreach_ptr(shardInterval, firstShardIntervals) - { - ShardgroupID newShardgroupId = GetNextShardgroupId(); - shardInterval->shardgroupId = newShardgroupId; - } - } - else - { - /* on subsequent loops we assign the same shardgroupId for colocation */ - ShardInterval *firstShardInterval = NULL; - ShardInterval *currentShardInterval = NULL; - forboth_ptr(firstShardInterval, firstShardIntervals, currentShardInterval, - currentShardIntervals) - { - currentShardInterval->shardgroupId = firstShardInterval->shardgroupId; - } - } - } -} - - static void InsertSplitChildrenShardgroupMetadata(List *shardGroupSplitIntervalListList) {