Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
129085: roachtest: multi-region/mixed-version support for shared-process r=srosenberg,herkolategan a=renatolabs

We enable required features on tenants before setting up the TPCC workload on the cluster.

Informs: cockroachdb#127378

Release note: None

Co-authored-by: Renato Costa <[email protected]>
  • Loading branch information
craig[bot] and renatolabs committed Aug 20, 2024
2 parents 7379814 + 886533f commit 8296213
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
21 changes: 15 additions & 6 deletions pkg/cmd/roachtest/tests/follower_reads.go
Original file line number Diff line number Diff line change
Expand Up @@ -1017,12 +1017,9 @@ func runFollowerReadsMixedVersionTest(

var data map[int]int64
runInit := func(ctx context.Context, l *logger.Logger, r *rand.Rand, h *mixedversion.Helper) error {
if topology.multiRegion &&
h.IsMultitenant() &&
!h.Context().FromVersion.AtLeast(mixedversion.TenantsAndSystemAlignedSettingsVersion) {
const setting = "sql.multi_region.allow_abstractions_for_secondary_tenants.enabled"
if err := setTenantSetting(l, r, h, setting, true); err != nil {
return errors.Wrapf(err, "setting %s", setting)
if topology.multiRegion {
if err := enableTenantMultiRegion(l, r, h); err != nil {
return err
}
}

Expand All @@ -1040,3 +1037,15 @@ func runFollowerReadsMixedVersionTest(
mvt.AfterUpgradeFinalized("run follower reads", runFollowerReads)
mvt.Run()
}

// enableTenantMultiRegion enables multi-region features on the
// mixedversion tenant if necessary (no-op otherwise).
func enableTenantMultiRegion(l *logger.Logger, r *rand.Rand, h *mixedversion.Helper) error {
if !h.IsMultitenant() || h.Context().FromVersion.AtLeast(mixedversion.TenantsAndSystemAlignedSettingsVersion) {
return nil
}

const setting = "sql.multi_region.allow_abstractions_for_secondary_tenants.enabled"
err := setTenantSetting(l, r, h, setting, true)
return errors.Wrapf(err, "setting %s", setting)
}
7 changes: 7 additions & 0 deletions pkg/cmd/roachtest/tests/mixed_version_multi_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ func registerMultiRegionMixedVersion(r registry.Registry) {
mvt.OnStartup(
"setup tpcc",
func(ctx context.Context, l *logger.Logger, rng *rand.Rand, h *mixedversion.Helper) error {
if err := enableTenantSplitScatter(l, rng, h); err != nil {
return err
}
if err := enableTenantMultiRegion(l, rng, h); err != nil {
return err
}

setupTPCC(ctx, t, l, c, backgroundTPCCOpts)
// Update the `SetupType` so that the corresponding
// `runTPCC` calls don't attempt to import data again.
Expand Down

0 comments on commit 8296213

Please sign in to comment.