Skip to content

Commit 6da4010

Browse files
committed
roachtest: add mma-and-count versions of allocbench
Fixes #154638.
1 parent fb6caca commit 6da4010

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

pkg/cmd/roachtest/tests/allocation_bench.go

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const (
4444
type allocationBenchSpec struct {
4545
nodes, cpus int
4646
load allocBenchLoad
47+
lbrMode string // see kvserverbase.LoadBasedRebalancingMode
4748

4849
startRecord time.Duration
4950
samples int
@@ -172,7 +173,7 @@ func (r kvAllocBenchEventRunner) run(ctx context.Context, c cluster.Cluster, t t
172173
return c.RunE(ctx, option.WithNodes(c.WorkloadNode()), runCmd)
173174
}
174175
func registerAllocationBench(r registry.Registry) {
175-
for _, spec := range []allocationBenchSpec{
176+
specTemplates := []allocationBenchSpec{
176177
// TODO(kvoli): Add a background event runner and implement events for
177178
// import and index backfills.
178179
{
@@ -242,8 +243,19 @@ func registerAllocationBench(r registry.Registry) {
242243
},
243244
},
244245
},
245-
} {
246-
registerAllocationBenchSpec(r, spec)
246+
}
247+
for _, spec := range specTemplates {
248+
{
249+
spec := spec
250+
spec.lbrMode = "leases and replicas"
251+
registerAllocationBenchSpec(r, spec)
252+
}
253+
{
254+
spec := spec
255+
spec.lbrMode = "multi-metric and count"
256+
spec.load.desc += "/lbr=mmc"
257+
registerAllocationBenchSpec(r, spec)
258+
}
247259
}
248260
}
249261

@@ -273,11 +285,18 @@ func setupAllocationBench(
273285
t.Status("starting cluster")
274286
for i := 1; i <= spec.nodes; i++ {
275287
// Don't start a backup schedule as this test reports to roachperf.
288+
settings := install.MakeClusterSettings()
289+
settings.Env = append(settings.Env, "COCKROACH_ALLOW_MMA=true")
276290
startOpts := option.NewStartOpts(option.NoBackupSchedule)
277291
startOpts.RoachprodOpts.ExtraArgs = append(startOpts.RoachprodOpts.ExtraArgs,
278292
"--vmodule=store_rebalancer=2,allocator=2,replicate_queue=2")
279-
c.Start(ctx, t.L(), startOpts, install.MakeClusterSettings(), c.Node(i))
293+
c.Start(ctx, t.L(), startOpts, settings, c.Node(i))
280294
}
295+
require.NotEmpty(t, spec.lbrMode, "lbrMode must be set")
296+
_, err := c.Conn(ctx, t.L(), 1).ExecContext(ctx, fmt.Sprintf(
297+
`SET CLUSTER SETTING kv.allocator.load_based_rebalancing = '%s';`,
298+
spec.lbrMode))
299+
require.NoError(t, err)
281300

282301
return setupStatCollector(ctx, t, c, spec)
283302
}

0 commit comments

Comments
 (0)