From 886533f5076b97c0065b4f60c7a5393984e7fe31 Mon Sep 17 00:00:00 2001 From: Renato Costa Date: Thu, 15 Aug 2024 16:10:08 -0400 Subject: [PATCH] roachtest: multi-region/mixed-version support for shared-process We enable required features on tenants before setting up the TPCC workload on the cluster. Informs: #127378 Release note: None --- pkg/cmd/roachtest/tests/follower_reads.go | 21 +++++++++++++------ .../tests/mixed_version_multi_region.go | 7 +++++++ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/pkg/cmd/roachtest/tests/follower_reads.go b/pkg/cmd/roachtest/tests/follower_reads.go index 834b685d2341..61ddd9bace3f 100644 --- a/pkg/cmd/roachtest/tests/follower_reads.go +++ b/pkg/cmd/roachtest/tests/follower_reads.go @@ -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 } } @@ -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) +} diff --git a/pkg/cmd/roachtest/tests/mixed_version_multi_region.go b/pkg/cmd/roachtest/tests/mixed_version_multi_region.go index 445cfeede121..19f15043b6e7 100644 --- a/pkg/cmd/roachtest/tests/mixed_version_multi_region.go +++ b/pkg/cmd/roachtest/tests/mixed_version_multi_region.go @@ -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.