Skip to content

Commit 9ec1266

Browse files
tbgroachdev-claude
andcommitted
roachtest: add --scatter option to kv workload init for perturbation tests
The kv workload's `init` subcommand supports a --scatter flag that scatters the table immediately after splitting; this gives the allocator a chance to spread leaseholders across the cluster while queues are idle, instead of leaving every split's children with the parent's leaseholder. Add an opt-in v.scatter field that initWorkload passes through. Off by default so existing tests are unaffected. Epic: none Release note: None Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
1 parent 5f6f380 commit 9ec1266

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

pkg/cmd/roachtest/tests/perturbation/framework.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ type variations struct {
8686
validationDuration time.Duration
8787
ratioOfMax float64
8888
splits int
89+
scatter bool // pass --scatter when initializing the workload table
8990
timeout time.Duration
9091
numNodes int
9192
numWorkloadNodes int

pkg/cmd/roachtest/tests/perturbation/kv_workload.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ func (w kvWorkload) operations() []string {
2424
}
2525

2626
func (w kvWorkload) initWorkload(ctx context.Context, v variations) error {
27-
initCmd := fmt.Sprintf("./cockroach workload init kv --db target --splits %d {pgurl:1}", v.splits)
27+
scatterFlag := ""
28+
if v.scatter {
29+
scatterFlag = " --scatter"
30+
}
31+
initCmd := fmt.Sprintf("./cockroach workload init kv --db target --splits %d%s {pgurl:1}",
32+
v.splits, scatterFlag)
2833
return v.RunE(ctx, option.WithNodes(v.Node(1)), initCmd)
2934
}
3035

0 commit comments

Comments
 (0)