Fix assert failure introduced in 245a62df3e

The assert on the number of shards incorrectly used the value of
citus.shard_replication_factor; it should check the table's metadata
to determine the replication factor of its data, and not assume it is
the current GUC value.
pull/8075/head
Colm 2025-07-24 14:19:39 +01:00 committed by GitHub
parent 9327df8446
commit f1160b0892
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 8 deletions

View File

@ -2060,14 +2060,6 @@ CheckAndBuildDelayedFastPathPlan(DistributedPlanningContext *planContext,
Task *task = (Task *) linitial(tasks);
List *placements = task->taskPlacementList;
int32 localGroupId = GetLocalGroupId();
/*
* Today FastPathRouterQuery() doesn't set delayFastPathPlanning to true for
* reference tables. We should be looking at 1 placement, or ShardReplicationFactor
* of them.
*/
Assert(list_length(placements) == 1 || list_length(placements) ==
ShardReplicationFactor);
ShardPlacement *primaryPlacement = (ShardPlacement *) linitial(placements);
bool isLocalExecution = !IsDummyPlacement(primaryPlacement) &&
@ -2081,6 +2073,14 @@ CheckAndBuildDelayedFastPathPlan(DistributedPlanningContext *planContext,
RelationShard *relationShard = (RelationShard *) linitial(relationShards);
Assert(relationShard->shardId == primaryPlacement->shardId);
/*
* Today FastPathRouterQuery() doesn't set delayFastPathPlanning to true for
* reference tables. We should be looking at 1 placement, or their replication
* factor.
*/
Assert(list_length(placements) == 1 || list_length(placements) ==
TableShardReplicationFactor(relationShard->relationId));
canBuildLocalPlan = ConvertToQueryOnShard(planContext->query,
relationShard->relationId,
relationShard->shardId);