Skip to content

Commit 24e1ef3

Browse files
craig[bot]Dev-Kyle
andcommitted
147225: roachtest: added buffered write/sender cluster setting mutators to mixedversion r=DarrylWong,srosenberg,herkolategan a=Dev-Kyle Previously `kv.rangefeed.buffered_sender.enabled` and `kv.transaction.write_buffering.enabled` were disabled in mixedversion - this patch allows the mixedversion tests to enable these settings on supported version. Informs: cockroachdb#146415 Fixes: cockroachdb#147009 Release note: None TeamCity: https://teamcity.cockroachdb.com/buildConfiguration/Cockroach_Nightlies_RoachtestNightlyGceBazel?buildTypeTab=overview&branch=147225 Co-authored-by: Kyle <kyle.li@cockroachlabs.com>
2 parents fbdecfc + 78be1c3 commit 24e1ef3

File tree

5 files changed

+87
-15
lines changed

5 files changed

+87
-15
lines changed

pkg/cmd/roachtest/roachtestutil/mixedversion/mixedversion.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,28 @@ func DisableMutators(names ...string) CustomOption {
521521
}
522522
}
523523

524+
// DisableAllMutators will disable all available mutators.
525+
func DisableAllMutators() CustomOption {
526+
return func(opts *testOptions) {
527+
names := []string{}
528+
for _, m := range planMutators {
529+
names = append(names, m.Name())
530+
}
531+
DisableMutators(names...)(opts)
532+
}
533+
}
534+
535+
// DisableAllClusterSettingMutators will disable all available cluster setting mutators.
536+
func DisableAllClusterSettingMutators() CustomOption {
537+
return func(opts *testOptions) {
538+
names := []string{}
539+
for _, m := range clusterSettingMutators {
540+
names = append(names, m.Name())
541+
}
542+
DisableMutators(names...)(opts)
543+
}
544+
}
545+
524546
// WithTag allows callers give the mixedversion test instance a
525547
// `tag`. The tag is used as prefix in the log messages emitted by
526548
// this upgrade test. This is only useful when running multiple

pkg/cmd/roachtest/roachtestutil/mixedversion/planner.go

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,9 @@ const (
211211
spanConfigTenantLimit = 50000
212212
)
213213

214-
// planMutators includes a list of all known `mutator`
215-
// implementations. A subset of these mutations might be enabled in
216-
// any mixedversion test plan.
217-
var planMutators = []mutator{
218-
preserveDowngradeOptionRandomizerMutator{},
214+
// clusterSettingMutators includes a list of all
215+
// cluster setting mutator implementations.
216+
var clusterSettingMutators = []mutator{
219217
newClusterSettingMutator(
220218
"kv.expiration_leases_only.enabled",
221219
[]bool{true, false},
@@ -231,8 +229,33 @@ var planMutators = []mutator{
231229
[]string{"snappy", "zstd"},
232230
clusterSettingMinimumVersion("v24.1.0-alpha.0"),
233231
),
232+
// These two settings are newly introduced, so their probabilities
233+
// are temporarily raised to increase testing on them specifically.
234+
// The 50% matches the metamorphic probability of these settings
235+
// being enabled in non mixed version tests.
236+
newClusterSettingMutator(
237+
"kv.transaction.write_buffering.enabled",
238+
[]bool{true, false},
239+
clusterSettingMinimumVersion("v25.2.0"),
240+
clusterSettingProbability(0.5),
241+
),
242+
newClusterSettingMutator(
243+
"kv.rangefeed.buffered_sender.enabled",
244+
[]bool{true, false},
245+
clusterSettingMinimumVersion("v25.2.0"),
246+
clusterSettingProbability(0.5),
247+
),
234248
}
235249

250+
// planMutators includes a list of all known `mutator`
251+
// implementations. A subset of these mutations might be enabled in
252+
// any mixedversion test plan.
253+
var planMutators = append([]mutator{
254+
preserveDowngradeOptionRandomizerMutator{},
255+
},
256+
clusterSettingMutators...,
257+
)
258+
236259
// Plan returns the TestPlan used to upgrade the cluster from the
237260
// first to the final version in the `versions` field. The test plan
238261
// roughly translates to the sequence of steps below, annotated with

pkg/cmd/roachtest/roachtestutil/mixedversion/planner_test.go

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"github.com/cockroachdb/cockroach/pkg/roachprod/logger"
2121
"github.com/cockroachdb/cockroach/pkg/roachprod/vm"
2222
"github.com/cockroachdb/cockroach/pkg/testutils/datapathutils"
23+
"github.com/cockroachdb/cockroach/pkg/util/randutil"
2324
"github.com/cockroachdb/cockroach/pkg/util/retry"
2425
"github.com/cockroachdb/datadriven"
2526
"github.com/cockroachdb/version"
@@ -326,10 +327,10 @@ func Test_maxNumPlanSteps(t *testing.T) {
326327

327328
// There is in fact no "basic upgrade" test plan with fewer than 13 steps.
328329
// The smallest plan is,
329-
//planner_test.go:314: Seed: 12345
330-
//Upgrades: v24.1.1 → <current>
330+
// planner_test.go:314: Seed: 12345
331+
// Upgrades: v24.1.1 → <current>
331332
// Deployment mode: system-only
332-
//Plan:
333+
// Plan:
333334
// ├── start cluster at version "v24.1.1" (1)
334335
// ├── wait for all nodes (:1-4) to acknowledge cluster version '24.1' on system tenant (2)
335336
// └── upgrade cluster from "v24.1.1" to "<current>"
@@ -893,6 +894,36 @@ func dummyHook(context.Context, *logger.Logger, *rand.Rand, *Helper) error {
893894
return nil
894895
}
895896

897+
func Test_DisableAllMutators(t *testing.T) {
898+
mvt := newTest(DisableAllMutators())
899+
900+
rng, seed := randutil.NewTestRand()
901+
mvt.seed = seed
902+
mvt.prng = rng
903+
904+
plan, err := mvt.plan()
905+
require.NoError(t, err)
906+
require.Nil(t, plan.enabledMutators)
907+
908+
}
909+
910+
func Test_DisableAllClusterSettingMutators(t *testing.T) {
911+
mvt := newTest(DisableAllClusterSettingMutators())
912+
913+
rng, seed := randutil.NewTestRand()
914+
mvt.seed = seed
915+
mvt.prng = rng
916+
917+
plan, err := mvt.plan()
918+
require.NoError(t, err)
919+
920+
for _, enabled := range plan.enabledMutators {
921+
if _, ok := enabled.(clusterSettingMutator); ok {
922+
t.Errorf("cluster setting mutator %q was not disabled", enabled.Name())
923+
}
924+
}
925+
}
926+
896927
// This is a regression test to ensure that separate process deployments
897928
// correctly default to using latest predecessors.
898929
func Test_SeparateProcessUsesLatestPred(t *testing.T) {

pkg/cmd/roachtest/test_runner.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -940,8 +940,8 @@ func (r *testRunner) runWorker(
940940
// 50% change of enabling buffered writes.
941941
//
942942
// Disabled by default. Disabled for mixed-version tests
943-
// since these cluster settings are not supported in all
944-
// versions.
943+
// because they use a separate mechanism for metamorphic
944+
// cluster settings.
945945
for _, tc := range []struct {
946946
setting string
947947
label string

pkg/cmd/roachtest/tests/mixed_version_backup.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2821,11 +2821,7 @@ func registerBackupMixedVersion(r registry.Registry) {
28212821
// TODO(renato): don't disable these mutators when the
28222822
// framework exposes some utility to provide mutual exclusion
28232823
// of concurrent steps.
2824-
mixedversion.DisableMutators(
2825-
mixedversion.ClusterSettingMutator("kv.expiration_leases_only.enabled"),
2826-
mixedversion.ClusterSettingMutator("storage.ingest_split.enabled"),
2827-
mixedversion.ClusterSettingMutator("storage.sstable.compression_algorithm"),
2828-
),
2824+
mixedversion.DisableAllClusterSettingMutators(),
28292825
)
28302826
testRNG := mvt.RNG()
28312827

0 commit comments

Comments
 (0)