Skip to content

Commit

Permalink
Merge #113727
Browse files Browse the repository at this point in the history
113727: clusterversion: rename latest/min supported versions in Handle r=RaduBerinde a=RaduBerinde

Rename "binary version" to "latest version" and "binary min supported
version" to "min supported version" in `clusterversion.Handle` and
associated code.

This change is mechanical and is not intended to have any functional changes.

Informs: #112629
Release note: None

Co-authored-by: Radu Berinde <[email protected]>
  • Loading branch information
craig[bot] and RaduBerinde committed Nov 3, 2023
2 parents f6d6a9d + 82d5721 commit 60aab2a
Show file tree
Hide file tree
Showing 36 changed files with 218 additions and 221 deletions.
2 changes: 1 addition & 1 deletion docs/tech-notes/version_upgrades.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ the specific fields should not be considered too much. They do
not relate directly to the executable version!

Instead, each `cockroach` executable has a range of supported
cluster versions (in the code: `minBinaryVersion` ... `binaryVersion`).
cluster versions (in the code: `minSupportedVersion` ... `latestVersion`).
If a `cockroach` command observes a cluster version earlier than its
minimum supported version, or later than its maximum supported
version, it terminates.
Expand Down
6 changes: 3 additions & 3 deletions pkg/ccl/backupccl/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8455,7 +8455,7 @@ func TestRestoringAcrossVersions(t *testing.T) {
// Bump the version down to outside our MinBinarySupportedVersion, and write
// it back out. This makes it ineligible for restore because of our restore
// version policy.
minSupportedVersion := tc.ApplicationLayer(0).ClusterSettings().Version.BinaryMinSupportedVersion()
minSupportedVersion := tc.ApplicationLayer(0).ClusterSettings().Version.MinSupportedVersion()
minSupportedVersion.Major -= 1
setManifestClusterVersion(minSupportedVersion)

Expand All @@ -8469,8 +8469,8 @@ func TestRestoringAcrossVersions(t *testing.T) {
// Bump the version down to the min supported binary version, and write it
// back out. This makes it eligible for restore because of our restore
// version policy.
minBinaryVersion := tc.ApplicationLayer(0).ClusterSettings().Version.BinaryMinSupportedVersion()
setManifestClusterVersion(minBinaryVersion)
minSupportedVersion := tc.ApplicationLayer(0).ClusterSettings().Version.MinSupportedVersion()
setManifestClusterVersion(minSupportedVersion)
sqlDB.Exec(t, `RESTORE DATABASE r1 FROM 'nodelocal://1/cross_version'`)
sqlDB.Exec(t, `DROP DATABASE r1`)
})
Expand Down
6 changes: 3 additions & 3 deletions pkg/ccl/backupccl/restore_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -1937,10 +1937,10 @@ func (r *restoreResumer) validateJobIsResumable(execConfig *sql.ExecutorConfig)
// the CreationClusterVersion may still be equal to binaryVersion,
// which means the cluster restore will proceed.
creationClusterVersion := r.job.Payload().CreationClusterVersion
binaryVersion := execConfig.Settings.Version.BinaryVersion()
latestVersion := execConfig.Settings.Version.LatestVersion()
isClusterRestore := details.DescriptorCoverage == tree.AllDescriptors
if isClusterRestore && creationClusterVersion.Less(binaryVersion) {
return clusterRestoreDuringUpgradeErr(creationClusterVersion, binaryVersion)
if isClusterRestore && creationClusterVersion.Less(latestVersion) {
return clusterRestoreDuringUpgradeErr(creationClusterVersion, latestVersion)
}
return nil
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/ccl/backupccl/restore_mid_schema_change_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@ func restoreMidSchemaChange(
// option to ensure the restore is successful on development branches. This
// is because, while the backups were generated on release branches and have
// versions such as 22.2 in their manifest, the development branch will have
// a BinaryMinSupportedVersion offset by the clusterversion.DevOffset
// described in `pkg/clusterversion/cockroach_versions.go`. This will mean
// that the manifest version is always less than the
// BinaryMinSupportedVersion which will in turn fail the restore unless we
// pass in the specified option to elide the compatability check.
// a MinSupportedVersion offset by the clusterversion.DevOffset described in
// `pkg/clusterversion/cockroach_versions.go`. This will mean that the
// manifest version is always less than the MinSupportedVersion which will
// in turn fail the restore unless we pass in the specified option to elide
// the compatibility check.
restoreQuery := "RESTORE defaultdb.* FROM LATEST IN $1 WITH UNSAFE_RESTORE_INCOMPATIBLE_VERSION"
if isClusterRestore {
restoreQuery = "RESTORE FROM LATEST IN $1 WITH UNSAFE_RESTORE_INCOMPATIBLE_VERSION"
Expand Down
10 changes: 5 additions & 5 deletions pkg/ccl/backupccl/restore_old_sequences_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ func restoreOldSequencesTest(exportDir string, isSchemaOnly bool) func(t *testin
// option to ensure the restore is successful on development branches. This
// is because, while the backups were generated on release branches and have
// versions such as 22.2 in their manifest, the development branch will have
// a BinaryMinSupportedVersion offset by the clusterversion.DevOffset
// described in `pkg/clusterversion/cockroach_versions.go`. This will mean
// that the manifest version is always less than the
// BinaryMinSupportedVersion which will in turn fail the restore unless we
// pass in the specified option to elide the compatability check.
// a MinSupportedVersion offset by the clusterversion.DevOffset described in
// `pkg/clusterversion/cockroach_versions.go`. This will mean that the
// manifest version is always less than the MinSupportedVersion which will
// in turn fail the restore unless we pass in the specified option to elide
// the compatibility check.
restoreQuery := `RESTORE test.* FROM LATEST IN $1 WITH UNSAFE_RESTORE_INCOMPATIBLE_VERSION`
if isSchemaOnly {
restoreQuery = restoreQuery + ", schema_only"
Expand Down
50 changes: 25 additions & 25 deletions pkg/ccl/backupccl/restore_old_versions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,11 @@ func restoreOldVersionClusterTest(exportDir string) func(t *testing.T) {
// option to ensure the restore is successful on development branches. This
// is because, while the backups were generated on release branches and have
// versions such as 22.2 in their manifest, the development branch will have
// a BinaryMinSupportedVersion offset by the clusterversion.DevOffset
// described in `pkg/clusterversion/cockroach_versions.go`. This will mean
// that the manifest version is always less than the
// BinaryMinSupportedVersion which will in turn fail the restore unless we
// pass in the specified option to elide the compatability check.
// a MinSupportedVersion offset by the clusterversion.DevOffset described in
// `pkg/clusterversion/cockroach_versions.go`. This will mean that the
// manifest version is always less than the MinSupportedVersion which will
// in turn fail the restore unless we pass in the specified option to elide
// the compatibility check.
sqlDB.Exec(t, `RESTORE FROM LATEST IN $1 WITH UNSAFE_RESTORE_INCOMPATIBLE_VERSION`, localFoo)

sqlDB.CheckQueryResults(t, "SHOW DATABASES", [][]string{
Expand Down Expand Up @@ -332,11 +332,11 @@ func fullClusterRestoreSystemRoleMembersWithoutIDs(exportDir string) func(t *tes
// option to ensure the restore is successful on development branches. This
// is because, while the backups were generated on release branches and have
// versions such as 22.2 in their manifest, the development branch will have
// a BinaryMinSupportedVersion offset by the clusterversion.DevOffset
// described in `pkg/clusterversion/cockroach_versions.go`. This will mean
// that the manifest version is always less than the
// BinaryMinSupportedVersion which will in turn fail the restore unless we
// pass in the specified option to elide the compatability check.
// a MinSupportedVersion offset by the clusterversion.DevOffset described in
// `pkg/clusterversion/cockroach_versions.go`. This will mean that the
// manifest version is always less than the MinSupportedVersion which will
// in turn fail the restore unless we pass in the specified option to elide
// the compatibility check.
sqlDB.Exec(t, fmt.Sprintf("RESTORE FROM '%s' WITH UNSAFE_RESTORE_INCOMPATIBLE_VERSION", localFoo))

sqlDB.CheckQueryResults(t, "SELECT * FROM system.role_members", [][]string{
Expand Down Expand Up @@ -367,11 +367,11 @@ func fullClusterRestoreSystemPrivilegesWithoutIDs(exportDir string) func(t *test
// option to ensure the restore is successful on development branches. This
// is because, while the backups were generated on release branches and have
// versions such as 22.2 in their manifest, the development branch will have
// a BinaryMinSupportedVersion offset by the clusterversion.DevOffset
// described in `pkg/clusterversion/cockroach_versions.go`. This will mean
// that the manifest version is always less than the
// BinaryMinSupportedVersion which will in turn fail the restore unless we
// pass in the specified option to elide the compatability check.
// a MinSupportedVersion offset by the clusterversion.DevOffset described in
// `pkg/clusterversion/cockroach_versions.go`. This will mean that the
// manifest version is always less than the MinSupportedVersion which will
// in turn fail the restore unless we pass in the specified option to elide
// the compatibility check.
sqlDB.Exec(t, fmt.Sprintf("RESTORE FROM '%s' WITH UNSAFE_RESTORE_INCOMPATIBLE_VERSION", localFoo))

sqlDB.CheckQueryResults(t, "SELECT * FROM system.privileges", [][]string{
Expand Down Expand Up @@ -402,11 +402,11 @@ func fullClusterRestoreSystemDatabaseRoleSettingsWithoutIDs(exportDir string) fu
// option to ensure the restore is successful on development branches. This
// is because, while the backups were generated on release branches and have
// versions such as 22.2 in their manifest, the development branch will have
// a BinaryMinSupportedVersion offset by the clusterversion.DevOffset
// described in `pkg/clusterversion/cockroach_versions.go`. This will mean
// that the manifest version is always less than the
// BinaryMinSupportedVersion which will in turn fail the restore unless we
// pass in the specified option to elide the compatability check.
// a MinSupportedVersion offset by the clusterversion.DevOffset described in
// `pkg/clusterversion/cockroach_versions.go`. This will mean that the
// manifest version is always less than the MinSupportedVersion which will
// in turn fail the restore unless we pass in the specified option to elide
// the compatibility check.
sqlDB.Exec(t, fmt.Sprintf("RESTORE FROM '%s' WITH UNSAFE_RESTORE_INCOMPATIBLE_VERSION", localFoo))

sqlDB.CheckQueryResults(t, "SELECT * FROM system.database_role_settings", [][]string{
Expand Down Expand Up @@ -437,11 +437,11 @@ func fullClusterRestoreSystemExternalConnectionsWithoutIDs(exportDir string) fun
// option to ensure the restore is successful on development branches. This
// is because, while the backups were generated on release branches and have
// versions such as 22.2 in their manifest, the development branch will have
// a BinaryMinSupportedVersion offset by the clusterversion.DevOffset
// described in `pkg/clusterversion/cockroach_versions.go`. This will mean
// that the manifest version is always less than the
// BinaryMinSupportedVersion which will in turn fail the restore unless we
// pass in the specified option to elide the compatability check.
// a MinSupportedVersion offset by the clusterversion.DevOffset described in
// `pkg/clusterversion/cockroach_versions.go`. This will mean that the
// manifest version is always less than the MinSupportedVersion which will
// in turn fail the restore unless we pass in the specified option to elide
// the compatibility check.
sqlDB.Exec(t, fmt.Sprintf("RESTORE FROM '%s' WITH UNSAFE_RESTORE_INCOMPATIBLE_VERSION", localFoo))

sqlDB.CheckQueryResults(t, "SELECT * FROM system.external_connections", [][]string{
Expand Down
8 changes: 4 additions & 4 deletions pkg/ccl/backupccl/restore_planning.go
Original file line number Diff line number Diff line change
Expand Up @@ -1646,7 +1646,7 @@ func checkBackupManifestVersionCompatability(

// We support restoring a backup that was taken on a cluster with a cluster
// version >= the earliest binary version that we can interoperate with.
minimumRestoreableVersion := version.BinaryMinSupportedVersion()
minimumRestoreableVersion := version.MinSupportedVersion()
currentActiveVersion := version.ActiveVersion(ctx)

for i := range mainBackupManifests {
Expand Down Expand Up @@ -1869,10 +1869,10 @@ func doRestorePlan(
// Validate that we aren't in the middle of an upgrade. To avoid unforseen
// issues, we want to avoid full cluster restores if it is possible that an
// upgrade is in progress. We also check this during Resume.
binaryVersion := p.ExecCfg().Settings.Version.BinaryVersion()
latestVersion := p.ExecCfg().Settings.Version.LatestVersion()
clusterVersion := p.ExecCfg().Settings.Version.ActiveVersion(ctx).Version
if clusterVersion.Less(binaryVersion) {
return clusterRestoreDuringUpgradeErr(clusterVersion, binaryVersion)
if clusterVersion.Less(latestVersion) {
return clusterRestoreDuringUpgradeErr(clusterVersion, latestVersion)
}
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/ccl/kvccl/kvtenantccl/upgradeccl/tenant_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,9 @@ func TestTenantUpgrade(t *testing.T) {
v1,
false, // initializeVersion
)
// Initialize the version to the BinaryMinSupportedVersion.
// Initialize the version to the MinSupportedVersion.
require.NoError(t, clusterversion.Initialize(ctx,
clusterversion.TestingBinaryMinSupportedVersion, &settings.SV))
clusterversion.MinSupported.Version(), &settings.SV))

t.Log("starting server")
ts := serverutils.StartServerOnly(t, base.TestServerArgs{
Expand Down Expand Up @@ -429,7 +429,7 @@ func TestTenantUpgradeFailure(t *testing.T) {
v0,
false, // initializeVersion
)
// Initialize the version to the BinaryMinSupportedVersion.
// Initialize the version to the MinSupportedVersion.
ts := serverutils.StartServerOnly(t, base.TestServerArgs{
DefaultTestTenant: base.TestControlsTenantsExplicitly,
Settings: settings,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ func runTest(t *testing.T, variant sharedtestutil.TestVariant, test sharedtestut
slinstance.DefaultHeartBeat.Override(ctx, &s.SV, heartbeatOverride)
}

// Initialize the version to the BinaryMinSupportedVersion so that
// we can perform upgrades.
// Initialize the version to the MinSupportedVersion so that we can perform
// upgrades.
settings := cluster.MakeTestingClusterSettingsWithVersions(bv, msv, false /* initializeVersion */)
disableBackgroundTasks(settings)
require.NoError(t, clusterversion.Initialize(ctx, msv, &settings.SV))
Expand Down
Loading

0 comments on commit 60aab2a

Please sign in to comment.