Skip to content

Commit

Permalink
clusterversion: remove TODOPreV22_1
Browse files Browse the repository at this point in the history
This change removes this constant and the obsolete code that uses it.

Release note: None
Epic: none
  • Loading branch information
RaduBerinde committed Feb 7, 2023
1 parent eb15802 commit 16878ed
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 45 deletions.
1 change: 0 additions & 1 deletion pkg/ccl/changefeedccl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ go_test(
"//pkg/ccl/utilccl",
"//pkg/cloud",
"//pkg/cloud/impl:cloudimpl",
"//pkg/clusterversion",
"//pkg/gossip",
"//pkg/internal/sqlsmith",
"//pkg/jobs",
Expand Down
5 changes: 0 additions & 5 deletions pkg/ccl/changefeedccl/changefeed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import (
_ "github.com/cockroachdb/cockroach/pkg/ccl/partitionccl"
"github.com/cockroachdb/cockroach/pkg/ccl/utilccl"
_ "github.com/cockroachdb/cockroach/pkg/cloud/impl" // registers cloud storage providers
"github.com/cockroachdb/cockroach/pkg/clusterversion"
"github.com/cockroachdb/cockroach/pkg/internal/sqlsmith"
"github.com/cockroachdb/cockroach/pkg/jobs"
"github.com/cockroachdb/cockroach/pkg/jobs/jobspb"
Expand Down Expand Up @@ -297,10 +296,6 @@ func TestChangefeedIdleness(t *testing.T) {
changefeedbase.IdleTimeout.Override(
context.Background(), &s.Server.ClusterSettings().SV, 3*time.Second)

// Idleness functionality is version gated
knobs := s.TestingKnobs.Server.(*server.TestingKnobs)
knobs.BinaryVersionOverride = clusterversion.ByKey(clusterversion.TODOPreV22_1)

registry := s.Server.JobRegistry().(*jobs.Registry)
currentlyIdle := registry.MetricsStruct().JobMetrics[jobspb.TypeChangefeed].CurrentlyIdle
waitForIdleCount := func(numIdle int64) {
Expand Down
4 changes: 0 additions & 4 deletions pkg/clusterversion/cockroach_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,6 @@ func (k Key) String() string {
return ByKey(k).String()
}

// TODOPreV22_1 is an alias for V22_1 for use in any version gate/check that
// previously referenced a < 22.1 version until that check/gate can be removed.
const TODOPreV22_1 = V22_1

// Offset every version +1M major versions into the future if this is a dev branch.
const DevOffset = 1000000

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ USE parent;
CREATE DATABASE pgdatabase;
USE test;

statement error pq: cannot perform ALTER DATABASE CONVERT TO SCHEMA in version
statement error pq: cannot perform ALTER DATABASE CONVERT TO SCHEMA
ALTER DATABASE parent CONVERT TO SCHEMA WITH PARENT pgdatabase
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ statement error pq: feature ALTER DATABASE is part of the schema change category
ALTER DATABASE d RENAME TO r

# Test REPARENT DATABASE
statement error pq: cannot perform ALTER DATABASE CONVERT TO SCHEMA in version
statement error pq: cannot perform ALTER DATABASE CONVERT TO SCHEMA
ALTER DATABASE d CONVERT TO SCHEMA WITH PARENT test

# Test ALTER TABLE PARTITION BY.
Expand Down
5 changes: 1 addition & 4 deletions pkg/sql/reparent_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ package sql
import (
"context"

"github.com/cockroachdb/cockroach/pkg/clusterversion"
"github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgcode"
"github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgerror"
"github.com/cockroachdb/cockroach/pkg/sql/sem/tree"
Expand All @@ -22,7 +21,5 @@ import (
func (p *planner) ReparentDatabase(
ctx context.Context, n *tree.ReparentDatabase,
) (planNode, error) {
return nil, pgerror.Newf(pgcode.FeatureNotSupported,
"cannot perform ALTER DATABASE CONVERT TO SCHEMA in version %v and beyond",
clusterversion.TODOPreV22_1)
return nil, pgerror.Newf(pgcode.FeatureNotSupported, "cannot perform ALTER DATABASE CONVERT TO SCHEMA")
}
1 change: 0 additions & 1 deletion pkg/sql/syntheticprivilege/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ go_library(
importpath = "github.com/cockroachdb/cockroach/pkg/sql/syntheticprivilege",
visibility = ["//visibility:public"],
deps = [
"//pkg/clusterversion",
"//pkg/security/username",
"//pkg/sql/catalog/catpb",
"//pkg/sql/catalog/descpb",
Expand Down
6 changes: 0 additions & 6 deletions pkg/sql/syntheticprivilege/global_privilege.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
package syntheticprivilege

import (
"github.com/cockroachdb/cockroach/pkg/clusterversion"
"github.com/cockroachdb/cockroach/pkg/sql/catalog/catpb"
"github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb"
"github.com/cockroachdb/cockroach/pkg/sql/opt/cat"
Expand All @@ -37,11 +36,6 @@ func (p *GlobalPrivilege) GetPath() string {
return "/global/"
}

// SystemPrivilegesTableVersionGate implements the Object interface.
func (p *GlobalPrivilege) SystemPrivilegesTableVersionGate() clusterversion.Key {
return clusterversion.TODOPreV22_1
}

// GlobalPrivilegeObject is one of one since it is global.
// We can use a const to identify it.
var GlobalPrivilegeObject = &GlobalPrivilege{}
Expand Down
9 changes: 4 additions & 5 deletions pkg/storage/min_version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,11 @@ func TestSetMinVersion(t *testing.T) {
defer p.Close()
require.Equal(t, pebble.FormatMostCompatible, p.db.FormatMajorVersion())

// Advancing the store cluster version to TODOPreV22_1
// should also advance the store's format major version.
err = p.SetMinVersion(clusterversion.ByKey(clusterversion.TODOPreV22_1))
// Advancing the store cluster version to V22_2 should also advance the
// store's format major version.
err = p.SetMinVersion(clusterversion.ByKey(clusterversion.V22_2))
require.NoError(t, err)
require.Equal(t, pebble.FormatSplitUserKeysMarked, p.db.FormatMajorVersion())

require.Equal(t, pebble.FormatPrePebblev1Marked, p.db.FormatMajorVersion())
}

func TestMinVersion_IsNotEncrypted(t *testing.T) {
Expand Down
30 changes: 13 additions & 17 deletions pkg/storage/pebble.go
Original file line number Diff line number Diff line change
Expand Up @@ -1964,30 +1964,26 @@ func (p *Pebble) SetMinVersion(version roachpb.Version) error {
// at a version X+1, it is guaranteed that all nodes have already ratcheted
// their store version to the version X that enabled the feature at the Pebble
// level.
formatVers := pebble.FormatMostCompatible
var formatVers pebble.FormatMajorVersion
// Cases are ordered from newer to older versions.
switch {
case !version.Less(clusterversion.ByKey(clusterversion.V23_1EnsurePebbleFormatSSTableValueBlocks)):
if formatVers < pebble.FormatSSTableValueBlocks {
formatVers = pebble.FormatSSTableValueBlocks
}
formatVers = pebble.FormatSSTableValueBlocks

case !version.Less(clusterversion.ByKey(clusterversion.V22_2PebbleFormatPrePebblev1Marked)):
if formatVers < pebble.FormatPrePebblev1Marked {
formatVers = pebble.FormatPrePebblev1Marked
}
formatVers = pebble.FormatPrePebblev1Marked

case !version.Less(clusterversion.ByKey(clusterversion.V22_2EnsurePebbleFormatVersionRangeKeys)):
if formatVers < pebble.FormatRangeKeys {
formatVers = pebble.FormatRangeKeys
}
formatVers = pebble.FormatRangeKeys

case !version.Less(clusterversion.ByKey(clusterversion.V22_2PebbleFormatSplitUserKeysMarkedCompacted)):
if formatVers < pebble.FormatSplitUserKeysMarkedCompacted {
formatVers = pebble.FormatSplitUserKeysMarkedCompacted
}
case !version.Less(clusterversion.ByKey(clusterversion.TODOPreV22_1)):
if formatVers < pebble.FormatSplitUserKeysMarked {
formatVers = pebble.FormatSplitUserKeysMarked
}
formatVers = pebble.FormatSplitUserKeysMarkedCompacted

default:
// Corresponds to V22_1.
formatVers = pebble.FormatSplitUserKeysMarked
}

if p.db.FormatMajorVersion() < formatVers {
if err := p.db.RatchetFormatMajorVersion(formatVers); err != nil {
return errors.Wrap(err, "ratcheting format major version")
Expand Down

0 comments on commit 16878ed

Please sign in to comment.