From 358c0bb8a8315d42eaee7a841179aa68956e4c07 Mon Sep 17 00:00:00 2001 From: adityamaru Date: Mon, 9 Jan 2023 17:08:56 -0500 Subject: [PATCH] backupccl: add env variable to disable version checking This change adds an env variable that will be set by the job running restore roachtests until we have updated all their fixtures to be 22.2.0+. Release note: None --- pkg/ccl/backupccl/BUILD.bazel | 1 + pkg/ccl/backupccl/restore_planning.go | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/ccl/backupccl/BUILD.bazel b/pkg/ccl/backupccl/BUILD.bazel index f0a23fe04560..a26f08f36460 100644 --- a/pkg/ccl/backupccl/BUILD.bazel +++ b/pkg/ccl/backupccl/BUILD.bazel @@ -126,6 +126,7 @@ go_library( "//pkg/util/bulk", "//pkg/util/contextutil", "//pkg/util/ctxgroup", + "//pkg/util/envutil", "//pkg/util/hlc", "//pkg/util/interval", "//pkg/util/json", diff --git a/pkg/ccl/backupccl/restore_planning.go b/pkg/ccl/backupccl/restore_planning.go index bea19501facf..62075614441b 100644 --- a/pkg/ccl/backupccl/restore_planning.go +++ b/pkg/ccl/backupccl/restore_planning.go @@ -62,6 +62,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sqlerrors" "github.com/cockroachdb/cockroach/pkg/sql/sqlutil" "github.com/cockroachdb/cockroach/pkg/sql/syntheticprivilege" + "github.com/cockroachdb/cockroach/pkg/util/envutil" "github.com/cockroachdb/cockroach/pkg/util/hlc" "github.com/cockroachdb/cockroach/pkg/util/log" "github.com/cockroachdb/cockroach/pkg/util/tracing" @@ -1510,7 +1511,14 @@ func doRestorePlan( // version into a cluster that is on the same version or the next major // version. minimumRestorableVersion := p.ExecCfg().Settings.Version.BinaryMinSupportedVersion() - if !build.IsRelease() { + if !envutil.EnvOrDefaultBool("COCKROACH_ENFORCE_MIN_RESTOREABLE_VERSION", true) { + // Set the minimumRestoreableVersion to a version that will be less than any + // backup version rendering the check a no-op. + // + // TODO(adityamaru): Delete this block once all the restore roachtest + // fixtures have been updated to be 22.2.0+. + minimumRestorableVersion = roachpb.Version{Major: 1} + } else if !build.IsRelease() { minimumRestorableVersion, err = minimumRestorableVersion.VersionWithoutDevOffset() if err != nil { return err