From 70e681395674a31e889555a896941e57b6a6078f Mon Sep 17 00:00:00 2001 From: richardjcai Date: Tue, 16 Aug 2022 12:14:06 -0400 Subject: [PATCH] sql: remove super regions version and gates Release justification: Only removing old version. Release note: None --- pkg/BUILD.bazel | 3 - pkg/clusterversion/cockroach_versions.go | 6 -- pkg/clusterversion/key_string.go | 67 ++++++++-------- pkg/sql/alter_database.go | 11 --- .../logic_test/super_regions_mixed_version | 10 --- .../tests/local-mixed-21.2-22.1/BUILD.bazel | 28 ------- .../local-mixed-21.2-22.1/generated_test.go | 80 ------------------- 7 files changed, 33 insertions(+), 172 deletions(-) delete mode 100644 pkg/sql/logictest/testdata/logic_test/super_regions_mixed_version delete mode 100644 pkg/sql/logictest/tests/local-mixed-21.2-22.1/BUILD.bazel delete mode 100644 pkg/sql/logictest/tests/local-mixed-21.2-22.1/generated_test.go diff --git a/pkg/BUILD.bazel b/pkg/BUILD.bazel index c8320fc23196..80a83151f32c 100644 --- a/pkg/BUILD.bazel +++ b/pkg/BUILD.bazel @@ -357,7 +357,6 @@ ALL_TESTS = [ "//pkg/sql/logictest/tests/fakedist-disk:fakedist-disk_test", "//pkg/sql/logictest/tests/fakedist-vec-off:fakedist-vec-off_test", "//pkg/sql/logictest/tests/fakedist:fakedist_test", - "//pkg/sql/logictest/tests/local-mixed-21.2-22.1:local-mixed-21_2-22_1_test", "//pkg/sql/logictest/tests/local-mixed-22.1-22.2:local-mixed-22_1-22_2_test", "//pkg/sql/logictest/tests/local-udf:local-udf_test", "//pkg/sql/logictest/tests/local-v1.1-at-v1.0-noupgrade:local-v1_1-at-v1_0-noupgrade_test", @@ -1448,7 +1447,6 @@ GO_TARGETS = [ "//pkg/sql/logictest/tests/fakedist-disk:fakedist-disk_test", "//pkg/sql/logictest/tests/fakedist-vec-off:fakedist-vec-off_test", "//pkg/sql/logictest/tests/fakedist:fakedist_test", - "//pkg/sql/logictest/tests/local-mixed-21.2-22.1:local-mixed-21_2-22_1_test", "//pkg/sql/logictest/tests/local-mixed-22.1-22.2:local-mixed-22_1-22_2_test", "//pkg/sql/logictest/tests/local-udf:local-udf_test", "//pkg/sql/logictest/tests/local-v1.1-at-v1.0-noupgrade:local-v1_1-at-v1_0-noupgrade_test", @@ -2563,7 +2561,6 @@ GET_X_DATA_TARGETS = [ "//pkg/sql/logictest/tests/fakedist-disk:get_x_data", "//pkg/sql/logictest/tests/fakedist-vec-off:get_x_data", "//pkg/sql/logictest/tests/local:get_x_data", - "//pkg/sql/logictest/tests/local-mixed-21.2-22.1:get_x_data", "//pkg/sql/logictest/tests/local-mixed-22.1-22.2:get_x_data", "//pkg/sql/logictest/tests/local-udf:get_x_data", "//pkg/sql/logictest/tests/local-v1.1-at-v1.0-noupgrade:get_x_data", diff --git a/pkg/clusterversion/cockroach_versions.go b/pkg/clusterversion/cockroach_versions.go index bdf601eb613f..7bafd825f66d 100644 --- a/pkg/clusterversion/cockroach_versions.go +++ b/pkg/clusterversion/cockroach_versions.go @@ -205,8 +205,6 @@ const ( // AutoStatsTableSettings is the version where we allow auto stats related // table settings. AutoStatsTableSettings - // SuperRegions enables the usage on super regions. - SuperRegions // EnableNewChangefeedOptions enables the usage of new changefeed options // such as end_time, initial_scan_only, and setting the value of initial_scan // to 'yes|no|only' @@ -406,10 +404,6 @@ var versionsSingleton = keyedVersions{ Key: AutoStatsTableSettings, Version: roachpb.Version{Major: 21, Minor: 2, Internal: 100}, }, - { - Key: SuperRegions, - Version: roachpb.Version{Major: 21, Minor: 2, Internal: 104}, - }, { Key: EnableNewChangefeedOptions, Version: roachpb.Version{Major: 21, Minor: 2, Internal: 106}, diff --git a/pkg/clusterversion/key_string.go b/pkg/clusterversion/key_string.go index bd20edcef8ea..0ca285cfc113 100644 --- a/pkg/clusterversion/key_string.go +++ b/pkg/clusterversion/key_string.go @@ -21,43 +21,42 @@ func _() { _ = x[EnableNewStoreRebalancer-10] _ = x[ClusterLocksVirtualTable-11] _ = x[AutoStatsTableSettings-12] - _ = x[SuperRegions-13] - _ = x[EnableNewChangefeedOptions-14] - _ = x[V22_1-15] - _ = x[Start22_2-16] - _ = x[LocalTimestamps-17] - _ = x[PebbleFormatSplitUserKeysMarkedCompacted-18] - _ = x[EnsurePebbleFormatVersionRangeKeys-19] - _ = x[EnablePebbleFormatVersionRangeKeys-20] - _ = x[TrigramInvertedIndexes-21] - _ = x[RemoveGrantPrivilege-22] - _ = x[MVCCRangeTombstones-23] - _ = x[UpgradeSequenceToBeReferencedByID-24] - _ = x[SampledStmtDiagReqs-25] - _ = x[AddSSTableTombstones-26] - _ = x[SystemPrivilegesTable-27] - _ = x[EnablePredicateProjectionChangefeed-28] - _ = x[AlterSystemSQLInstancesAddLocality-29] - _ = x[SystemExternalConnectionsTable-30] - _ = x[AlterSystemStatementStatisticsAddIndexRecommendations-31] - _ = x[RoleIDSequence-32] - _ = x[AddSystemUserIDColumn-33] - _ = x[SystemUsersIDColumnIsBackfilled-34] - _ = x[SetSystemUsersUserIDColumnNotNull-35] - _ = x[SQLSchemaTelemetryScheduledJobs-36] - _ = x[SchemaChangeSupportsCreateFunction-37] - _ = x[DeleteRequestReturnKey-38] - _ = x[PebbleFormatPrePebblev1Marked-39] - _ = x[RoleOptionsTableHasIDColumn-40] - _ = x[RoleOptionsIDColumnIsBackfilled-41] - _ = x[SetRoleOptionsUserIDColumnNotNull-42] - _ = x[UseDelRangeInGCJob-43] - _ = x[WaitedForDelRangeInGCJob-44] + _ = x[EnableNewChangefeedOptions-13] + _ = x[V22_1-14] + _ = x[Start22_2-15] + _ = x[LocalTimestamps-16] + _ = x[PebbleFormatSplitUserKeysMarkedCompacted-17] + _ = x[EnsurePebbleFormatVersionRangeKeys-18] + _ = x[EnablePebbleFormatVersionRangeKeys-19] + _ = x[TrigramInvertedIndexes-20] + _ = x[RemoveGrantPrivilege-21] + _ = x[MVCCRangeTombstones-22] + _ = x[UpgradeSequenceToBeReferencedByID-23] + _ = x[SampledStmtDiagReqs-24] + _ = x[AddSSTableTombstones-25] + _ = x[SystemPrivilegesTable-26] + _ = x[EnablePredicateProjectionChangefeed-27] + _ = x[AlterSystemSQLInstancesAddLocality-28] + _ = x[SystemExternalConnectionsTable-29] + _ = x[AlterSystemStatementStatisticsAddIndexRecommendations-30] + _ = x[RoleIDSequence-31] + _ = x[AddSystemUserIDColumn-32] + _ = x[SystemUsersIDColumnIsBackfilled-33] + _ = x[SetSystemUsersUserIDColumnNotNull-34] + _ = x[SQLSchemaTelemetryScheduledJobs-35] + _ = x[SchemaChangeSupportsCreateFunction-36] + _ = x[DeleteRequestReturnKey-37] + _ = x[PebbleFormatPrePebblev1Marked-38] + _ = x[RoleOptionsTableHasIDColumn-39] + _ = x[RoleOptionsIDColumnIsBackfilled-40] + _ = x[SetRoleOptionsUserIDColumnNotNull-41] + _ = x[UseDelRangeInGCJob-42] + _ = x[WaitedForDelRangeInGCJob-43] } -const _Key_name = "V21_2Start22_1ProbeRequestPublicSchemasWithDescriptorsEnsureSpanConfigReconciliationEnsureSpanConfigSubscriptionEnableSpanConfigStoreEnablePebbleFormatVersionBlockPropertiesEnableLeaseHolderRemovalChangefeedIdlenessEnableNewStoreRebalancerClusterLocksVirtualTableAutoStatsTableSettingsSuperRegionsEnableNewChangefeedOptionsV22_1Start22_2LocalTimestampsPebbleFormatSplitUserKeysMarkedCompactedEnsurePebbleFormatVersionRangeKeysEnablePebbleFormatVersionRangeKeysTrigramInvertedIndexesRemoveGrantPrivilegeMVCCRangeTombstonesUpgradeSequenceToBeReferencedByIDSampledStmtDiagReqsAddSSTableTombstonesSystemPrivilegesTableEnablePredicateProjectionChangefeedAlterSystemSQLInstancesAddLocalitySystemExternalConnectionsTableAlterSystemStatementStatisticsAddIndexRecommendationsRoleIDSequenceAddSystemUserIDColumnSystemUsersIDColumnIsBackfilledSetSystemUsersUserIDColumnNotNullSQLSchemaTelemetryScheduledJobsSchemaChangeSupportsCreateFunctionDeleteRequestReturnKeyPebbleFormatPrePebblev1MarkedRoleOptionsTableHasIDColumnRoleOptionsIDColumnIsBackfilledSetRoleOptionsUserIDColumnNotNullUseDelRangeInGCJobWaitedForDelRangeInGCJob" +const _Key_name = "V21_2Start22_1ProbeRequestPublicSchemasWithDescriptorsEnsureSpanConfigReconciliationEnsureSpanConfigSubscriptionEnableSpanConfigStoreEnablePebbleFormatVersionBlockPropertiesEnableLeaseHolderRemovalChangefeedIdlenessEnableNewStoreRebalancerClusterLocksVirtualTableAutoStatsTableSettingsEnableNewChangefeedOptionsV22_1Start22_2LocalTimestampsPebbleFormatSplitUserKeysMarkedCompactedEnsurePebbleFormatVersionRangeKeysEnablePebbleFormatVersionRangeKeysTrigramInvertedIndexesRemoveGrantPrivilegeMVCCRangeTombstonesUpgradeSequenceToBeReferencedByIDSampledStmtDiagReqsAddSSTableTombstonesSystemPrivilegesTableEnablePredicateProjectionChangefeedAlterSystemSQLInstancesAddLocalitySystemExternalConnectionsTableAlterSystemStatementStatisticsAddIndexRecommendationsRoleIDSequenceAddSystemUserIDColumnSystemUsersIDColumnIsBackfilledSetSystemUsersUserIDColumnNotNullSQLSchemaTelemetryScheduledJobsSchemaChangeSupportsCreateFunctionDeleteRequestReturnKeyPebbleFormatPrePebblev1MarkedRoleOptionsTableHasIDColumnRoleOptionsIDColumnIsBackfilledSetRoleOptionsUserIDColumnNotNullUseDelRangeInGCJobWaitedForDelRangeInGCJob" -var _Key_index = [...]uint16{0, 5, 14, 26, 54, 84, 112, 133, 173, 197, 215, 239, 263, 285, 297, 323, 328, 337, 352, 392, 426, 460, 482, 502, 521, 554, 573, 593, 614, 649, 683, 713, 766, 780, 801, 832, 865, 896, 930, 952, 981, 1008, 1039, 1072, 1090, 1114} +var _Key_index = [...]uint16{0, 5, 14, 26, 54, 84, 112, 133, 173, 197, 215, 239, 263, 285, 311, 316, 325, 340, 380, 414, 448, 470, 490, 509, 542, 561, 581, 602, 637, 671, 701, 754, 768, 789, 820, 853, 884, 918, 940, 969, 996, 1027, 1060, 1078, 1102} func (i Key) String() string { if i < 0 || i >= Key(len(_Key_index)-1) { diff --git a/pkg/sql/alter_database.go b/pkg/sql/alter_database.go index 043225db4ba5..87c3d63347d0 100644 --- a/pkg/sql/alter_database.go +++ b/pkg/sql/alter_database.go @@ -16,7 +16,6 @@ import ( "sort" "strings" - "github.com/cockroachdb/cockroach/pkg/clusterversion" "github.com/cockroachdb/cockroach/pkg/config/zonepb" "github.com/cockroachdb/cockroach/pkg/keys" "github.com/cockroachdb/cockroach/pkg/security/username" @@ -1330,9 +1329,6 @@ type alterDatabaseAddSuperRegion struct { func (p *planner) AlterDatabaseAddSuperRegion( ctx context.Context, n *tree.AlterDatabaseAddSuperRegion, ) (planNode, error) { - if !p.ExecCfg().Settings.Version.IsActive(ctx, clusterversion.SuperRegions) { - return nil, errors.Newf("super regions are not supported until upgrade to version %s is finalized", clusterversion.SuperRegions.String()) - } if err := p.isSuperRegionEnabled(); err != nil { return nil, err } @@ -1429,10 +1425,6 @@ type alterDatabaseDropSuperRegion struct { func (p *planner) AlterDatabaseDropSuperRegion( ctx context.Context, n *tree.AlterDatabaseDropSuperRegion, ) (planNode, error) { - if !p.ExecCfg().Settings.Version.IsActive(ctx, clusterversion.SuperRegions) { - return nil, errors.Newf("super regions are not supported until upgrade to version %s is finalized", clusterversion.SuperRegions.String()) - } - if err := p.isSuperRegionEnabled(); err != nil { return nil, err } @@ -1561,9 +1553,6 @@ func (n *alterDatabaseAlterSuperRegion) Close(context.Context) {} func (p *planner) AlterDatabaseAlterSuperRegion( ctx context.Context, n *tree.AlterDatabaseAlterSuperRegion, ) (planNode, error) { - if !p.ExecCfg().Settings.Version.IsActive(ctx, clusterversion.SuperRegions) { - return nil, errors.Newf("super regions are not supported until upgrade to version %s is finalized", clusterversion.SuperRegions.String()) - } if err := p.isSuperRegionEnabled(); err != nil { return nil, err } diff --git a/pkg/sql/logictest/testdata/logic_test/super_regions_mixed_version b/pkg/sql/logictest/testdata/logic_test/super_regions_mixed_version deleted file mode 100644 index a7197836456f..000000000000 --- a/pkg/sql/logictest/testdata/logic_test/super_regions_mixed_version +++ /dev/null @@ -1,10 +0,0 @@ -# LogicTest: local-mixed-21.2-22.1 - -statement error pq: super regions are not supported until upgrade to version SuperRegions is finalized -ALTER DATABASE test ADD SUPER REGION "test" VALUES "hello" - -statement error pq: super regions are not supported until upgrade to version SuperRegions is finalized -ALTER DATABASE test DROP SUPER REGION "test" - -statement error pq: super regions are not supported until upgrade to version SuperRegions is finalized -ALTER DATABASE test ALTER SUPER REGION "test" VALUES "hello" diff --git a/pkg/sql/logictest/tests/local-mixed-21.2-22.1/BUILD.bazel b/pkg/sql/logictest/tests/local-mixed-21.2-22.1/BUILD.bazel deleted file mode 100644 index 39bad3f094e1..000000000000 --- a/pkg/sql/logictest/tests/local-mixed-21.2-22.1/BUILD.bazel +++ /dev/null @@ -1,28 +0,0 @@ -load("//build/bazelutil/unused_checker:unused.bzl", "get_x_data") -load("@io_bazel_rules_go//go:def.bzl", "go_test") - -go_test( - name = "local-mixed-21_2-22_1_test", - size = "enormous", - srcs = ["generated_test.go"], - data = [ - "//c-deps:libgeos", # keep - "//pkg/sql/logictest:testdata", # keep - ], - shard_count = 1, - tags = ["cpu:1"], - deps = [ - "//pkg/build/bazel", - "//pkg/security/securityassets", - "//pkg/security/securitytest", - "//pkg/server", - "//pkg/sql/logictest", - "//pkg/testutils/serverutils", - "//pkg/testutils/skip", - "//pkg/testutils/testcluster", - "//pkg/util/leaktest", - "//pkg/util/randutil", - ], -) - -get_x_data(name = "get_x_data") diff --git a/pkg/sql/logictest/tests/local-mixed-21.2-22.1/generated_test.go b/pkg/sql/logictest/tests/local-mixed-21.2-22.1/generated_test.go deleted file mode 100644 index 134b9518798e..000000000000 --- a/pkg/sql/logictest/tests/local-mixed-21.2-22.1/generated_test.go +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2022 The Cockroach Authors. -// -// Use of this software is governed by the Business Source License -// included in the file licenses/BSL.txt. -// -// As of the Change Date specified in that file, in accordance with -// the Business Source License, use of this software will be governed -// by the Apache License, Version 2.0, included in the file -// licenses/APL.txt. - -// Code generated by generate-logictest, DO NOT EDIT. - -package testlocal_mixed_212_221 - -import ( - "os" - "path/filepath" - "testing" - - "github.com/cockroachdb/cockroach/pkg/build/bazel" - "github.com/cockroachdb/cockroach/pkg/security/securityassets" - "github.com/cockroachdb/cockroach/pkg/security/securitytest" - "github.com/cockroachdb/cockroach/pkg/server" - "github.com/cockroachdb/cockroach/pkg/sql/logictest" - "github.com/cockroachdb/cockroach/pkg/testutils/serverutils" - "github.com/cockroachdb/cockroach/pkg/testutils/skip" - "github.com/cockroachdb/cockroach/pkg/testutils/testcluster" - "github.com/cockroachdb/cockroach/pkg/util/leaktest" - "github.com/cockroachdb/cockroach/pkg/util/randutil" -) - -const configIdx = 18 - -var logicTestDir string - -func init() { - if bazel.BuiltWithBazel() { - var err error - logicTestDir, err = bazel.Runfile("pkg/sql/logictest/testdata/logic_test") - if err != nil { - panic(err) - } - } else { - logicTestDir = "../../../../sql/logictest/testdata/logic_test" - } -} - -func TestMain(m *testing.M) { - securityassets.SetLoader(securitytest.EmbeddedAssets) - randutil.SeedForTests() - serverutils.InitTestServerFactory(server.TestServerFactory) - serverutils.InitTestClusterFactory(testcluster.TestClusterFactory) - os.Exit(m.Run()) -} - -func runLogicTest(t *testing.T, file string) { - skip.UnderDeadlock(t, "times out and/or hangs") - logictest.RunLogicTest(t, logictest.TestServerArgs{}, configIdx, filepath.Join(logicTestDir, file)) -} - -// TestLogic_tmp runs any tests that are prefixed with "_", in which a dedicated -// test is not generated for. This allows developers to create and run temporary -// test files that are not checked into the repository, without repeatedly -// regenerating and reverting changes to this file, generated_test.go. -// -// TODO(mgartner): Add file filtering so that individual files can be run, -// instead of all files with the "_" prefix. -func TestLogic_tmp(t *testing.T) { - defer leaktest.AfterTest(t)() - var glob string - glob = filepath.Join(logicTestDir, "_*") - logictest.RunLogicTests(t, logictest.TestServerArgs{}, configIdx, glob) -} - -func TestLogic_super_regions_mixed_version( - t *testing.T, -) { - defer leaktest.AfterTest(t)() - runLogicTest(t, "super_regions_mixed_version") -}