Skip to content

Commit

Permalink
backupccl: add env variable to disable version checking
Browse files Browse the repository at this point in the history
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
  • Loading branch information
adityamaru committed Jan 10, 2023
1 parent 92c196d commit 358c0bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/ccl/backupccl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 9 additions & 1 deletion pkg/ccl/backupccl/restore_planning.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 358c0bb

Please sign in to comment.