From 4710f62e70c1b1fe58c2c584ca6c1e593c19a975 Mon Sep 17 00:00:00 2001 From: Rafi Shamim Date: Mon, 15 Aug 2022 13:10:09 -0400 Subject: [PATCH] clusterversions: remove RowLevelTTL version Release note: None --- pkg/clusterversion/cockroach_versions.go | 6 -- pkg/clusterversion/key_string.go | 75 +++++++++---------- pkg/sql/alter_table.go | 7 -- pkg/sql/create_table.go | 13 ---- .../logic_test/row_level_ttl_mixed_21.2_22.1 | 10 --- .../tests/local-mixed-21.2-22.1/BUILD.bazel | 2 +- .../local-mixed-21.2-22.1/generated_test.go | 7 -- 7 files changed, 38 insertions(+), 82 deletions(-) delete mode 100644 pkg/sql/logictest/testdata/logic_test/row_level_ttl_mixed_21.2_22.1 diff --git a/pkg/clusterversion/cockroach_versions.go b/pkg/clusterversion/cockroach_versions.go index f2c553097ba9..bdf601eb613f 100644 --- a/pkg/clusterversion/cockroach_versions.go +++ b/pkg/clusterversion/cockroach_versions.go @@ -196,8 +196,6 @@ const ( // ChangefeedIdleness is the version where changefeed aggregators forward // idleness-related information alnog with resolved spans to the frontier ChangefeedIdleness - // RowLevelTTL is the version where we allow row level TTL tables. - RowLevelTTL // EnableNewStoreRebalancer enables the new store rebalancer introduced in // 22.1. EnableNewStoreRebalancer @@ -396,10 +394,6 @@ var versionsSingleton = keyedVersions{ Key: ChangefeedIdleness, Version: roachpb.Version{Major: 21, Minor: 2, Internal: 82}, }, - { - Key: RowLevelTTL, - Version: roachpb.Version{Major: 21, Minor: 2, Internal: 88}, - }, { Key: EnableNewStoreRebalancer, Version: roachpb.Version{Major: 21, Minor: 2, Internal: 96}, diff --git a/pkg/clusterversion/key_string.go b/pkg/clusterversion/key_string.go index e3ad7ef650dc..bd20edcef8ea 100644 --- a/pkg/clusterversion/key_string.go +++ b/pkg/clusterversion/key_string.go @@ -18,47 +18,46 @@ func _() { _ = x[EnablePebbleFormatVersionBlockProperties-7] _ = x[EnableLeaseHolderRemoval-8] _ = x[ChangefeedIdleness-9] - _ = x[RowLevelTTL-10] - _ = x[EnableNewStoreRebalancer-11] - _ = x[ClusterLocksVirtualTable-12] - _ = x[AutoStatsTableSettings-13] - _ = x[SuperRegions-14] - _ = x[EnableNewChangefeedOptions-15] - _ = x[V22_1-16] - _ = x[Start22_2-17] - _ = x[LocalTimestamps-18] - _ = x[PebbleFormatSplitUserKeysMarkedCompacted-19] - _ = x[EnsurePebbleFormatVersionRangeKeys-20] - _ = x[EnablePebbleFormatVersionRangeKeys-21] - _ = x[TrigramInvertedIndexes-22] - _ = x[RemoveGrantPrivilege-23] - _ = x[MVCCRangeTombstones-24] - _ = x[UpgradeSequenceToBeReferencedByID-25] - _ = x[SampledStmtDiagReqs-26] - _ = x[AddSSTableTombstones-27] - _ = x[SystemPrivilegesTable-28] - _ = x[EnablePredicateProjectionChangefeed-29] - _ = x[AlterSystemSQLInstancesAddLocality-30] - _ = x[SystemExternalConnectionsTable-31] - _ = x[AlterSystemStatementStatisticsAddIndexRecommendations-32] - _ = x[RoleIDSequence-33] - _ = x[AddSystemUserIDColumn-34] - _ = x[SystemUsersIDColumnIsBackfilled-35] - _ = x[SetSystemUsersUserIDColumnNotNull-36] - _ = x[SQLSchemaTelemetryScheduledJobs-37] - _ = x[SchemaChangeSupportsCreateFunction-38] - _ = x[DeleteRequestReturnKey-39] - _ = x[PebbleFormatPrePebblev1Marked-40] - _ = x[RoleOptionsTableHasIDColumn-41] - _ = x[RoleOptionsIDColumnIsBackfilled-42] - _ = x[SetRoleOptionsUserIDColumnNotNull-43] - _ = x[UseDelRangeInGCJob-44] - _ = x[WaitedForDelRangeInGCJob-45] + _ = 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] } -const _Key_name = "V21_2Start22_1ProbeRequestPublicSchemasWithDescriptorsEnsureSpanConfigReconciliationEnsureSpanConfigSubscriptionEnableSpanConfigStoreEnablePebbleFormatVersionBlockPropertiesEnableLeaseHolderRemovalChangefeedIdlenessRowLevelTTLEnableNewStoreRebalancerClusterLocksVirtualTableAutoStatsTableSettingsSuperRegionsEnableNewChangefeedOptionsV22_1Start22_2LocalTimestampsPebbleFormatSplitUserKeysMarkedCompactedEnsurePebbleFormatVersionRangeKeysEnablePebbleFormatVersionRangeKeysTrigramInvertedIndexesRemoveGrantPrivilegeMVCCRangeTombstonesUpgradeSequenceToBeReferencedByIDSampledStmtDiagReqsAddSSTableTombstonesSystemPrivilegesTableEnablePredicateProjectionChangefeedAlterSystemSQLInstancesAddLocalitySystemExternalConnectionsTableAlterSystemStatementStatisticsAddIndexRecommendationsRoleIDSequenceAddSystemUserIDColumnSystemUsersIDColumnIsBackfilledSetSystemUsersUserIDColumnNotNullSQLSchemaTelemetryScheduledJobsSchemaChangeSupportsCreateFunctionDeleteRequestReturnKeyPebbleFormatPrePebblev1MarkedRoleOptionsTableHasIDColumnRoleOptionsIDColumnIsBackfilledSetRoleOptionsUserIDColumnNotNullUseDelRangeInGCJobWaitedForDelRangeInGCJob" +const _Key_name = "V21_2Start22_1ProbeRequestPublicSchemasWithDescriptorsEnsureSpanConfigReconciliationEnsureSpanConfigSubscriptionEnableSpanConfigStoreEnablePebbleFormatVersionBlockPropertiesEnableLeaseHolderRemovalChangefeedIdlenessEnableNewStoreRebalancerClusterLocksVirtualTableAutoStatsTableSettingsSuperRegionsEnableNewChangefeedOptionsV22_1Start22_2LocalTimestampsPebbleFormatSplitUserKeysMarkedCompactedEnsurePebbleFormatVersionRangeKeysEnablePebbleFormatVersionRangeKeysTrigramInvertedIndexesRemoveGrantPrivilegeMVCCRangeTombstonesUpgradeSequenceToBeReferencedByIDSampledStmtDiagReqsAddSSTableTombstonesSystemPrivilegesTableEnablePredicateProjectionChangefeedAlterSystemSQLInstancesAddLocalitySystemExternalConnectionsTableAlterSystemStatementStatisticsAddIndexRecommendationsRoleIDSequenceAddSystemUserIDColumnSystemUsersIDColumnIsBackfilledSetSystemUsersUserIDColumnNotNullSQLSchemaTelemetryScheduledJobsSchemaChangeSupportsCreateFunctionDeleteRequestReturnKeyPebbleFormatPrePebblev1MarkedRoleOptionsTableHasIDColumnRoleOptionsIDColumnIsBackfilledSetRoleOptionsUserIDColumnNotNullUseDelRangeInGCJobWaitedForDelRangeInGCJob" -var _Key_index = [...]uint16{0, 5, 14, 26, 54, 84, 112, 133, 173, 197, 215, 226, 250, 274, 296, 308, 334, 339, 348, 363, 403, 437, 471, 493, 513, 532, 565, 584, 604, 625, 660, 694, 724, 777, 791, 812, 843, 876, 907, 941, 963, 992, 1019, 1050, 1083, 1101, 1125} +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} func (i Key) String() string { if i < 0 || i >= Key(len(_Key_index)-1) { diff --git a/pkg/sql/alter_table.go b/pkg/sql/alter_table.go index 812c5184b76a..75d3f14051a2 100644 --- a/pkg/sql/alter_table.go +++ b/pkg/sql/alter_table.go @@ -1859,13 +1859,6 @@ func handleTTLStorageParamChange( tableDesc *tabledesc.Mutable, before, after *catpb.RowLevelTTL, ) error { - - if before == nil && after != nil { - if err := checkTTLEnabledForCluster(params.ctx, params.p.ExecCfg().Settings); err != nil { - return err - } - } - // update existing config if before != nil && after != nil { diff --git a/pkg/sql/create_table.go b/pkg/sql/create_table.go index 950e6b7a2854..66b94bc3b499 100644 --- a/pkg/sql/create_table.go +++ b/pkg/sql/create_table.go @@ -1475,9 +1475,6 @@ func NewTableDesc( // Create the TTL automatic column (crdb_internal_expiration) if one does not already exist. if ttl := desc.GetRowLevelTTL(); ttl != nil && ttl.HasDurationExpr() { - if err := checkTTLEnabledForCluster(ctx, st); err != nil { - return nil, err - } hasRowLevelTTLColumn := false for _, def := range n.Defs { switch def := def.(type) { @@ -2422,16 +2419,6 @@ func newRowLevelTTLScheduledJob( return sj, nil } -func checkTTLEnabledForCluster(ctx context.Context, st *cluster.Settings) error { - if !st.Version.IsActive(ctx, clusterversion.RowLevelTTL) { - return pgerror.Newf( - pgcode.FeatureNotSupported, - "row level TTL is only available once the cluster is fully upgraded", - ) - } - return nil -} - func checkAutoStatsTableSettingsEnabledForCluster(ctx context.Context, st *cluster.Settings) error { if !st.Version.IsActive(ctx, clusterversion.AutoStatsTableSettings) { return pgerror.Newf( diff --git a/pkg/sql/logictest/testdata/logic_test/row_level_ttl_mixed_21.2_22.1 b/pkg/sql/logictest/testdata/logic_test/row_level_ttl_mixed_21.2_22.1 deleted file mode 100644 index e1538100aade..000000000000 --- a/pkg/sql/logictest/testdata/logic_test/row_level_ttl_mixed_21.2_22.1 +++ /dev/null @@ -1,10 +0,0 @@ -# LogicTest: local-mixed-21.2-22.1 - -statement error row level TTL is only available once the cluster is fully upgraded -CREATE TABLE tbl () WITH (ttl_expire_after = '10 minutes') - -statement ok -CREATE TABLE tbl () - -statement error row level TTL is only available once the cluster is fully upgraded -ALTER TABLE tbl SET (ttl_expire_after = '10 minutes') 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 index 540ed1d18ae2..9b36c0c237b3 100644 --- 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 @@ -9,7 +9,7 @@ go_test( "//c-deps:libgeos", # keep "//pkg/sql/logictest:testdata", # keep ], - shard_count = 2, + shard_count = 1, deps = [ "//pkg/build/bazel", "//pkg/security/securityassets", 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 index d57320d77329..134b9518798e 100644 --- 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 @@ -72,13 +72,6 @@ func TestLogic_tmp(t *testing.T) { logictest.RunLogicTests(t, logictest.TestServerArgs{}, configIdx, glob) } -func TestLogic_row_level_ttl_mixed_21_2_22_1( - t *testing.T, -) { - defer leaktest.AfterTest(t)() - runLogicTest(t, "row_level_ttl_mixed_21.2_22.1") -} - func TestLogic_super_regions_mixed_version( t *testing.T, ) {