Skip to content

Commit acb7431

Browse files
craig[bot]csgourav
andcommitted
Merge #143568
143568: workload: tpcc fix alter partition query for partitioned replication r=herkolategan a=csgourav Fixes partitioning query generated with no zone config and partition strategy as replication. Earlier we were specifying per rack replica placement information which is not required in partitionedReplication which caused the error. Example bad query - `ALTER PARTITION p0_0 OF TABLE warehouse CONFIGURE ZONE USING constraints = '{+rack=0: 1, +rack=1: 1, +rack=2: 1}` - error : `pq: could not validate zone config: when per-replica constraints are set, num_replicas must be set as well` Fix is to not add this per replica constraint for replication, reverting to the old way of alter partition query generation. Fixes: #143410 Epic: none Co-authored-by: Gourav Kumar <[email protected]>
2 parents e2e7260 + 10f4b45 commit acb7431

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pkg/workload/tpcc/partition.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,10 +395,14 @@ func configureZone(
395395
if len(cfg.zones) > 0 {
396396
constraint = fmt.Sprintf("[+zone=%s]", cfg.zones[partIdx])
397397
} else {
398-
// Note that this only specifies 3 replica locations. If the number of
399-
// replicas is >3 this will only specify the location for 3 of them.
400-
constraint = fmt.Sprintf(`{+rack=%d: 1, +rack=%d: 1, +rack=%d: 1}`, partIdx, (partIdx+totalParts/3)%totalParts, (partIdx+2*totalParts/3)%totalParts)
401-
lease = fmt.Sprintf("[[+rack=%d]]", partIdx)
398+
if cfg.strategy == partitionedLeases {
399+
// Note that this only specifies 3 replica locations. If the number of
400+
// replicas is >3 this will only specify the location for 3 of them.
401+
constraint = fmt.Sprintf(`{+rack=%d: 1, +rack=%d: 1, +rack=%d: 1}`, partIdx, (partIdx+totalParts/3)%totalParts, (partIdx+2*totalParts/3)%totalParts)
402+
lease = fmt.Sprintf("[[+rack=%d]]", partIdx)
403+
} else {
404+
constraint = fmt.Sprintf("[+rack=%d]", partIdx)
405+
}
402406
}
403407

404408
var opts string

0 commit comments

Comments
 (0)