From 2dbb4fff9329e3cee67abbbd048af3c157796039 Mon Sep 17 00:00:00 2001 From: Radu Berinde Date: Mon, 16 Oct 2023 12:37:25 -0700 Subject: [PATCH] clusterversion: rename pre-23.1 version gates This commit renames all pre-23.1 version keys (except those associated permanent upgrades) to start with `TODO_Delete_`. These keys will be removed by relevant teams. Informs: #111760 Release note: None --- pkg/ccl/backupccl/backup_planning_tenant.go | 2 +- pkg/ccl/backupccl/datadriven_test.go | 4 +- pkg/ccl/backupccl/restore_job.go | 2 +- pkg/ccl/backupccl/system_schema.go | 8 +- pkg/ccl/changefeedccl/changefeed_stmt.go | 10 +- pkg/ccl/changefeedccl/event_processing.go | 4 +- pkg/ccl/changefeedccl/scheduled_changefeed.go | 4 +- pkg/cli/auth.go | 2 +- pkg/clusterversion/cockroach_versions.go | 434 +++++++++--------- pkg/jobs/adopt.go | 2 +- pkg/jobs/jobs.go | 4 +- pkg/jobs/registry.go | 20 +- pkg/jobs/update.go | 6 +- pkg/jobs/utils.go | 2 +- pkg/kv/kvserver/kvstorage/cluster_version.go | 2 +- pkg/kv/kvserver/loqrecovery/version.go | 2 +- pkg/kv/kvserver/rebalance_objective.go | 2 +- pkg/kv/kvserver/rebalance_objective_test.go | 10 +- .../authorizer.go | 2 +- pkg/server/authserver/authentication.go | 2 +- pkg/server/combined_statement_stats.go | 4 +- pkg/server/server_controller_orchestration.go | 2 +- .../settingswatcher/version_guard_test.go | 10 +- pkg/server/statement_details.go | 4 +- pkg/server/testserver.go | 2 +- pkg/sql/alter_role.go | 2 +- pkg/sql/alter_table.go | 2 +- pkg/sql/catalog/descidgen/generate_id.go | 6 +- pkg/sql/catalog/lease/kv_writer.go | 10 +- pkg/sql/catalog/lease/lease.go | 2 +- pkg/sql/catalog/tabledesc/validate_test.go | 2 +- pkg/sql/colexec/colbuilder/execplan.go | 2 +- pkg/sql/crdb_internal.go | 10 +- pkg/sql/create_external_connection.go | 2 +- pkg/sql/delegate/show_changefeed_jobs.go | 2 +- pkg/sql/gcjob/gcjobnotifier/notifier.go | 2 +- pkg/sql/grant_revoke_system.go | 4 +- pkg/sql/grant_role.go | 2 +- pkg/sql/schema_changer.go | 2 +- .../internal/scbuildstmt/alter_table.go | 4 +- .../scbuild/internal/scbuildstmt/process.go | 2 +- pkg/sql/schemachanger/scdecomp/decomp.go | 2 +- pkg/sql/schemachanger/scpb/migration.go | 2 +- .../rules/release_22_2/assertions_test.go | 2 +- .../internal/rules/release_22_2/helpers.go | 2 +- pkg/sql/schemachanger/scplan/plan.go | 2 +- pkg/sql/schemachanger/screl/scalars.go | 4 +- pkg/sql/show_stats.go | 2 +- .../instancestorage/instancecache.go | 8 +- .../instancestorage/instancestorage.go | 12 +- pkg/sql/sqlliveness/slstorage/sessionid.go | 4 +- pkg/sql/sqlliveness/slstorage/slstorage.go | 10 +- .../slstorage/slstorage_internal_test.go | 18 +- pkg/sql/stats/new_stat.go | 2 +- pkg/sql/stats/stats_cache.go | 2 +- pkg/sql/tenant_accessors.go | 8 +- pkg/sql/tenant_capability.go | 2 +- pkg/sql/tenant_creation.go | 12 +- pkg/sql/tenant_deletion.go | 2 +- pkg/sql/tenant_update.go | 6 +- pkg/sql/tests/kv_test.go | 2 +- pkg/storage/mvcc.go | 6 +- pkg/storage/pebble.go | 14 +- pkg/storage/sst_writer.go | 2 +- pkg/upgrade/upgrademanager/manager.go | 2 +- pkg/upgrade/upgrades/system_rbr_indexes.go | 8 +- pkg/upgrade/upgrades/upgrades.go | 60 +-- .../schemachange/operation_generator.go | 2 +- 68 files changed, 404 insertions(+), 396 deletions(-) diff --git a/pkg/ccl/backupccl/backup_planning_tenant.go b/pkg/ccl/backupccl/backup_planning_tenant.go index d8e51dcfec6b..e0022f5e7aa4 100644 --- a/pkg/ccl/backupccl/backup_planning_tenant.go +++ b/pkg/ccl/backupccl/backup_planning_tenant.go @@ -38,7 +38,7 @@ FROM LEFT JOIN system.tenant_usage ON tenants.id = tenant_usage.tenant_id AND tenant_usage.instance_id = 0 ` - if !settings.Version.IsActive(ctx, clusterversion.V23_1TenantNamesStateAndServiceMode) { + if !settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1TenantNamesStateAndServiceMode) { q = ` SELECT tenants.id, /* 0 */ diff --git a/pkg/ccl/backupccl/datadriven_test.go b/pkg/ccl/backupccl/datadriven_test.go index 475598e367e1..470ff4504156 100644 --- a/pkg/ccl/backupccl/datadriven_test.go +++ b/pkg/ccl/backupccl/datadriven_test.go @@ -81,8 +81,8 @@ var localityCfgs = map[string]roachpb.Locality{ } var clusterVersionKeys = map[string]clusterversion.Key{ - "23_1_Start": clusterversion.V23_1Start, - "23_1_MVCCTombstones": clusterversion.V23_1_MVCCRangeTombstonesUnconditionallyEnabled, + "23_1_Start": clusterversion.TODO_Delete_V23_1Start, + "23_1_MVCCTombstones": clusterversion.TODO_Delete_V23_1_MVCCRangeTombstonesUnconditionallyEnabled, "23_2_Start": clusterversion.V23_2Start, "23_2": clusterversion.V23_2, } diff --git a/pkg/ccl/backupccl/restore_job.go b/pkg/ccl/backupccl/restore_job.go index 0eb737e11ff6..b71583ee5c3d 100644 --- a/pkg/ccl/backupccl/restore_job.go +++ b/pkg/ccl/backupccl/restore_job.go @@ -3029,7 +3029,7 @@ func (r *restoreResumer) restoreSystemUsers( return err } - roleMembersHasIDColumns := r.execCfg.Settings.Version.IsActive(ctx, clusterversion.V23_1RoleMembersTableHasIDColumns) + roleMembersHasIDColumns := r.execCfg.Settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1RoleMembersTableHasIDColumns) insertRoleMember := ` INSERT INTO system.role_members ("role", "member", "isAdmin", role_id, member_id) VALUES ($1, $2, $3, (SELECT user_id FROM system.users WHERE username = $1), (SELECT user_id FROM system.users WHERE username = $2))` diff --git a/pkg/ccl/backupccl/system_schema.go b/pkg/ccl/backupccl/system_schema.go index 6db737203af1..e3d070327fa5 100644 --- a/pkg/ccl/backupccl/system_schema.go +++ b/pkg/ccl/backupccl/system_schema.go @@ -243,7 +243,7 @@ func roleMembersRestoreFunc( txn isql.Txn, systemTableName, tempTableName string, ) error { - if !deps.settings.Version.IsActive(ctx, clusterversion.V23_1RoleMembersTableHasIDColumns) { + if !deps.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1RoleMembersTableHasIDColumns) { return defaultSystemTableRestoreFunc(ctx, deps, txn, systemTableName, tempTableName) } @@ -370,7 +370,7 @@ func systemPrivilegesRestoreFunc( txn isql.Txn, systemTableName, tempTableName string, ) error { - if !deps.settings.Version.IsActive(ctx, clusterversion.V23_1SystemPrivilegesTableHasUserIDColumn) { + if !deps.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1SystemPrivilegesTableHasUserIDColumn) { return defaultSystemTableRestoreFunc(ctx, deps, txn, systemTableName, tempTableName) } @@ -425,7 +425,7 @@ func systemDatabaseRoleSettingsRestoreFunc( txn isql.Txn, systemTableName, tempTableName string, ) error { - if !deps.settings.Version.IsActive(ctx, clusterversion.V23_1DatabaseRoleSettingsHasRoleIDColumn) { + if !deps.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1DatabaseRoleSettingsHasRoleIDColumn) { return defaultSystemTableRestoreFunc(ctx, deps, txn, systemTableName, tempTableName) } @@ -480,7 +480,7 @@ func systemExternalConnectionsRestoreFunc( txn isql.Txn, systemTableName, tempTableName string, ) error { - if !deps.settings.Version.IsActive(ctx, clusterversion.V23_1ExternalConnectionsTableHasOwnerIDColumn) { + if !deps.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1ExternalConnectionsTableHasOwnerIDColumn) { return defaultSystemTableRestoreFunc(ctx, deps, txn, systemTableName, tempTableName) } diff --git a/pkg/ccl/changefeedccl/changefeed_stmt.go b/pkg/ccl/changefeedccl/changefeed_stmt.go index 12f6adf3f966..b25600784f01 100644 --- a/pkg/ccl/changefeedccl/changefeed_stmt.go +++ b/pkg/ccl/changefeedccl/changefeed_stmt.go @@ -512,14 +512,14 @@ func createChangefeedJobRecord( return nil, err } if withDiff { - if !p.ExecCfg().Settings.Version.IsActive(ctx, clusterversion.V23_1_ChangefeedExpressionProductionReady) { + if !p.ExecCfg().Settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1_ChangefeedExpressionProductionReady) { return nil, pgerror.Newf( pgcode.FeatureNotSupported, "cannot create new changefeed with CDC expression <%s>, "+ "which requires access to cdc_prev until cluster upgrade to %s finalized.", tree.AsString(normalized), - clusterversion.V23_1_ChangefeedExpressionProductionReady.String, + clusterversion.TODO_Delete_V23_1_ChangefeedExpressionProductionReady.String, ) } opts.ForceDiff() @@ -1620,7 +1620,7 @@ func failureTypeForStartupError(err error) changefeedbase.FailureType { // maybeUpgradePreProductionReadyExpression updates job record for the // changefeed using CDC transformation, created prior to -// clusterversion.V23_1_ChangefeedExpressionProductionReady. The update happens +// clusterversion.TODO_Delete_V23_1_ChangefeedExpressionProductionReady. The update happens // once cluster version finalized. // Returns nil when nothing needs to be done. // Returns fatal error message, causing changefeed to fail, if automatic upgrade @@ -1643,14 +1643,14 @@ func maybeUpgradePreProductionReadyExpression( } if !jobExec.ExecCfg().Settings.Version.IsActive( - ctx, clusterversion.V23_1_ChangefeedExpressionProductionReady, + ctx, clusterversion.TODO_Delete_V23_1_ChangefeedExpressionProductionReady, ) { // Can't upgrade job record yet -- wait until upgrade finalized. return nil } // Expressions prior to - // clusterversion.V23_1_ChangefeedExpressionProductionReady were rewritten to + // clusterversion.TODO_Delete_V23_1_ChangefeedExpressionProductionReady were rewritten to // fully qualify all columns/types. Furthermore, those expressions couldn't // use any functions that depend on session data. Thus, it is safe to use // minimal session data. diff --git a/pkg/ccl/changefeedccl/event_processing.go b/pkg/ccl/changefeedccl/event_processing.go index 6d4bc69972ef..9b090ddc8fee 100644 --- a/pkg/ccl/changefeedccl/event_processing.go +++ b/pkg/ccl/changefeedccl/event_processing.go @@ -276,7 +276,7 @@ func newEvaluator( sd := sql.NewInternalSessionData(ctx, cfg.Settings, "changefeed-evaluator") if spec.Feed.SessionData == nil { // This changefeed was created prior to - // clusterversion.V23_1_ChangefeedExpressionProductionReady; thus we must + // clusterversion.TODO_Delete_V23_1_ChangefeedExpressionProductionReady; thus we must // rewrite expression to comply with current cluster version. newExpr, err := cdceval.RewritePreviewExpression(sc) if err != nil { @@ -288,7 +288,7 @@ func newEvaluator( log.Warningf(ctx, "changefeed expression %s (job %d) created prior to %s rewritten as %s", tree.AsString(sc), spec.JobID, - clusterversion.V23_1_ChangefeedExpressionProductionReady.String(), + clusterversion.TODO_Delete_V23_1_ChangefeedExpressionProductionReady.String(), tree.AsString(newExpr)) sc = newExpr } diff --git a/pkg/ccl/changefeedccl/scheduled_changefeed.go b/pkg/ccl/changefeedccl/scheduled_changefeed.go index 31bf60911459..cd1d4859ef34 100644 --- a/pkg/ccl/changefeedccl/scheduled_changefeed.go +++ b/pkg/ccl/changefeedccl/scheduled_changefeed.go @@ -686,12 +686,12 @@ func createChangefeedScheduleTypeCheck( return false, nil, nil } - if !p.ExecCfg().Settings.Version.IsActive(ctx, clusterversion.V23_1ScheduledChangefeeds) { + if !p.ExecCfg().Settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1ScheduledChangefeeds) { return false, nil, pgerror.Newf( pgcode.FeatureNotSupported, "cannot use scheduled changefeeds until cluster is upgraded to %s", - clusterversion.V23_1ScheduledChangefeeds.String, + clusterversion.TODO_Delete_V23_1ScheduledChangefeeds.String, ) } diff --git a/pkg/cli/auth.go b/pkg/cli/auth.go index f70c005328bc..2d91af4af2e9 100644 --- a/pkg/cli/auth.go +++ b/pkg/cli/auth.go @@ -128,7 +128,7 @@ func createAuthSessionToken( err = sqlConn.ExecTxn(ctx, func(ctx context.Context, conn clisqlclient.TxBoundConn) error { rows, err := conn.Query(ctx, "SELECT crdb_internal.is_at_least_version($1)", - clusterversion.ByKey(clusterversion.V23_1WebSessionsTableHasUserIDColumn)) + clusterversion.ByKey(clusterversion.TODO_Delete_V23_1WebSessionsTableHasUserIDColumn)) if err != nil { return err } diff --git a/pkg/clusterversion/cockroach_versions.go b/pkg/clusterversion/cockroach_versions.go index 9844ee0c2696..5722da8f61c4 100644 --- a/pkg/clusterversion/cockroach_versions.go +++ b/pkg/clusterversion/cockroach_versions.go @@ -188,252 +188,260 @@ const ( VPrimordialMax - // v22.2 versions. - // // Permanent_V22_2SQLSchemaTelemetryScheduledJobs adds an automatic schedule for SQL schema // telemetry logging jobs. // This is a permanent migration which should exist forever. Permanent_V22_2SQLSchemaTelemetryScheduledJobs - // V22_2 is CockroachDB v22.2. It's used for all v22.2.x patch releases. - V22_2 + // TODO_Delete_V22_2 is CockroachDB v22.2. It's used for all v22.2.x patch releases. + TODO_Delete_V22_2 - // V23_1_Start demarcates the start of cluster versions stepped through during - // the process of upgrading from 22.2 to 23.1. - V23_1Start + // TODO_Delete_V23_1Start demarcates the start of cluster versions stepped + // through during the process of upgrading from 22.2 to 23.1. + TODO_Delete_V23_1Start - // V23_1TenantNamesStateAndServiceMode adds columns to system.tenants. - V23_1TenantNamesStateAndServiceMode + // TODO_Delete_V23_1TenantNamesStateAndServiceMode adds columns to + // system.tenants. + TODO_Delete_V23_1TenantNamesStateAndServiceMode - // V23_1DescIDSequenceForSystemTenant migrates the descriptor ID generator - // counter from a meta key to the system.descriptor_id_seq sequence for the - // system tenant. - V23_1DescIDSequenceForSystemTenant + // TODO_Delete_V23_1DescIDSequenceForSystemTenant migrates the descriptor ID + // generator counter from a meta key to the system.descriptor_id_seq sequence + // for the system tenant. + TODO_Delete_V23_1DescIDSequenceForSystemTenant - // V23_1AddPartialStatisticsColumns adds two columns: one to store the predicate - // for a partial statistics collection, and another to refer to the full statistic - // it was collected from. - V23_1AddPartialStatisticsColumns + // TODO_Delete_V23_1AddPartialStatisticsColumns adds two columns: one to store + // the predicate for a partial statistics collection, and another to refer to + // the full statistic it was collected from. + TODO_Delete_V23_1AddPartialStatisticsColumns - // V23_1_CreateSystemJobInfoTable creates the system.job_info table. - V23_1CreateSystemJobInfoTable + // TODO_Delete_V23_1CreateSystemJobInfoTable creates the system.job_info table. + TODO_Delete_V23_1CreateSystemJobInfoTable - // V23_1RoleMembersTableHasIDColumns is the version where the role_members - // system table has columns for ids. - V23_1RoleMembersTableHasIDColumns + // TODO_Delete_V23_1RoleMembersTableHasIDColumns is the version where the + // role_members system table has columns for ids. + TODO_Delete_V23_1RoleMembersTableHasIDColumns - // V23_1RoleMembersIDColumnsBackfilled is the version where the columns for - // ids in the role_members system table have been backfilled. - V23_1RoleMembersIDColumnsBackfilled + // TODO_Delete_V23_1RoleMembersIDColumnsBackfilled is the version where the + // columns for ids in the role_members system table have been backfilled. + TODO_Delete_V23_1RoleMembersIDColumnsBackfilled - // V23_1ScheduledChangefeeds is the version where scheduled changefeeds are + // TODO_Delete_V23_1ScheduledChangefeeds is the version where scheduled changefeeds are // supported through `CREATE SCHEDULE FOR CHANGEFEED` statement. - V23_1ScheduledChangefeeds + TODO_Delete_V23_1ScheduledChangefeeds - // V23_1AddTypeColumnToJobsTable adds the nullable job_type + // TODO_Delete_V23_1AddTypeColumnToJobsTable adds the nullable job_type // column to the system.jobs table. - V23_1AddTypeColumnToJobsTable + TODO_Delete_V23_1AddTypeColumnToJobsTable - // V23_1BackfillTypeColumnInJobsTable backfills the job_type + // TODO_Delete_V23_1BackfillTypeColumnInJobsTable backfills the job_type // column in the system.jobs table. - V23_1BackfillTypeColumnInJobsTable + TODO_Delete_V23_1BackfillTypeColumnInJobsTable - // V23_1_AlterSystemStatementStatisticsAddIndexesUsage creates indexes usage virtual column - // based on (statistics->>'indexes') with inverted index on table system.statement_statistics. - V23_1_AlterSystemStatementStatisticsAddIndexesUsage + // TODO_Delete_V23_1_AlterSystemStatementStatisticsAddIndexesUsage creates + // indexes usage virtual column based on (statistics->>'indexes') with + // inverted index on table system.statement_statistics. + TODO_Delete_V23_1_AlterSystemStatementStatisticsAddIndexesUsage - // V23_1EnsurePebbleFormatSSTableValueBlocks upgrades the Pebble format major - // version to FormatSSTableValueBlocks, which supports writing sstables in a - // new format containing value blocks (sstable.TableFormatPebblev3). + // TODO_Delete_V23_1EnsurePebbleFormatSSTableValueBlocks upgrades the Pebble + // format major version to FormatSSTableValueBlocks, which supports writing + // sstables in a new format containing value blocks + // (sstable.TableFormatPebblev3). // // Only a Pebble version that has upgraded to FormatSSTableValueBlocks can // read sstables with format sstable.TableFormatPebblev3 -- i.e., it is // insufficient for the Pebble code to be recent enough. Hence, this is the // first step of a two-part migration, and we cannot do this in a single // step. With a single step migration, consider a cluster with nodes N1 and - // N2: once both are on V23_1EnsurePebbleFormatSSTableValueBlocks, N1 is notified - // of the change and upgrades the format major version in Pebble and starts - // constructing sstables (say for range snapshot ingestion) in this new - // format. This sstable could be sent to N2 before N2 has been notified - // about V23_1EnsurePebbleFormatSSTableValueBlocks, which will cause the sstable - // ingestion to fail. - V23_1EnsurePebbleFormatSSTableValueBlocks - - // V23_1EnablePebbleFormatSSTableValueBlocks is the second step of the - // two-part migration. When this starts we are sure that all Pebble + // N2: once both are on TODO_Delete_V23_1EnsurePebbleFormatSSTableValueBlocks, + // N1 is notified of the change and upgrades the format major version in + // Pebble and starts constructing sstables (say for range snapshot ingestion) + // in this new format. This sstable could be sent to N2 before N2 has been + // notified about TODO_Delete_V23_1EnsurePebbleFormatSSTableValueBlocks, which + // will cause the sstable ingestion to fail. + TODO_Delete_V23_1EnsurePebbleFormatSSTableValueBlocks + + // TODO_Delete_V23_1EnablePebbleFormatSSTableValueBlocks is the second step of + // the two-part migration. When this starts we are sure that all Pebble // instances in the cluster have already upgraded to format major version // FormatSSTableValueBlocks. - V23_1EnablePebbleFormatSSTableValueBlocks + TODO_Delete_V23_1EnablePebbleFormatSSTableValueBlocks - // V23_1AlterSystemSQLInstancesAddSqlAddr adds a sql_addr column to the - // system.sql_instances table. - V23_1AlterSystemSQLInstancesAddSQLAddr + // TODO_Delete_V23_1AlterSystemSQLInstancesAddSQLAddr adds a sql_addr column + // to the system.sql_instances table. + TODO_Delete_V23_1AlterSystemSQLInstancesAddSQLAddr - // V23_1_ChangefeedExpressionProductionReady marks changefeed expressions (transformation) - // as production ready. This gate functions as a signal to attempt to upgrade - // chagnefeeds created prior to this version. - V23_1_ChangefeedExpressionProductionReady + // TODO_Delete_V23_1_ChangefeedExpressionProductionReady marks changefeed + // expressions (transformation) as production ready. This gate functions as a + // signal to attempt to upgrade chagnefeeds created prior to this version. + TODO_Delete_V23_1_ChangefeedExpressionProductionReady // Permanent_V23_1KeyVisualizerTablesAndJobs adds the system tables that // support the key visualizer. Permanent_V23_1KeyVisualizerTablesAndJobs - // V23_1_KVDirectColumnarScans introduces the support of the "direct" + // TODO_Delete_V23_1_KVDirectColumnarScans introduces the support of the "direct" // columnar scans in the KV layer. - V23_1_KVDirectColumnarScans + TODO_Delete_V23_1_KVDirectColumnarScans - V23_1_DeleteDroppedFunctionDescriptors + TODO_Delete_V23_1_DeleteDroppedFunctionDescriptors // Permanent_V23_1_CreateJobsMetricsPollingJob creates the permanent job // responsible for polling the jobs table for metrics. Permanent_V23_1_CreateJobsMetricsPollingJob - // V23_1AllocatorCPUBalancing adds balancing CPU usage among stores using - // the allocator and store rebalancer. It assumes that at this version, - // stores now include their CPU in the StoreCapacity proto when gossiping. - V23_1AllocatorCPUBalancing + // TODO_Delete_V23_1AllocatorCPUBalancing adds balancing CPU usage among + // stores using the allocator and store rebalancer. It assumes that at this + // version, stores now include their CPU in the StoreCapacity proto when + // gossiping. + TODO_Delete_V23_1AllocatorCPUBalancing - // V23_1SystemPrivilegesTableHasUserIDColumn is the version where the + // TODO_Delete_V23_1SystemPrivilegesTableHasUserIDColumn is the version where the // user_id column has been added to the system.privileges table. - V23_1SystemPrivilegesTableHasUserIDColumn + TODO_Delete_V23_1SystemPrivilegesTableHasUserIDColumn - // V23_1SystemPrivilegesTableUserIDColumnBackfilled is the version where the - // user_id column in the system.privileges table has been backfilled. - V23_1SystemPrivilegesTableUserIDColumnBackfilled + // TODO_Delete_V23_1SystemPrivilegesTableUserIDColumnBackfilled is the version + // where the user_id column in the system.privileges table has been + // backfilled. + TODO_Delete_V23_1SystemPrivilegesTableUserIDColumnBackfilled - // V23_1WebSessionsTableHasUserIDColumn is the version where the + // TODO_Delete_V23_1WebSessionsTableHasUserIDColumn is the version where the // user_id column has been added to the system.web_sessions table. - V23_1WebSessionsTableHasUserIDColumn - - // V23_1WebSessionsTableUserIDColumnBackfilled is the version where the - // user_id column in the system.web_sessions table has been backfilled. - V23_1WebSessionsTableUserIDColumnBackfilled - - // V23_1_SchemaChangerDeprecatedIndexPredicates is the version where the - // declarative schema changer no longer produces scpb.SecondaryIndexPartial - // elements. - V23_1_SchemaChangerDeprecatedIndexPredicates - - // V23_1AlterSystemPrivilegesAddIndexOnPathAndUsername adds a covering secondary index to - // system.privileges, on the path and username columns. - V23_1AlterSystemPrivilegesAddIndexOnPathAndUsername - - // V23_1DatabaseRoleSettingsHasRoleIDColumn is the version where the role_id - // column has been added to the system.database_role_settings table. - V23_1DatabaseRoleSettingsHasRoleIDColumn + TODO_Delete_V23_1WebSessionsTableHasUserIDColumn - // V23_1DatabaseRoleSettingsRoleIDColumnBackfilled is the version where - // the role_id column in the system.database_role_settings table has been + // TODO_Delete_V23_1WebSessionsTableUserIDColumnBackfilled is the version + // where the user_id column in the system.web_sessions table has been // backfilled. - V23_1DatabaseRoleSettingsRoleIDColumnBackfilled - - // V23_1_MVCCRangeTombstonesUnconditionallyEnabled is a version gate after - // which Cockroach will always write MVCC Range Tombstones, regardless of the - // value of the storage.mvcc.range_tombstones.enabled cluster setting. Prior - // to this version, it was possible for a cluster to be writing MVCC Range - // Tombstones, but only if the cluster had been opted in manually, under a - // specific set of circumstances (i.e. appropriate 22.2.x version, Cockroach - // Cloud cluster, etc.). - V23_1_MVCCRangeTombstonesUnconditionallyEnabled - - // V23_1TenantCapabilities is the version where tenant capabilities can be - // set. - V23_1TenantCapabilities - - // V23_1DeprecateClusterVersionKey is the version where we no longer write - // cluster version keys to engines. - V23_1DeprecateClusterVersionKey - - // V23_1SetPebbleCreatorID is a version gate after which we set the Creator ID - // on Pebble stores that have shared storage configured. - V23_1SetPebbleCreatorID - - // V23_1_SystemRbrDualWrite indicates regional by row compatible system - // tables should write to the old and new indexes. See + TODO_Delete_V23_1WebSessionsTableUserIDColumnBackfilled + + // TODO_Delete_V23_1_SchemaChangerDeprecatedIndexPredicates is the version + // where the declarative schema changer no longer produces + // scpb.SecondaryIndexPartial elements. + TODO_Delete_V23_1_SchemaChangerDeprecatedIndexPredicates + + // TODO_Delete_V23_1AlterSystemPrivilegesAddIndexOnPathAndUsername adds a + // covering secondary index to system.privileges, on the path and username + // columns. + TODO_Delete_V23_1AlterSystemPrivilegesAddIndexOnPathAndUsername + + // TODO_Delete_V23_1DatabaseRoleSettingsHasRoleIDColumn is the version where + // the role_id column has been added to the system.database_role_settings + // table. + TODO_Delete_V23_1DatabaseRoleSettingsHasRoleIDColumn + + // TODO_Delete_V23_1DatabaseRoleSettingsRoleIDColumnBackfilled is the version + // where the role_id column in the system.database_role_settings table has + // been backfilled. + TODO_Delete_V23_1DatabaseRoleSettingsRoleIDColumnBackfilled + + // TODO_Delete_V23_1_MVCCRangeTombstonesUnconditionallyEnabled is a version + // gate after which Cockroach will always write MVCC Range Tombstones, + // regardless of the value of the storage.mvcc.range_tombstones.enabled + // cluster setting. Prior to this version, it was possible for a cluster to be + // writing MVCC Range Tombstones, but only if the cluster had been opted in + // manually, under a specific set of circumstances (i.e. appropriate 22.2.x + // version, Cockroach Cloud cluster, etc.). + TODO_Delete_V23_1_MVCCRangeTombstonesUnconditionallyEnabled + + // TODO_Delete_V23_1TenantCapabilities is the version where tenant + // capabilities can be set. + TODO_Delete_V23_1TenantCapabilities + + // TODO_Delete_V23_1DeprecateClusterVersionKey is the version where we no + // longer write cluster version keys to engines. + TODO_Delete_V23_1DeprecateClusterVersionKey + + // TODO_Delete_V23_1SetPebbleCreatorID is a version gate after which we set + // the Creator ID on Pebble stores that have shared storage configured. + TODO_Delete_V23_1SetPebbleCreatorID + + // TODO_Delete_V23_1_SystemRbrDualWrite indicates regional by row compatible + // system tables should write to the old and new indexes. See // system_rbr_indexes.go for more details. - V23_1_SystemRbrDualWrite + TODO_Delete_V23_1_SystemRbrDualWrite - // V23_1_SystemRbrReadNew indicates regional by row compatible system - // tables should read from the new index. See system_rbr_indexes.go for + // TODO_Delete_V23_1_SystemRbrReadNew indicates regional by row compatible + // system tables should read from the new index. See system_rbr_indexes.go for // more details. - V23_1_SystemRbrReadNew + TODO_Delete_V23_1_SystemRbrReadNew - // V23_1_SystemRbrReadNew indicates regional by row compatible system - // tables no longer need to write to the old index. See + // TODO_Delete_V23_1_SystemRbrSingleWrite indicates regional by row compatible + // system tables no longer need to write to the old index. See // system_rbr_indexes.go for more details. - V23_1_SystemRbrSingleWrite + TODO_Delete_V23_1_SystemRbrSingleWrite - // V23_1_SystemRbrCleanup is used to gate an upgrade job that cleans up old - // keys that are not regional by row compatible. - V23_1_SystemRbrCleanup + // TODO_Delete_V23_1_SystemRbrCleanup is used to gate an upgrade job that + // cleans up old keys that are not regional by row compatible. + TODO_Delete_V23_1_SystemRbrCleanup - // V23_1ExternalConnectionsTableHasOwnerIDColumn is the version where the - // owner_id column has been added to the system.external_connections table. - V23_1ExternalConnectionsTableHasOwnerIDColumn + // TODO_Delete_V23_1ExternalConnectionsTableHasOwnerIDColumn is the version + // where the owner_id column has been added to the system.external_connections + // table. + TODO_Delete_V23_1ExternalConnectionsTableHasOwnerIDColumn - // V23_1ExternalConnectionsTableOwnerIDColumnBackfilled is the version - // where the owner_id column in the system.external_connections table + // TODO_Delete_V23_1ExternalConnectionsTableOwnerIDColumnBackfilled is the + // version where the owner_id column in the system.external_connections table // has been backfilled. - V23_1ExternalConnectionsTableOwnerIDColumnBackfilled + TODO_Delete_V23_1ExternalConnectionsTableOwnerIDColumnBackfilled - // V23_1AllowNewSystemPrivileges is the version at which we allow the new - // MODIFYSQLCLUSTERSETTING abd VIEWJOB system privileges to be used. + // TODO_Delete_V23_1AllowNewSystemPrivileges is the version at which we allow + // the new MODIFYSQLCLUSTERSETTING abd VIEWJOB system privileges to be used. // Note: After v23.1 is released, we won't need to version gate these anymore, // since we've made mixed-version clusters tolerate new privileges. - V23_1AllowNewSystemPrivileges + TODO_Delete_V23_1AllowNewSystemPrivileges - // V23_1JobInfoTableIsBackfilled is a version gate after which the + // TODO_Delete_V23_1JobInfoTableIsBackfilled is a version gate after which the // system.job_info table has been backfilled with rows for the payload and // progress of each job in the system.jobs table. - V23_1JobInfoTableIsBackfilled + TODO_Delete_V23_1JobInfoTableIsBackfilled - // V23_1EnableFlushableIngest upgrades the Pebble format major version to - // FormatFlushableIngest, which enables use of flushable ingestion. - V23_1EnableFlushableIngest + // TODO_Delete_V23_1EnableFlushableIngest upgrades the Pebble format major + // version to FormatFlushableIngest, which enables use of flushable ingestion. + TODO_Delete_V23_1EnableFlushableIngest - // V23_1_UseDelRangeInGCJob enables the use of the DelRange operation in the - // GC job. Before it is enabled, the GC job uses ClearRange operations - // after the job waits out the GC TTL. After it has been enabled, the - // job instead issues DelRange operations at the beginning of the job - // and then waits for the data to be removed automatically before removing - // the descriptor and zone configurations. - V23_1_UseDelRangeInGCJob + // TODO_Delete_V23_1_UseDelRangeInGCJob enables the use of the DelRange + // operation in the GC job. Before it is enabled, the GC job uses ClearRange + // operations after the job waits out the GC TTL. After it has been enabled, + // the job instead issues DelRange operations at the beginning of the job and + // then waits for the data to be removed automatically before removing the + // descriptor and zone configurations. + TODO_Delete_V23_1_UseDelRangeInGCJob - // V23_1WaitedForDelRangeInGCJob corresponds to the migration which waits for - // the GC jobs to adopt the use of DelRange with tombstones. - V23_1WaitedForDelRangeInGCJob + // TODO_Delete_V23_1WaitedForDelRangeInGCJob corresponds to the migration + // which waits for the GC jobs to adopt the use of DelRange with tombstones. + TODO_Delete_V23_1WaitedForDelRangeInGCJob - // V23_1_TaskSystemTables is the version where the system tables + // TODO_Delete_V23_1_TaskSystemTables is the version where the system tables // task_payloads and tenant_tasks have been created. - V23_1_TaskSystemTables + TODO_Delete_V23_1_TaskSystemTables // Permanent_V23_1_CreateAutoConfigRunnerJob is the version where the auto // config runner persistent job has been created. Permanent_V23_1_CreateAutoConfigRunnerJob - // V23_1AddSQLStatsComputedIndexes is the version at which Cockroach adds new - // computed columns and indexes to the statement_statistics and - // transaction_statistics system tables. These columns optimize persisted SQL - // statistics queries for observability. - V23_1AddSQLStatsComputedIndexes + // TODO_Delete_V23_1AddSQLStatsComputedIndexes is the version at which + // Cockroach adds new computed columns and indexes to the statement_statistics + // and transaction_statistics system tables. These columns optimize persisted + // SQL statistics queries for observability. + TODO_Delete_V23_1AddSQLStatsComputedIndexes - // V23_1AddSystemActivityTables is the version at which Cockroach adds system - // tables statement_activity and transaction_activity. These tables will - // contain a subset of data from statement_statistics and transaction_statistics - // that are optimized for the console. - V23_1AddSystemActivityTables + // TODO_Delete_V23_1AddSystemActivityTables is the version at which Cockroach + // adds system tables statement_activity and transaction_activity. These + // tables will contain a subset of data from statement_statistics and + // transaction_statistics that are optimized for the console. + TODO_Delete_V23_1AddSystemActivityTables - // V23_1StopWritingPayloadAndProgressToSystemJobs is the version where the - // payload and progress columns are no longer written to system.jobs. - V23_1StopWritingPayloadAndProgressToSystemJobs + // TODO_Delete_V23_1StopWritingPayloadAndProgressToSystemJobs is the version + // where the payload and progress columns are no longer written to + // system.jobs. + TODO_Delete_V23_1StopWritingPayloadAndProgressToSystemJobs // Permanent_V23_1ChangeSQLStatsTTL is the version where the gc TTL was // updated to all SQL Stats tables. Permanent_V23_1ChangeSQLStatsTTL - // V23_1_TenantIDSequence is the version where system.tenant_id_seq - // was introduced. - V23_1_TenantIDSequence + // TODO_Delete_V23_1_TenantIDSequence is the version where + // system.tenant_id_seq was introduced. + TODO_Delete_V23_1_TenantIDSequence // Permanent_V23_1CreateSystemActivityUpdateJob is the version at which // Cockroach adds a job that periodically updates the statement_activity and @@ -599,67 +607,67 @@ var rawVersionsSingleton = keyedVersions{ Version: roachpb.Version{Major: 22, Minor: 1, Internal: 42}, }, { - Key: V22_2, + Key: TODO_Delete_V22_2, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 0}, }, { - Key: V23_1Start, + Key: TODO_Delete_V23_1Start, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 2}, }, { - Key: V23_1TenantNamesStateAndServiceMode, + Key: TODO_Delete_V23_1TenantNamesStateAndServiceMode, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 4}, }, { - Key: V23_1DescIDSequenceForSystemTenant, + Key: TODO_Delete_V23_1DescIDSequenceForSystemTenant, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 6}, }, { - Key: V23_1AddPartialStatisticsColumns, + Key: TODO_Delete_V23_1AddPartialStatisticsColumns, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 8}, }, { - Key: V23_1CreateSystemJobInfoTable, + Key: TODO_Delete_V23_1CreateSystemJobInfoTable, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 10}, }, { - Key: V23_1RoleMembersTableHasIDColumns, + Key: TODO_Delete_V23_1RoleMembersTableHasIDColumns, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 12}, }, { - Key: V23_1RoleMembersIDColumnsBackfilled, + Key: TODO_Delete_V23_1RoleMembersIDColumnsBackfilled, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 14}, }, { - Key: V23_1ScheduledChangefeeds, + Key: TODO_Delete_V23_1ScheduledChangefeeds, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 16}, }, { - Key: V23_1AddTypeColumnToJobsTable, + Key: TODO_Delete_V23_1AddTypeColumnToJobsTable, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 18}, }, { - Key: V23_1BackfillTypeColumnInJobsTable, + Key: TODO_Delete_V23_1BackfillTypeColumnInJobsTable, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 20}, }, { - Key: V23_1_AlterSystemStatementStatisticsAddIndexesUsage, + Key: TODO_Delete_V23_1_AlterSystemStatementStatisticsAddIndexesUsage, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 22}, }, { - Key: V23_1EnsurePebbleFormatSSTableValueBlocks, + Key: TODO_Delete_V23_1EnsurePebbleFormatSSTableValueBlocks, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 24}, }, { - Key: V23_1EnablePebbleFormatSSTableValueBlocks, + Key: TODO_Delete_V23_1EnablePebbleFormatSSTableValueBlocks, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 26}, }, { - Key: V23_1AlterSystemSQLInstancesAddSQLAddr, + Key: TODO_Delete_V23_1AlterSystemSQLInstancesAddSQLAddr, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 28}, }, { - Key: V23_1_ChangefeedExpressionProductionReady, + Key: TODO_Delete_V23_1_ChangefeedExpressionProductionReady, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 30}, }, { @@ -667,11 +675,11 @@ var rawVersionsSingleton = keyedVersions{ Version: roachpb.Version{Major: 22, Minor: 2, Internal: 32}, }, { - Key: V23_1_KVDirectColumnarScans, + Key: TODO_Delete_V23_1_KVDirectColumnarScans, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 34}, }, { - Key: V23_1_DeleteDroppedFunctionDescriptors, + Key: TODO_Delete_V23_1_DeleteDroppedFunctionDescriptors, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 36}, }, { @@ -679,103 +687,103 @@ var rawVersionsSingleton = keyedVersions{ Version: roachpb.Version{Major: 22, Minor: 2, Internal: 38}, }, { - Key: V23_1AllocatorCPUBalancing, + Key: TODO_Delete_V23_1AllocatorCPUBalancing, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 40}, }, { - Key: V23_1SystemPrivilegesTableHasUserIDColumn, + Key: TODO_Delete_V23_1SystemPrivilegesTableHasUserIDColumn, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 42}, }, { - Key: V23_1SystemPrivilegesTableUserIDColumnBackfilled, + Key: TODO_Delete_V23_1SystemPrivilegesTableUserIDColumnBackfilled, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 44}, }, { - Key: V23_1WebSessionsTableHasUserIDColumn, + Key: TODO_Delete_V23_1WebSessionsTableHasUserIDColumn, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 46}, }, { - Key: V23_1WebSessionsTableUserIDColumnBackfilled, + Key: TODO_Delete_V23_1WebSessionsTableUserIDColumnBackfilled, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 48}, }, { - Key: V23_1_SchemaChangerDeprecatedIndexPredicates, + Key: TODO_Delete_V23_1_SchemaChangerDeprecatedIndexPredicates, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 50}, }, { - Key: V23_1AlterSystemPrivilegesAddIndexOnPathAndUsername, + Key: TODO_Delete_V23_1AlterSystemPrivilegesAddIndexOnPathAndUsername, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 52}, }, { - Key: V23_1DatabaseRoleSettingsHasRoleIDColumn, + Key: TODO_Delete_V23_1DatabaseRoleSettingsHasRoleIDColumn, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 54}, }, { - Key: V23_1DatabaseRoleSettingsRoleIDColumnBackfilled, + Key: TODO_Delete_V23_1DatabaseRoleSettingsRoleIDColumnBackfilled, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 56}, }, { - Key: V23_1_MVCCRangeTombstonesUnconditionallyEnabled, + Key: TODO_Delete_V23_1_MVCCRangeTombstonesUnconditionallyEnabled, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 58}, }, { - Key: V23_1TenantCapabilities, + Key: TODO_Delete_V23_1TenantCapabilities, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 60}, }, { - Key: V23_1DeprecateClusterVersionKey, + Key: TODO_Delete_V23_1DeprecateClusterVersionKey, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 62}, }, { - Key: V23_1SetPebbleCreatorID, + Key: TODO_Delete_V23_1SetPebbleCreatorID, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 64}, }, { - Key: V23_1_SystemRbrDualWrite, + Key: TODO_Delete_V23_1_SystemRbrDualWrite, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 66}, }, { - Key: V23_1_SystemRbrReadNew, + Key: TODO_Delete_V23_1_SystemRbrReadNew, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 68}, }, { - Key: V23_1_SystemRbrSingleWrite, + Key: TODO_Delete_V23_1_SystemRbrSingleWrite, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 70}, }, { - Key: V23_1_SystemRbrCleanup, + Key: TODO_Delete_V23_1_SystemRbrCleanup, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 72}, }, { - Key: V23_1ExternalConnectionsTableHasOwnerIDColumn, + Key: TODO_Delete_V23_1ExternalConnectionsTableHasOwnerIDColumn, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 74}, }, { - Key: V23_1ExternalConnectionsTableOwnerIDColumnBackfilled, + Key: TODO_Delete_V23_1ExternalConnectionsTableOwnerIDColumnBackfilled, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 76}, }, { - Key: V23_1AllowNewSystemPrivileges, + Key: TODO_Delete_V23_1AllowNewSystemPrivileges, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 78}, }, { - Key: V23_1JobInfoTableIsBackfilled, + Key: TODO_Delete_V23_1JobInfoTableIsBackfilled, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 80}, }, { - Key: V23_1EnableFlushableIngest, + Key: TODO_Delete_V23_1EnableFlushableIngest, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 82}, }, { - Key: V23_1_UseDelRangeInGCJob, + Key: TODO_Delete_V23_1_UseDelRangeInGCJob, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 84}, }, { - Key: V23_1WaitedForDelRangeInGCJob, + Key: TODO_Delete_V23_1WaitedForDelRangeInGCJob, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 86}, }, { - Key: V23_1_TaskSystemTables, + Key: TODO_Delete_V23_1_TaskSystemTables, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 88}, }, { @@ -783,15 +791,15 @@ var rawVersionsSingleton = keyedVersions{ Version: roachpb.Version{Major: 22, Minor: 2, Internal: 90}, }, { - Key: V23_1AddSQLStatsComputedIndexes, + Key: TODO_Delete_V23_1AddSQLStatsComputedIndexes, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 92}, }, { - Key: V23_1AddSystemActivityTables, + Key: TODO_Delete_V23_1AddSystemActivityTables, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 94}, }, { - Key: V23_1StopWritingPayloadAndProgressToSystemJobs, + Key: TODO_Delete_V23_1StopWritingPayloadAndProgressToSystemJobs, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 96}, }, { @@ -799,7 +807,7 @@ var rawVersionsSingleton = keyedVersions{ Version: roachpb.Version{Major: 22, Minor: 2, Internal: 98}, }, { - Key: V23_1_TenantIDSequence, + Key: TODO_Delete_V23_1_TenantIDSequence, Version: roachpb.Version{Major: 22, Minor: 2, Internal: 100}, }, { @@ -906,7 +914,7 @@ var developmentBranch = !envutil.EnvOrDefaultBool("COCKROACH_TESTING_FORCE_RELEA const ( // finalVersion should be set on a release branch to the minted final cluster - // version key, e.g. to V22_2 on the release-22.2 branch once it is minted. + // version key, e.g. to TODO_Delete_V22_2 on the release-22.2 branch once it is minted. // Setting it has the effect of ensuring no versions are subsequently added. finalVersion = invalidVersionKey ) diff --git a/pkg/jobs/adopt.go b/pkg/jobs/adopt.go index d23dabd37589..7af146b25ade 100644 --- a/pkg/jobs/adopt.go +++ b/pkg/jobs/adopt.go @@ -261,7 +261,7 @@ func (r *Registry) resumeJob( ) (retErr error) { log.Infof(ctx, "job %d: resuming execution", jobID) - readPayloadAndProgressFromJobInfo := r.settings.Version.IsActive(ctx, clusterversion.V23_1JobInfoTableIsBackfilled) + readPayloadAndProgressFromJobInfo := r.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1JobInfoTableIsBackfilled) var resumeQuery string if readPayloadAndProgressFromJobInfo { resumeQuery = resumeQueryWithBackoff diff --git a/pkg/jobs/jobs.go b/pkg/jobs/jobs.go index 291ef0f556ac..1d934970f73b 100644 --- a/pkg/jobs/jobs.go +++ b/pkg/jobs/jobs.go @@ -731,7 +731,7 @@ func (j *Job) loadJobPayloadAndProgress( payload := &jobspb.Payload{} progress := &jobspb.Progress{} - if st.Version.IsActive(ctx, clusterversion.V23_1JobInfoTableIsBackfilled) { + if st.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1JobInfoTableIsBackfilled) { infoStorage := j.InfoStorage(txn) payloadBytes, exists, err := infoStorage.GetLegacyPayload(ctx) @@ -759,7 +759,7 @@ func (j *Job) loadJobPayloadAndProgress( return payload, progress, nil } - // If V23_1JobInfoTableIsBackfilled is not active we should read the payload + // If TODO_Delete_V23_1JobInfoTableIsBackfilled is not active we should read the payload // and progress from the system.jobs table. const ( queryNoSessionID = "SELECT payload, progress FROM system.jobs WHERE id = $1" diff --git a/pkg/jobs/registry.go b/pkg/jobs/registry.go index d4965109231e..7b23edfd762c 100644 --- a/pkg/jobs/registry.go +++ b/pkg/jobs/registry.go @@ -438,7 +438,7 @@ func createJobsInBatchWithTxn( // // TODO(adityamaru): Stop writing the payload and details to the system.jobs // table once we are outside the compatability window for 22.2. - if r.settings.Version.IsActive(ctx, clusterversion.V23_1CreateSystemJobInfoTable) { + if r.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1CreateSystemJobInfoTable) { if err := batchJobWriteToJobInfo(ctx, txn, jobs, modifiedMicros); err != nil { return nil, err } @@ -520,7 +520,7 @@ func batchJobInsertStmt( // TODO(adityamaru: Remove this once we are outside the compatability // window for 22.2. - if r.settings.Version.IsActive(ctx, clusterversion.V23_1StopWritingPayloadAndProgressToSystemJobs) { + if r.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1StopWritingPayloadAndProgressToSystemJobs) { columns = []string{`id`, `created`, `status`, `claim_session_id`, `claim_instance_id`, `job_type`} valueFns = map[string]func(*Job) (interface{}, error){ `id`: func(job *Job) (interface{}, error) { return job.ID(), nil }, @@ -539,7 +539,7 @@ func batchJobInsertStmt( // TODO(jayant): remove this version gate in 24.1 // To run the upgrade below, migration and schema change jobs will need to be // created using the old schema, which does not have the job_type column. - if !r.settings.Version.IsActive(ctx, clusterversion.V23_1AddTypeColumnToJobsTable) { + if !r.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1AddTypeColumnToJobsTable) { numColumns -= 1 } @@ -633,7 +633,7 @@ func (r *Registry) CreateJobWithTxn( cols := []string{"id", "created", "status", "payload", "progress", "claim_session_id", "claim_instance_id", "job_type"} vals := []interface{}{jobID, created, StatusRunning, payloadBytes, progressBytes, s.ID().UnsafeBytes(), r.ID(), jobType.String()} - if r.settings.Version.IsActive(ctx, clusterversion.V23_1StopWritingPayloadAndProgressToSystemJobs) { + if r.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1StopWritingPayloadAndProgressToSystemJobs) { cols = []string{"id", "created", "status", "claim_session_id", "claim_instance_id", "job_type"} vals = []interface{}{jobID, created, StatusRunning, s.ID().UnsafeBytes(), r.ID(), jobType.String()} } @@ -654,7 +654,7 @@ func (r *Registry) CreateJobWithTxn( // database in question is being dropped. override := sessiondata.RootUserSessionDataOverride override.Database = catconstants.SystemDatabaseName - hasJobTypeColumn := r.settings.Version.IsActive(ctx, clusterversion.V23_1AddTypeColumnToJobsTable) + hasJobTypeColumn := r.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1AddTypeColumnToJobsTable) if !hasJobTypeColumn { numCols -= 1 } @@ -674,7 +674,7 @@ func (r *Registry) CreateJobWithTxn( // // TODO(adityamaru): Stop writing the payload and details to the system.jobs // table once we are outside the compatability window for 22.2. - if r.settings.Version.IsActive(ctx, clusterversion.V23_1CreateSystemJobInfoTable) { + if r.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1CreateSystemJobInfoTable) { infoStorage := j.InfoStorage(txn) if err := infoStorage.WriteLegacyPayload(ctx, payloadBytes); err != nil { return err @@ -780,10 +780,10 @@ func (r *Registry) CreateAdoptableJobWithTxn( cols := []string{"id", "status", "payload", "progress", "created_by_type", "created_by_id", "job_type"} placeholders := []string{"$1", "$2", "$3", "$4", "$5", "$6", "$7"} values := []interface{}{jobID, StatusRunning, payloadBytes, progressBytes, createdByType, createdByID, typ} - if !r.settings.Version.IsActive(ctx, clusterversion.V23_1AddTypeColumnToJobsTable) { + if !r.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1AddTypeColumnToJobsTable) { nCols -= 1 } - if r.settings.Version.IsActive(ctx, clusterversion.V23_1StopWritingPayloadAndProgressToSystemJobs) { + if r.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1StopWritingPayloadAndProgressToSystemJobs) { cols = []string{"id", "status", "created_by_type", "created_by_id", "job_type"} placeholders = []string{"$1", "$2", "$3", "$4", "$5"} values = []interface{}{jobID, StatusRunning, createdByType, createdByID, typ} @@ -809,7 +809,7 @@ func (r *Registry) CreateAdoptableJobWithTxn( // // TODO(adityamaru): Stop writing the payload and details to the system.jobs // table once we are outside the compatability window for 22.2. - if r.settings.Version.IsActive(ctx, clusterversion.V23_1CreateSystemJobInfoTable) { + if r.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1CreateSystemJobInfoTable) { infoStorage := j.InfoStorage(txn) if err := infoStorage.WriteLegacyPayload(ctx, payloadBytes); err != nil { return err @@ -1279,7 +1279,7 @@ func (r *Registry) cleanupOldJobsPage( ctx context.Context, olderThan time.Time, minID jobspb.JobID, pageSize int, ) (done bool, maxID jobspb.JobID, retErr error) { var query string - if r.settings.Version.IsActive(ctx, clusterversion.V23_1JobInfoTableIsBackfilled) { + if r.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1JobInfoTableIsBackfilled) { query = expiredJobsQueryWithJobInfoTable } else { query = expiredJobsQuery diff --git a/pkg/jobs/update.go b/pkg/jobs/update.go index 55b61aaf2c8f..3ee7d720c9ab 100644 --- a/pkg/jobs/update.go +++ b/pkg/jobs/update.go @@ -220,7 +220,7 @@ func (u Updater) update(ctx context.Context, useReadLock bool, updateFn UpdateFn } } - if !u.j.registry.settings.Version.IsActive(ctx, clusterversion.V23_1StopWritingPayloadAndProgressToSystemJobs) { + if !u.j.registry.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1StopWritingPayloadAndProgressToSystemJobs) { if payloadBytes != nil { addSetter("payload", payloadBytes) } @@ -261,7 +261,7 @@ func (u Updater) update(ctx context.Context, useReadLock bool, updateFn UpdateFn // // TODO(adityamaru): Stop writing the payload and details to the system.jobs // table once we are outside the compatability window for 22.2. - if u.j.registry.settings.Version.IsActive(ctx, clusterversion.V23_1CreateSystemJobInfoTable) { + if u.j.registry.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1CreateSystemJobInfoTable) { infoStorage := j.InfoStorage(u.txn) if payloadBytes != nil { if err := infoStorage.WriteLegacyPayload(ctx, payloadBytes); err != nil { @@ -412,7 +412,7 @@ WITH ) var stmt string - if version.IsActive(ctx, clusterversion.V23_1JobInfoTableIsBackfilled) { + if version.IsActive(ctx, clusterversion.TODO_Delete_V23_1JobInfoTableIsBackfilled) { stmt = selectWithoutSession if hasSession { stmt = selectWithSession diff --git a/pkg/jobs/utils.go b/pkg/jobs/utils.go index 1e5f78a6cb33..e9479baad86e 100644 --- a/pkg/jobs/utils.go +++ b/pkg/jobs/utils.go @@ -36,7 +36,7 @@ func RunningJobExists( cv clusterversion.Handle, jobTypes ...jobspb.Type, ) (exists bool, retErr error) { - if !cv.IsActive(ctx, clusterversion.V23_1BackfillTypeColumnInJobsTable) { + if !cv.IsActive(ctx, clusterversion.TODO_Delete_V23_1BackfillTypeColumnInJobsTable) { return legacyRunningJobExists(ctx, ignoreJobID, txn, jobTypes...) } diff --git a/pkg/kv/kvserver/kvstorage/cluster_version.go b/pkg/kv/kvserver/kvstorage/cluster_version.go index c5a02b43546d..d53b83adb96c 100644 --- a/pkg/kv/kvserver/kvstorage/cluster_version.go +++ b/pkg/kv/kvserver/kvstorage/cluster_version.go @@ -29,7 +29,7 @@ import ( func WriteClusterVersion( ctx context.Context, eng storage.Engine, cv clusterversion.ClusterVersion, ) error { - if cv.Less(clusterversion.ByKey(clusterversion.V23_1DeprecateClusterVersionKey)) { + if cv.Less(clusterversion.ByKey(clusterversion.TODO_Delete_V23_1DeprecateClusterVersionKey)) { // We no longer read this key, but older versions still do. Continue writing // the key for interoperability. if err := storage.MVCCPutProto( diff --git a/pkg/kv/kvserver/loqrecovery/version.go b/pkg/kv/kvserver/loqrecovery/version.go index c82172586b7c..cc735f0094e1 100644 --- a/pkg/kv/kvserver/loqrecovery/version.go +++ b/pkg/kv/kvserver/loqrecovery/version.go @@ -60,7 +60,7 @@ restart. // legacyInfoFormatVersion is a version used internally when processing data // loaded from legacy format files which contained no version info or collected // from old clusters. -var legacyInfoFormatVersion = clusterversion.ByKey(clusterversion.V22_2) +var legacyInfoFormatVersion = clusterversion.ByKey(clusterversion.TODO_Delete_V22_2) // checkVersionAllowedByBinary checks if binary could handle data version. Data // could be either loaded from files or received from cluster. diff --git a/pkg/kv/kvserver/rebalance_objective.go b/pkg/kv/kvserver/rebalance_objective.go index 5b6a11a9f5df..e83c9c8edcf0 100644 --- a/pkg/kv/kvserver/rebalance_objective.go +++ b/pkg/kv/kvserver/rebalance_objective.go @@ -270,7 +270,7 @@ func ResolveLBRebalancingObjective( // stores will not be populating additional fields in their StoreCapacity, // in such cases we cannot balance another objective since the data may not // exist. Fall back to QPS balancing. - if !st.Version.IsActive(ctx, clusterversion.V23_1AllocatorCPUBalancing) { + if !st.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1AllocatorCPUBalancing) { log.Infof(ctx, "version doesn't support cpu objective, reverting to qps balance objective") return LBRebalancingQueries } diff --git a/pkg/kv/kvserver/rebalance_objective_test.go b/pkg/kv/kvserver/rebalance_objective_test.go index b48d57360d1f..fcc7c84670d3 100644 --- a/pkg/kv/kvserver/rebalance_objective_test.go +++ b/pkg/kv/kvserver/rebalance_objective_test.go @@ -130,8 +130,8 @@ func TestLoadBasedRebalancingObjective(t *testing.T) { t.Run("older version only supports QPS", func(t *testing.T) { st := cluster.MakeTestingClusterSettingsWithVersions( - clusterversion.ByKey(clusterversion.V22_2), - clusterversion.ByKey(clusterversion.V22_2), true) + clusterversion.ByKey(clusterversion.TODO_Delete_V22_2), + clusterversion.ByKey(clusterversion.TODO_Delete_V22_2), true) gossipStoreDescProvider := testMakeProviderNotifier(allPositiveCPUMap) LoadBasedRebalancingObjective.Override(ctx, &st.SV, int64(LBRebalancingQueries)) require.Equal(t, @@ -245,9 +245,9 @@ func TestRebalanceObjectiveManager(t *testing.T) { t.Run("store cpu unsupported version", func(t *testing.T) { st := cluster.MakeTestingClusterSettingsWithVersions( clusterversion.TestingBinaryVersion, - clusterversion.ByKey(clusterversion.V22_2), false) + clusterversion.ByKey(clusterversion.TODO_Delete_V22_2), false) require.NoError(t, st.Version.SetActiveVersion(ctx, clusterversion.ClusterVersion{ - Version: clusterversion.ByKey(clusterversion.V22_2), + Version: clusterversion.ByKey(clusterversion.TODO_Delete_V22_2), })) LoadBasedRebalancingObjective.Override(ctx, &st.SV, int64(LBRebalancingCPU)) providerNotifier := testMakeProviderNotifier(allPositiveCPUMap) @@ -268,7 +268,7 @@ func TestRebalanceObjectiveManager(t *testing.T) { // allowing CPU objective. This should trigger a callback and also // update the objective to CPU. require.NoError(t, st.Version.SetActiveVersion(ctx, clusterversion.ClusterVersion{ - Version: clusterversion.ByKey(clusterversion.V23_1AllocatorCPUBalancing), + Version: clusterversion.ByKey(clusterversion.TODO_Delete_V23_1AllocatorCPUBalancing), })) require.Equal(t, LBRebalancingCPU, manager.Objective()) require.Len(t, *callbacks, 1) diff --git a/pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer/authorizer.go b/pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer/authorizer.go index b2ba1caddd34..3536668c4260 100644 --- a/pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer/authorizer.go +++ b/pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer/authorizer.go @@ -356,7 +356,7 @@ func (a *Authorizer) getMode( // We prioritize what the cluster setting tells us. selectedMode = authorizerModeType(authorizerMode.Get(&a.settings.SV)) if selectedMode == authorizerModeOn { - if !a.settings.Version.IsActive(ctx, clusterversion.V23_1TenantCapabilities) { + if !a.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1TenantCapabilities) { // If the cluster hasn't been upgraded to v23.1 with // capabilities yet, the capabilities won't be ready for use. In // that case, fall back to the previous behavior. diff --git a/pkg/server/authserver/authentication.go b/pkg/server/authserver/authentication.go index 4428af559f77..92e7558e453c 100644 --- a/pkg/server/authserver/authentication.go +++ b/pkg/server/authserver/authentication.go @@ -467,7 +467,7 @@ func (s *authenticationServer) NewAuthSession( ) (int64, []byte, error) { st := s.sqlServer.ExecutorConfig().Settings webSessionsTableHasUserIDCol := st.Version.IsActive(ctx, - clusterversion.V23_1WebSessionsTableHasUserIDColumn) + clusterversion.TODO_Delete_V23_1WebSessionsTableHasUserIDColumn) secret, hashedSecret, err := CreateAuthSecret() if err != nil { diff --git a/pkg/server/combined_statement_stats.go b/pkg/server/combined_statement_stats.go index 0d19d2060fde..dde747acd327 100644 --- a/pkg/server/combined_statement_stats.go +++ b/pkg/server/combined_statement_stats.go @@ -115,13 +115,13 @@ func getCombinedStatementStats( // Used for mixed cluster version, where we need to use the persisted view with _v22_2. tableSuffix := "" - if !settings.Version.IsActive(ctx, clusterversion.V23_1AddSQLStatsComputedIndexes) { + if !settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1AddSQLStatsComputedIndexes) { tableSuffix = "_v22_2" } // Check if the activity tables contains all the data required for the selected period from the request. activityHasAllData := false reqStartTime := getTimeFromSeconds(req.Start) - if settings.Version.IsActive(ctx, clusterversion.V23_1AddSystemActivityTables) { + if settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1AddSystemActivityTables) { sort := serverpb.StatsSortOptions_SERVICE_LAT if req.FetchMode != nil { sort = req.FetchMode.Sort diff --git a/pkg/server/server_controller_orchestration.go b/pkg/server/server_controller_orchestration.go index de213e62dc3f..8d1c3a870b9d 100644 --- a/pkg/server/server_controller_orchestration.go +++ b/pkg/server/server_controller_orchestration.go @@ -185,7 +185,7 @@ func (c *serverController) createServerEntryLocked( func (c *serverController) getExpectedRunningTenants( ctx context.Context, ie isql.Executor, ) (tenantNames []roachpb.TenantName, resErr error) { - if !c.st.Version.IsActive(ctx, clusterversion.V23_1TenantNamesStateAndServiceMode) { + if !c.st.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1TenantNamesStateAndServiceMode) { // Cluster not yet upgraded - we know there is no secondary tenant // with a name yet. return []roachpb.TenantName{catconstants.SystemTenantName}, nil diff --git a/pkg/server/settingswatcher/version_guard_test.go b/pkg/server/settingswatcher/version_guard_test.go index 3c4d72de3cc6..00e662e3db1b 100644 --- a/pkg/server/settingswatcher/version_guard_test.go +++ b/pkg/server/settingswatcher/version_guard_test.go @@ -44,8 +44,8 @@ func TestVersionGuard(t *testing.T) { checkVersions map[clusterversion.Key]bool } - initialVersion := clusterversion.V22_2 - startVersion := clusterversion.V23_1Start + initialVersion := clusterversion.TODO_Delete_V22_2 + startVersion := clusterversion.TODO_Delete_V23_1Start maxVersion := clusterversion.V23_1 tests := []testCase{ @@ -109,9 +109,9 @@ func TestVersionGuard(t *testing.T) { storageVersion: &initialVersion, settingsVersion: maxVersion, checkVersions: map[clusterversion.Key]bool{ - initialVersion: true, - maxVersion: true, - clusterversion.V23_1Start: true, + initialVersion: true, + maxVersion: true, + clusterversion.TODO_Delete_V23_1Start: true, }, }, } diff --git a/pkg/server/statement_details.go b/pkg/server/statement_details.go index a7f9e155b246..6705ec3ee78c 100644 --- a/pkg/server/statement_details.go +++ b/pkg/server/statement_details.go @@ -68,13 +68,13 @@ func getStatementDetails( // Used for mixed cluster version, where we need to use the persisted view with _v22_2. tableSuffix := "" - if !settings.Version.IsActive(ctx, clusterversion.V23_1AddSQLStatsComputedIndexes) { + if !settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1AddSQLStatsComputedIndexes) { tableSuffix = "_v22_2" } // Check if the activity tables have data within the selected period. activityHasData := false reqStartTime := getTimeFromSeconds(req.Start) - if settings.Version.IsActive(ctx, clusterversion.V23_1AddSystemActivityTables) { + if settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1AddSystemActivityTables) { activityHasData, err = activityTablesHaveFullData( ctx, ie, diff --git a/pkg/server/testserver.go b/pkg/server/testserver.go index b9493dbcd23a..7f7eadca2832 100644 --- a/pkg/server/testserver.go +++ b/pkg/server/testserver.go @@ -1566,7 +1566,7 @@ func (ts *testServer) StartTenant( // TODO(ssd): We do not set this capability in // StartSharedProcessTenant. shouldGrantNodelocalCap := ts.params.ExternalIODir != "" - canGrantNodelocalCap := ts.ClusterSettings().Version.IsActive(ctx, clusterversion.V23_1TenantCapabilities) + canGrantNodelocalCap := ts.ClusterSettings().Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1TenantCapabilities) if canGrantNodelocalCap && shouldGrantNodelocalCap { _, err := ie.Exec(ctx, "testserver-alter-tenant-cap", nil, "ALTER TENANT [$1] GRANT CAPABILITY can_use_nodelocal_storage", params.TenantID.ToUint64()) diff --git a/pkg/sql/alter_role.go b/pkg/sql/alter_role.go index 05a56a32844d..e0e6933af164 100644 --- a/pkg/sql/alter_role.go +++ b/pkg/sql/alter_role.go @@ -429,7 +429,7 @@ func (p *planner) processSetOrResetClause( func (n *alterRoleSetNode) startExec(params runParams) error { databaseRoleSettingsHasRoleIDCol := params.p.ExecCfg().Settings.Version.IsActive(params.ctx, - clusterversion.V23_1DatabaseRoleSettingsHasRoleIDColumn) + clusterversion.TODO_Delete_V23_1DatabaseRoleSettingsHasRoleIDColumn) var opName string if n.isRole { diff --git a/pkg/sql/alter_table.go b/pkg/sql/alter_table.go index 9035f70373e7..f52809ef91f3 100644 --- a/pkg/sql/alter_table.go +++ b/pkg/sql/alter_table.go @@ -1351,7 +1351,7 @@ func insertJSONStatistic( name = s.Name } - if !settings.Version.IsActive(ctx, clusterversion.V23_1AddPartialStatisticsColumns) { + if !settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1AddPartialStatisticsColumns) { if s.PartialPredicate != "" { return pgerror.Newf(pgcode.ObjectNotInPrerequisiteState, "statistic for columns %v with collection time %s to insert is partial but cluster version is below 23.1", s.Columns, s.CreatedAt) diff --git a/pkg/sql/catalog/descidgen/generate_id.go b/pkg/sql/catalog/descidgen/generate_id.go index f043226b80d9..8589cfcce842 100644 --- a/pkg/sql/catalog/descidgen/generate_id.go +++ b/pkg/sql/catalog/descidgen/generate_id.go @@ -69,7 +69,7 @@ func (g *generator) run(ctx context.Context, inc int64) (catid.DescID, error) { // descriptor ID generator is unavailable due to migrating the system tenant // counter from keys.LegacyDescIDGenerator to system.descriptor_id_seq. // -// TODO(postamar): remove along with clusterversion.V23_1DescIDSequenceForSystemTenant +// TODO(postamar): remove along with clusterversion.TODO_Delete_V23_1DescIDSequenceForSystemTenant var ErrDescIDSequenceMigrationInProgress = errors.New( "descriptor ID generator unavailable, migration in progress, retry later", ) @@ -109,11 +109,11 @@ func key( ) (roachpb.Key, error) { key := codec.SequenceKey(keys.DescIDSequenceID) if cv := settings.Version; codec.ForSystemTenant() && - !cv.IsActive(ctx, clusterversion.V23_1DescIDSequenceForSystemTenant) { + !cv.IsActive(ctx, clusterversion.TODO_Delete_V23_1DescIDSequenceForSystemTenant) { // At this point, the system tenant may still be using a legacy non-SQL key, // or may be in the process of undergoing the migration away from it, in // which case descriptor ID generation is made unavailable. - if cv.IsActive(ctx, clusterversion.V23_1DescIDSequenceForSystemTenant-1) { + if cv.IsActive(ctx, clusterversion.TODO_Delete_V23_1DescIDSequenceForSystemTenant-1) { return nil, ErrDescIDSequenceMigrationInProgress } key = keys.LegacyDescIDGenerator diff --git a/pkg/sql/catalog/lease/kv_writer.go b/pkg/sql/catalog/lease/kv_writer.go index 6dd64b8bd06c..b2e9e1868c71 100644 --- a/pkg/sql/catalog/lease/kv_writer.go +++ b/pkg/sql/catalog/lease/kv_writer.go @@ -61,18 +61,18 @@ func leaseTableWithID(id descpb.ID) catalog.TableDescriptor { func (w *kvWriter) versionGuard( ctx context.Context, txn *kv.Txn, ) (settingswatcher.VersionGuard, error) { - return w.settingsWatcher.MakeVersionGuard(ctx, txn, clusterversion.V23_1_SystemRbrCleanup) + return w.settingsWatcher.MakeVersionGuard(ctx, txn, clusterversion.TODO_Delete_V23_1_SystemRbrCleanup) } func (w *kvWriter) insertLease(ctx context.Context, txn *kv.Txn, l leaseFields) error { return w.do(ctx, txn, l, func(guard settingswatcher.VersionGuard, b *kv.Batch) error { - if guard.IsActive(clusterversion.V23_1_SystemRbrDualWrite) { + if guard.IsActive(clusterversion.TODO_Delete_V23_1_SystemRbrDualWrite) { err := w.newWriter.Insert(ctx, b, false /*kvTrace */, leaseAsRbrDatum(l)...) if err != nil { return err } } - if !guard.IsActive(clusterversion.V23_1_SystemRbrSingleWrite) { + if !guard.IsActive(clusterversion.TODO_Delete_V23_1_SystemRbrSingleWrite) { err := w.oldWriter.Insert(ctx, b, false /*kvTrace */, leaseAsRbtDatum(l)...) if err != nil { return err @@ -84,13 +84,13 @@ func (w *kvWriter) insertLease(ctx context.Context, txn *kv.Txn, l leaseFields) func (w *kvWriter) deleteLease(ctx context.Context, txn *kv.Txn, l leaseFields) error { return w.do(ctx, txn, l, func(guard settingswatcher.VersionGuard, b *kv.Batch) error { - if guard.IsActive(clusterversion.V23_1_SystemRbrDualWrite) { + if guard.IsActive(clusterversion.TODO_Delete_V23_1_SystemRbrDualWrite) { err := w.newWriter.Delete(ctx, b, false /*kvTrace */, leaseAsRbrDatum(l)...) if err != nil { return err } } - if !guard.IsActive(clusterversion.V23_1_SystemRbrSingleWrite) { + if !guard.IsActive(clusterversion.TODO_Delete_V23_1_SystemRbrSingleWrite) { err := w.oldWriter.Delete(ctx, b, false /*kvTrace */, leaseAsRbtDatum(l)...) if err != nil { return err diff --git a/pkg/sql/catalog/lease/lease.go b/pkg/sql/catalog/lease/lease.go index 1d1f5683d309..3f251e954128 100644 --- a/pkg/sql/catalog/lease/lease.go +++ b/pkg/sql/catalog/lease/lease.go @@ -1364,7 +1364,7 @@ SELECT "descID", version, expiration FROM system.public.lease AS OF SYSTEM TIME ` ) query := queryWithRegion - if !m.settings.Version.IsActive(ctx, clusterversion.V23_1_SystemRbrReadNew) { + if !m.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1_SystemRbrReadNew) { query = queryWithoutRegion } sqlQuery := fmt.Sprintf(query, timeThreshold, instanceID) diff --git a/pkg/sql/catalog/tabledesc/validate_test.go b/pkg/sql/catalog/tabledesc/validate_test.go index 21c4d3c808a7..5c73206a979f 100644 --- a/pkg/sql/catalog/tabledesc/validate_test.go +++ b/pkg/sql/catalog/tabledesc/validate_test.go @@ -2794,7 +2794,7 @@ func TestValidateTableDesc(t *testing.T) { DurationExpr: catpb.Expression("INTERVAL '2 minutes'"), }, }, - version: clusterversion.V22_2}, + version: clusterversion.TODO_Delete_V22_2}, {err: `unknown mutation ID 123 associated with job ID 456`, desc: descpb.TableDescriptor{ ID: 2, diff --git a/pkg/sql/colexec/colbuilder/execplan.go b/pkg/sql/colexec/colbuilder/execplan.go index 6950ed24a57d..f9fbd3f49c4f 100644 --- a/pkg/sql/colexec/colbuilder/execplan.go +++ b/pkg/sql/colexec/colbuilder/execplan.go @@ -835,7 +835,7 @@ func NewColOperator( var resultTypes []*types.T if flowCtx.EvalCtx.SessionData().DirectColumnarScansEnabled { canUseDirectScan := func() bool { - if !flowCtx.EvalCtx.Settings.Version.IsActive(ctx, clusterversion.V23_1_KVDirectColumnarScans) { + if !flowCtx.EvalCtx.Settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1_KVDirectColumnarScans) { return false } // We currently don't use the direct scans if TraceKV is diff --git a/pkg/sql/crdb_internal.go b/pkg/sql/crdb_internal.go index bcaa71ad9783..7236f1787913 100644 --- a/pkg/sql/crdb_internal.go +++ b/pkg/sql/crdb_internal.go @@ -939,7 +939,7 @@ WITH LEFT JOIN latestprogress AS progress ON j.id = progress.job_id ` - // Before clusterversion.V23_1JobInfoTableIsBackfilled, the system.job_info + // Before clusterversion.TODO_Delete_V23_1JobInfoTableIsBackfilled, the system.job_info // table has not been fully populated with the payload and progress of jobs in // the cluster. systemJobsBaseQuery = ` @@ -949,7 +949,7 @@ WITH FROM system.jobs` // TODO(jayant): remove the version gate in 24.1 - // Before clusterversion.V23_1BackfillTypeColumnInJobsTable, the system.jobs table did not have + // Before clusterversion.TODO_Delete_V23_1BackfillTypeColumnInJobsTable, the system.jobs table did not have // a fully populated job_type column, so we must project it manually // with crdb_internal.job_payload_type. oldSystemJobsBaseQuery = ` @@ -976,12 +976,12 @@ func getInternalSystemJobsQueryFromClusterVersion( ctx context.Context, version clusterversion.Handle, predicate systemJobsPredicate, ) string { var baseQuery string - if version.IsActive(ctx, clusterversion.V23_1JobInfoTableIsBackfilled) { + if version.IsActive(ctx, clusterversion.TODO_Delete_V23_1JobInfoTableIsBackfilled) { baseQuery = SystemJobsAndJobInfoBaseQuery if predicate == jobID { baseQuery = systemJobsAndJobInfoBaseQueryWithIDPredicate } - } else if version.IsActive(ctx, clusterversion.V23_1BackfillTypeColumnInJobsTable) { + } else if version.IsActive(ctx, clusterversion.TODO_Delete_V23_1BackfillTypeColumnInJobsTable) { baseQuery = systemJobsBaseQuery } else { baseQuery = oldSystemJobsBaseQuery @@ -1137,7 +1137,7 @@ const ( ) func getCRDBInternalJobsTableTypeFilter(ctx context.Context, version clusterversion.Handle) string { - if !version.IsActive(ctx, clusterversion.V23_1BackfillTypeColumnInJobsTable) { + if !version.IsActive(ctx, clusterversion.TODO_Delete_V23_1BackfillTypeColumnInJobsTable) { return oldJobsTypeFilter } return jobsTypeFilter diff --git a/pkg/sql/create_external_connection.go b/pkg/sql/create_external_connection.go index 1cf3cab3619d..61df39f47da7 100644 --- a/pkg/sql/create_external_connection.go +++ b/pkg/sql/create_external_connection.go @@ -130,7 +130,7 @@ func (p *planner) createExternalConnection( ex.SetConnectionDetails(*exConn.ConnectionProto()) ex.SetConnectionType(exConn.ConnectionType()) ex.SetOwner(p.User()) - if p.ExecCfg().Settings.Version.IsActive(params.ctx, clusterversion.V23_1ExternalConnectionsTableHasOwnerIDColumn) { + if p.ExecCfg().Settings.Version.IsActive(params.ctx, clusterversion.TODO_Delete_V23_1ExternalConnectionsTableHasOwnerIDColumn) { row, err := txn.QueryRowEx(params.ctx, `get-user-id`, txn.KV(), sessiondata.NodeUserSessionDataOverride, `SELECT user_id FROM system.users WHERE username = $1`, diff --git a/pkg/sql/delegate/show_changefeed_jobs.go b/pkg/sql/delegate/show_changefeed_jobs.go index 7a1f91aad205..d0b18cdf774b 100644 --- a/pkg/sql/delegate/show_changefeed_jobs.go +++ b/pkg/sql/delegate/show_changefeed_jobs.go @@ -78,7 +78,7 @@ FROM INNER JOIN payload ON id = job_id` ) - use23_1 := d.evalCtx.Settings.Version.IsActive(d.ctx, clusterversion.V23_1BackfillTypeColumnInJobsTable) + use23_1 := d.evalCtx.Settings.Version.IsActive(d.ctx, clusterversion.TODO_Delete_V23_1BackfillTypeColumnInJobsTable) var selectClause string if use23_1 { diff --git a/pkg/sql/gcjob/gcjobnotifier/notifier.go b/pkg/sql/gcjob/gcjobnotifier/notifier.go index 30a3590220b8..635a78cdb1e1 100644 --- a/pkg/sql/gcjob/gcjobnotifier/notifier.go +++ b/pkg/sql/gcjob/gcjobnotifier/notifier.go @@ -147,7 +147,7 @@ func (n *Notifier) run(_ context.Context) { systemConfigUpdateCh, _ := n.provider.RegisterSystemConfigChannel() var haveNotified syncutil.AtomicBool versionSettingChanged := make(chan struct{}, 1) - versionBeingWaited := clusterversion.ByKey(clusterversion.V23_1_UseDelRangeInGCJob) + versionBeingWaited := clusterversion.ByKey(clusterversion.TODO_Delete_V23_1_UseDelRangeInGCJob) n.settings.Version.SetOnChange(func(ctx context.Context, newVersion clusterversion.ClusterVersion) { if !haveNotified.Get() && versionBeingWaited.LessEq(newVersion.Version) && diff --git a/pkg/sql/grant_revoke_system.go b/pkg/sql/grant_revoke_system.go index 88c617f95013..33b6d0a3221a 100644 --- a/pkg/sql/grant_revoke_system.go +++ b/pkg/sql/grant_revoke_system.go @@ -39,10 +39,10 @@ func (n *changeNonDescriptorBackedPrivilegesNode) ReadingOwnWrites() {} func (n *changeNonDescriptorBackedPrivilegesNode) startExec(params runParams) error { privilegesTableHasUserIDCol := params.p.ExecCfg().Settings.Version.IsActive(params.ctx, - clusterversion.V23_1SystemPrivilegesTableHasUserIDColumn) + clusterversion.TODO_Delete_V23_1SystemPrivilegesTableHasUserIDColumn) if !params.p.ExecCfg().Settings.Version.IsActive( params.ctx, - clusterversion.V23_1AllowNewSystemPrivileges, + clusterversion.TODO_Delete_V23_1AllowNewSystemPrivileges, ) { if n.desiredprivs.Contains(privilege.MODIFYSQLCLUSTERSETTING) { return pgerror.New(pgcode.FeatureNotSupported, "upgrade must be finalized before using MODIFYSQLCLUSTERSETTING system privilege") diff --git a/pkg/sql/grant_role.go b/pkg/sql/grant_role.go index a8f66048545c..78d3a6024594 100644 --- a/pkg/sql/grant_role.go +++ b/pkg/sql/grant_role.go @@ -176,7 +176,7 @@ func (p *planner) GrantRoleNode(ctx context.Context, n *tree.GrantRole) (*GrantR func (n *GrantRoleNode) startExec(params runParams) error { var rowsAffected int - roleMembersHasIDs := params.p.ExecCfg().Settings.Version.IsActive(params.ctx, clusterversion.V23_1RoleMembersTableHasIDColumns) + roleMembersHasIDs := params.p.ExecCfg().Settings.Version.IsActive(params.ctx, clusterversion.TODO_Delete_V23_1RoleMembersTableHasIDColumns) // Add memberships. Existing memberships are allowed. // If admin option is false, we do not remove it from existing memberships. diff --git a/pkg/sql/schema_changer.go b/pkg/sql/schema_changer.go index 05139ff89a27..6fbd04be4769 100644 --- a/pkg/sql/schema_changer.go +++ b/pkg/sql/schema_changer.go @@ -1369,7 +1369,7 @@ func (sc *SchemaChanger) createIndexGCJobWithDropTime( gcJobRecord := CreateGCJobRecord( jobDesc, sc.job.Payload().UsernameProto.Decode(), indexGCDetails, - !sc.settings.Version.IsActive(ctx, clusterversion.V23_1_UseDelRangeInGCJob), + !sc.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1_UseDelRangeInGCJob), ) jobID := sc.jobRegistry.MakeJobID() if _, err := sc.jobRegistry.CreateJobWithTxn(ctx, gcJobRecord, jobID, txn); err != nil { diff --git a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table.go b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table.go index c9db64baf1b9..cf24290e7bef 100644 --- a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table.go +++ b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table.go @@ -111,7 +111,7 @@ func alterTableAlterPrimaryKeyChecks( mode sessiondatapb.NewSchemaChangerMode, activeVersion clusterversion.ClusterVersion, ) bool { - // Start supporting ALTER PRIMARY KEY (in general with fallback cases) from V22_2. + // Start supporting ALTER PRIMARY KEY (in general with fallback cases) from TODO_Delete_V22_2. if !isV222Active(t, mode, activeVersion) { return false } @@ -127,7 +127,7 @@ func alterTableAddConstraintChecks( mode sessiondatapb.NewSchemaChangerMode, activeVersion clusterversion.ClusterVersion, ) bool { - // Start supporting ADD PRIMARY KEY from V22_2. + // Start supporting ADD PRIMARY KEY from TODO_Delete_V22_2. if d, ok := t.ConstraintDef.(*tree.UniqueConstraintTableDef); ok && d.PrimaryKey && t.ValidationBehavior == tree.ValidationDefault { return isV222Active(t, mode, activeVersion) } diff --git a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/process.go b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/process.go index 33e0c7b5beac..03b5f143e56c 100644 --- a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/process.go +++ b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/process.go @@ -206,7 +206,7 @@ func getDeclarativeSchemaChangerModeForStmt( } var isV222Active = func(_ tree.NodeFormatter, _ sessiondatapb.NewSchemaChangerMode, activeVersion clusterversion.ClusterVersion) bool { - return activeVersion.IsActive(clusterversion.V22_2) + return activeVersion.IsActive(clusterversion.TODO_Delete_V22_2) } var isV231Active = func(_ tree.NodeFormatter, _ sessiondatapb.NewSchemaChangerMode, activeVersion clusterversion.ClusterVersion) bool { diff --git a/pkg/sql/schemachanger/scdecomp/decomp.go b/pkg/sql/schemachanger/scdecomp/decomp.go index f7449b955519..ca13c9b2ceb0 100644 --- a/pkg/sql/schemachanger/scdecomp/decomp.go +++ b/pkg/sql/schemachanger/scdecomp/decomp.go @@ -641,7 +641,7 @@ func (w *walkCtx) walkIndex(tbl catalog.TableDescriptor, idx catalog.Index) { if idx.IsPartial() { pp, err := w.newExpression(idx.GetPredicate()) onErrPanic(err) - if w.clusterVersion.IsActive(clusterversion.V23_1_SchemaChangerDeprecatedIndexPredicates) { + if w.clusterVersion.IsActive(clusterversion.TODO_Delete_V23_1_SchemaChangerDeprecatedIndexPredicates) { sec.EmbeddedExpr = pp } else { w.ev(scpb.Status_PUBLIC, &scpb.SecondaryIndexPartial{ diff --git a/pkg/sql/schemachanger/scpb/migration.go b/pkg/sql/schemachanger/scpb/migration.go index 0419d3828e76..92b5929e4792 100644 --- a/pkg/sql/schemachanger/scpb/migration.go +++ b/pkg/sql/schemachanger/scpb/migration.go @@ -20,7 +20,7 @@ import ( // HasDeprecatedElements returns if the target contains any element marked // for deprecation. func HasDeprecatedElements(version clusterversion.ClusterVersion, target Target) bool { - if version.IsActive(clusterversion.V23_1_SchemaChangerDeprecatedIndexPredicates) && + if version.IsActive(clusterversion.TODO_Delete_V23_1_SchemaChangerDeprecatedIndexPredicates) && target.GetSecondaryIndexPartial() != nil { return true } diff --git a/pkg/sql/schemachanger/scplan/internal/rules/release_22_2/assertions_test.go b/pkg/sql/schemachanger/scplan/internal/rules/release_22_2/assertions_test.go index dc1f6318f69c..811d737ff5f3 100644 --- a/pkg/sql/schemachanger/scplan/internal/rules/release_22_2/assertions_test.go +++ b/pkg/sql/schemachanger/scplan/internal/rules/release_22_2/assertions_test.go @@ -38,7 +38,7 @@ func TestRuleAssertions(t *testing.T) { checkIsIndexDependent, checkIsConstraintDependent, } { - version := clusterversion.ClusterVersion{Version: clusterversion.ByKey(clusterversion.V22_2)} + version := clusterversion.ClusterVersion{Version: clusterversion.ByKey(clusterversion.TODO_Delete_V22_2)} var fni interface{} = fn fullName := runtime.FuncForPC(reflect.ValueOf(fni).Pointer()).Name() nameParts := strings.Split(fullName, "rules.") diff --git a/pkg/sql/schemachanger/scplan/internal/rules/release_22_2/helpers.go b/pkg/sql/schemachanger/scplan/internal/rules/release_22_2/helpers.go index bb8f04cc5531..537ff53d17ec 100644 --- a/pkg/sql/schemachanger/scplan/internal/rules/release_22_2/helpers.go +++ b/pkg/sql/schemachanger/scplan/internal/rules/release_22_2/helpers.go @@ -25,7 +25,7 @@ const ( ) // rulesVersionKey version of elements used by this rule set. -var rulesVersionKey = clusterversion.V22_2 +var rulesVersionKey = clusterversion.TODO_Delete_V22_2 // descriptorIsNotBeingDropped creates a clause which leads to the outer clause // failing to unify if the passed element is part of a descriptor and diff --git a/pkg/sql/schemachanger/scplan/plan.go b/pkg/sql/schemachanger/scplan/plan.go index 2b2df443875b..d0acd8a905d4 100644 --- a/pkg/sql/schemachanger/scplan/plan.go +++ b/pkg/sql/schemachanger/scplan/plan.go @@ -161,7 +161,7 @@ type rulesForRelease struct { var rulesForReleases = []rulesForRelease{ {activeVersion: clusterversion.V23_2, rulesRegistry: current.GetRegistry()}, {activeVersion: clusterversion.V23_1, rulesRegistry: release_23_1.GetRegistry()}, - {activeVersion: clusterversion.V22_2, rulesRegistry: release_22_2.GetRegistry()}, + {activeVersion: clusterversion.TODO_Delete_V22_2, rulesRegistry: release_22_2.GetRegistry()}, } // minVersionForRules the oldest version supported by the rules. diff --git a/pkg/sql/schemachanger/screl/scalars.go b/pkg/sql/schemachanger/screl/scalars.go index c058559de29d..be2e9c348907 100644 --- a/pkg/sql/schemachanger/screl/scalars.go +++ b/pkg/sql/schemachanger/screl/scalars.go @@ -122,7 +122,7 @@ func VersionSupportsElementUse(el scpb.Element, version clusterversion.ClusterVe // These elements need v22.1 so they can be used without checking any version gates. return true case *scpb.IndexColumn, *scpb.EnumTypeValue, *scpb.TableZoneConfig: - return version.IsActive(clusterversion.V22_2) + return version.IsActive(clusterversion.TODO_Delete_V22_2) case *scpb.DatabaseData, *scpb.TableData, *scpb.IndexData, *scpb.TablePartitioning, *scpb.Function, *scpb.FunctionName, *scpb.FunctionVolatility, *scpb.FunctionLeakProof, *scpb.FunctionNullInputBehavior, *scpb.FunctionBody, *scpb.FunctionParamDefaultExpression, @@ -142,7 +142,7 @@ func VersionSupportsElementUse(el scpb.Element, version clusterversion.ClusterVe func MaxElementVersion(el scpb.Element) (version clusterversion.Key, exists bool) { switch el.(type) { case *scpb.SecondaryIndexPartial: - return clusterversion.V23_1_SchemaChangerDeprecatedIndexPredicates, true /* exists */ + return clusterversion.TODO_Delete_V23_1_SchemaChangerDeprecatedIndexPredicates, true /* exists */ } return version, false /* exists */ } diff --git a/pkg/sql/show_stats.go b/pkg/sql/show_stats.go index fd7323159e06..396891ab43f6 100644 --- a/pkg/sql/show_stats.go +++ b/pkg/sql/show_stats.go @@ -98,7 +98,7 @@ func (p *planner) ShowTableStats(ctx context.Context, n *tree.ShowTableStats) (p if err := p.CheckAnyPrivilege(ctx, desc); err != nil { return nil, err } - partialStatsVerActive := p.ExtendedEvalContext().ExecCfg.Settings.Version.IsActive(ctx, clusterversion.V23_1AddPartialStatisticsColumns) + partialStatsVerActive := p.ExtendedEvalContext().ExecCfg.Settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1AddPartialStatisticsColumns) columns := showTableStatsColumnsPartialStatisticsVer if !partialStatsVerActive { columns = showTableStatsColumns diff --git a/pkg/sql/sqlinstance/instancestorage/instancecache.go b/pkg/sql/sqlinstance/instancestorage/instancecache.go index 0e739b8315bc..818de305ecb1 100644 --- a/pkg/sql/sqlinstance/instancestorage/instancecache.go +++ b/pkg/sql/sqlinstance/instancestorage/instancecache.go @@ -240,7 +240,7 @@ func onVersionReached( // newMigrationCache uses the oldCache and newCache functions to construct // instanceCaches. The cache registers a hook with the setting and switches // from the old implementation to the new implementation when the version -// changes to V23_1_SystemRbrReadNew. +// changes to TODO_Delete_V23_1_SystemRbrReadNew. func newMigrationCache( ctx context.Context, stopper *stop.Stopper, @@ -257,7 +257,7 @@ func newMigrationCache( oldReady <- err } - onVersionReached(ctx, settings, clusterversion.V23_1_SystemRbrReadNew, func() { + onVersionReached(ctx, settings, clusterversion.TODO_Delete_V23_1_SystemRbrReadNew, func() { // Once the read new version gate is reached, close the original // cache in order to clean up resources and prevent reading updates // when the original index is deleted. @@ -265,7 +265,7 @@ func newMigrationCache( }) // If the old cache is already stale, do not return it. - if settings.Version.IsActive(ctx, clusterversion.V23_1_SystemRbrReadNew) { + if settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1_SystemRbrReadNew) { return } @@ -288,7 +288,7 @@ func newMigrationCache( // newReady is signaled when the new cache finishes starting. newReady := make(chan error, 1) newCacheCtx := logtags.AddTags(context.Background(), logtags.FromContext(ctx)) - onVersionReached(ctx, settings, clusterversion.V23_1_SystemRbrReadNew, func() { + onVersionReached(ctx, settings, clusterversion.TODO_Delete_V23_1_SystemRbrReadNew, func() { err := stopper.RunAsyncTask(newCacheCtx, "start-new-cache-implementation", func(ctx context.Context) { // Rebuild the cancel signal since the goroutine has a background // context. diff --git a/pkg/sql/sqlinstance/instancestorage/instancestorage.go b/pkg/sql/sqlinstance/instancestorage/instancestorage.go index a01d78c6c262..b1f6b725f993 100644 --- a/pkg/sql/sqlinstance/instancestorage/instancestorage.go +++ b/pkg/sql/sqlinstance/instancestorage/instancestorage.go @@ -375,7 +375,7 @@ func (s *Storage) createInstanceRow( func (s *Storage) newInstanceCache( ctx context.Context, stopper *stop.Stopper, ) (instanceCache, error) { - if !s.settings.Version.IsActive(ctx, clusterversion.V23_1_SystemRbrReadNew) { + if !s.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1_SystemRbrReadNew) { oldCache := func(ctx context.Context) (instanceCache, error) { return newRangeFeedCache(ctx, s.oldRowCodec, s.clock, s.f) } @@ -639,7 +639,7 @@ func (s *Storage) RunInstanceIDReclaimLoop( } func (s *Storage) getReadCodec(version *settingswatcher.VersionGuard) *rowCodec { - if version.IsActive(clusterversion.V23_1_SystemRbrReadNew) { + if version.IsActive(clusterversion.TODO_Delete_V23_1_SystemRbrReadNew) { return &s.newRowCodec } return &s.oldRowCodec @@ -647,11 +647,11 @@ func (s *Storage) getReadCodec(version *settingswatcher.VersionGuard) *rowCodec func (s *Storage) getDualWriteCodec(version *settingswatcher.VersionGuard) *rowCodec { switch { - case version.IsActive(clusterversion.V23_1_SystemRbrSingleWrite): + case version.IsActive(clusterversion.TODO_Delete_V23_1_SystemRbrSingleWrite): return nil - case version.IsActive(clusterversion.V23_1_SystemRbrReadNew): + case version.IsActive(clusterversion.TODO_Delete_V23_1_SystemRbrReadNew): return &s.oldRowCodec - case version.IsActive(clusterversion.V23_1_SystemRbrDualWrite): + case version.IsActive(clusterversion.TODO_Delete_V23_1_SystemRbrDualWrite): return &s.newRowCodec default: return nil @@ -661,7 +661,7 @@ func (s *Storage) getDualWriteCodec(version *settingswatcher.VersionGuard) *rowC func (s *Storage) versionGuard( ctx context.Context, txn *kv.Txn, ) (settingswatcher.VersionGuard, error) { - return s.settingsWatch.MakeVersionGuard(ctx, txn, clusterversion.V23_1_SystemRbrCleanup) + return s.settingsWatch.MakeVersionGuard(ctx, txn, clusterversion.TODO_Delete_V23_1_SystemRbrCleanup) } // generateAvailableInstanceRows allocates available instance IDs, and store diff --git a/pkg/sql/sqlliveness/slstorage/sessionid.go b/pkg/sql/sqlliveness/slstorage/sessionid.go index bdf5b01ddec0..d56be21641db 100644 --- a/pkg/sql/sqlliveness/slstorage/sessionid.go +++ b/pkg/sql/sqlliveness/slstorage/sessionid.go @@ -70,9 +70,9 @@ func MakeSessionID(region []byte, id uuid.UUID) (sqlliveness.SessionID, error) { func UnsafeDecodeSessionID(session sqlliveness.SessionID) (region, id []byte, err error) { b := session.UnsafeBytes() if len(b) == legacyLen { - // TODO(jeffswenson): once the V23_1_SystemRbrCleanup version gate is + // TODO(jeffswenson): once the TODO_Delete_V23_1_SystemRbrCleanup version gate is // deleted, replace this branch with a validation error. - _ = clusterversion.V23_1_SystemRbrCleanup + _ = clusterversion.TODO_Delete_V23_1_SystemRbrCleanup // Legacy format of SessionID. Treat the session as if it belongs to // region enum.One. This may crop up briefly if a session was created diff --git a/pkg/sql/sqlliveness/slstorage/slstorage.go b/pkg/sql/sqlliveness/slstorage/slstorage.go index 7dc989edfa69..4a64982bd1ee 100644 --- a/pkg/sql/sqlliveness/slstorage/slstorage.go +++ b/pkg/sql/sqlliveness/slstorage/slstorage.go @@ -247,7 +247,7 @@ func (s *Storage) isAlive( } func (s *Storage) getReadCodec(version *settingswatcher.VersionGuard) keyCodec { - if version.IsActive(clusterversion.V23_1_SystemRbrReadNew) { + if version.IsActive(clusterversion.TODO_Delete_V23_1_SystemRbrReadNew) { return s.newKeyCodec } return s.oldKeyCodec @@ -255,11 +255,11 @@ func (s *Storage) getReadCodec(version *settingswatcher.VersionGuard) keyCodec { func (s *Storage) getDualWriteCodec(version *settingswatcher.VersionGuard) keyCodec { switch { - case version.IsActive(clusterversion.V23_1_SystemRbrSingleWrite): + case version.IsActive(clusterversion.TODO_Delete_V23_1_SystemRbrSingleWrite): return nil - case version.IsActive(clusterversion.V23_1_SystemRbrReadNew): + case version.IsActive(clusterversion.TODO_Delete_V23_1_SystemRbrReadNew): return s.oldKeyCodec - case version.IsActive(clusterversion.V23_1_SystemRbrDualWrite): + case version.IsActive(clusterversion.TODO_Delete_V23_1_SystemRbrDualWrite): return s.newKeyCodec default: return nil @@ -269,7 +269,7 @@ func (s *Storage) getDualWriteCodec(version *settingswatcher.VersionGuard) keyCo func (s *Storage) versionGuard( ctx context.Context, txn *kv.Txn, ) (settingswatcher.VersionGuard, error) { - return s.settingsWatcher.MakeVersionGuard(ctx, txn, clusterversion.V23_1_SystemRbrCleanup) + return s.settingsWatcher.MakeVersionGuard(ctx, txn, clusterversion.TODO_Delete_V23_1_SystemRbrCleanup) } // This function will launch a singleflight goroutine for the session which diff --git a/pkg/sql/sqlliveness/slstorage/slstorage_internal_test.go b/pkg/sql/sqlliveness/slstorage/slstorage_internal_test.go index 21d3d51b4606..3c79b1e659b0 100644 --- a/pkg/sql/sqlliveness/slstorage/slstorage_internal_test.go +++ b/pkg/sql/sqlliveness/slstorage/slstorage_internal_test.go @@ -64,31 +64,31 @@ func TestGetEncoder(t *testing.T) { }, { name: "v22_2", - version: clusterversion.V22_2, + version: clusterversion.TODO_Delete_V22_2, readCodec: isRbt, dualCodec: isNil, }, { - name: "V23_1_SystemRbrDualWrite", - version: clusterversion.V23_1_SystemRbrDualWrite, + name: "TODO_Delete_V23_1_SystemRbrDualWrite", + version: clusterversion.TODO_Delete_V23_1_SystemRbrDualWrite, readCodec: isRbt, dualCodec: isRbr, }, { - name: "V23_1_SystemRbrReadNew", - version: clusterversion.V23_1_SystemRbrReadNew, + name: "TODO_Delete_V23_1_SystemRbrReadNew", + version: clusterversion.TODO_Delete_V23_1_SystemRbrReadNew, readCodec: isRbr, dualCodec: isRbt, }, { - name: "V23_1_SystemRbrSingleWrite", - version: clusterversion.V23_1_SystemRbrSingleWrite, + name: "TODO_Delete_V23_1_SystemRbrSingleWrite", + version: clusterversion.TODO_Delete_V23_1_SystemRbrSingleWrite, readCodec: isRbr, dualCodec: isNil, }, { - name: "V23_1_SystemRbrCleanup", - version: clusterversion.V23_1_SystemRbrCleanup, + name: "TODO_Delete_V23_1_SystemRbrCleanup", + version: clusterversion.TODO_Delete_V23_1_SystemRbrCleanup, readCodec: isRbr, dualCodec: isNil, }, diff --git a/pkg/sql/stats/new_stat.go b/pkg/sql/stats/new_stat.go index adc4aa21cfba..b65a395d6730 100644 --- a/pkg/sql/stats/new_stat.go +++ b/pkg/sql/stats/new_stat.go @@ -88,7 +88,7 @@ func InsertNewStat( } } - if !settings.Version.IsActive(ctx, clusterversion.V23_1AddPartialStatisticsColumns) { + if !settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1AddPartialStatisticsColumns) { if partialPredicate != "" { return errors.New("unable to insert new partial statistic as cluster version is from before V23.1.") } diff --git a/pkg/sql/stats/stats_cache.go b/pkg/sql/stats/stats_cache.go index 37f81290d473..6cf8986b6d55 100644 --- a/pkg/sql/stats/stats_cache.go +++ b/pkg/sql/stats/stats_cache.go @@ -765,7 +765,7 @@ func (tsp *TableStatisticProto) IsAuto() bool { func (sc *TableStatisticsCache) getTableStatsFromDB( ctx context.Context, tableID descpb.ID, forecast bool, ) ([]*TableStatistic, error) { - partialStatisticsColumnsVerActive := sc.settings.Version.IsActive(ctx, clusterversion.V23_1AddPartialStatisticsColumns) + partialStatisticsColumnsVerActive := sc.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1AddPartialStatisticsColumns) var partialPredicateCol string var fullStatisticIDCol string if partialStatisticsColumnsVerActive { diff --git a/pkg/sql/tenant_accessors.go b/pkg/sql/tenant_accessors.go index 8b817288eef6..108d988f6e64 100644 --- a/pkg/sql/tenant_accessors.go +++ b/pkg/sql/tenant_accessors.go @@ -65,7 +65,7 @@ func GetAllNonDropTenantIDs( ) ([]roachpb.TenantID, error) { q := `SELECT id FROM system.tenants WHERE data_state != $1 ORDER BY id` var arg interface{} = mtinfopb.DataStateDrop - if !settings.Version.IsActive(ctx, clusterversion.V23_1TenantNamesStateAndServiceMode) { + if !settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1TenantNamesStateAndServiceMode) { q = `SELECT id FROM system.tenants WHERE crdb_internal.pb_to_json('cockroach.multitenant.ProtoInfo', info, true)->>'deprecatedDataState' != $1 ORDER BY id` arg = "DROP" @@ -94,9 +94,9 @@ WHERE crdb_internal.pb_to_json('cockroach.multitenant.ProtoInfo', info, true)->> func GetTenantRecordByName( ctx context.Context, settings *cluster.Settings, txn isql.Txn, tenantName roachpb.TenantName, ) (*mtinfopb.TenantInfo, error) { - if !settings.Version.IsActive(ctx, clusterversion.V23_1TenantNamesStateAndServiceMode) { + if !settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1TenantNamesStateAndServiceMode) { return nil, errors.Newf("tenant names not supported until upgrade to %s or higher is completed", - clusterversion.V23_1TenantNamesStateAndServiceMode.String()) + clusterversion.TODO_Delete_V23_1TenantNamesStateAndServiceMode.String()) } row, err := txn.QueryRowEx( ctx, "get-tenant", txn.KV(), sessiondata.NodeUserSessionDataOverride, @@ -116,7 +116,7 @@ func GetTenantRecordByID( ctx context.Context, txn isql.Txn, tenID roachpb.TenantID, settings *cluster.Settings, ) (*mtinfopb.TenantInfo, error) { q := `SELECT id, info, name, data_state, service_mode FROM system.tenants WHERE id = $1` - if !settings.Version.IsActive(ctx, clusterversion.V23_1TenantNamesStateAndServiceMode) { + if !settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1TenantNamesStateAndServiceMode) { q = `SELECT id, info, NULL, NULL, NULL FROM system.tenants WHERE id = $1` } row, err := txn.QueryRowEx( diff --git a/pkg/sql/tenant_capability.go b/pkg/sql/tenant_capability.go index 4dd6c09f7b60..27b617ab6ce3 100644 --- a/pkg/sql/tenant_capability.go +++ b/pkg/sql/tenant_capability.go @@ -46,7 +46,7 @@ func (p *planner) AlterTenantCapability( if err := rejectIfCantCoordinateMultiTenancy(p.execCfg.Codec, "grant/revoke capabilities to", p.execCfg.Settings); err != nil { return nil, err } - if !p.ExecCfg().Settings.Version.IsActive(ctx, clusterversion.V23_1TenantCapabilities) { + if !p.ExecCfg().Settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1TenantCapabilities) { return nil, pgerror.Newf(pgcode.ObjectNotInPrerequisiteState, "cannot alter tenant capabilities until version is finalized") } diff --git a/pkg/sql/tenant_creation.go b/pkg/sql/tenant_creation.go index 41407dae55f9..b251fab85dc5 100644 --- a/pkg/sql/tenant_creation.go +++ b/pkg/sql/tenant_creation.go @@ -271,7 +271,7 @@ func CreateTenantRecord( return roachpb.TenantID{}, err } if info.Name != "" { - if !settings.Version.IsActive(ctx, clusterversion.V23_1TenantNamesStateAndServiceMode) { + if !settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1TenantNamesStateAndServiceMode) { return roachpb.TenantID{}, pgerror.Newf(pgcode.FeatureNotSupported, "cannot use tenant names") } if err := info.Name.IsValid(); err != nil { @@ -299,7 +299,7 @@ func CreateTenantRecord( // Update the ID sequence if available. // We only keep the latest ID. - if settings.Version.IsActive(ctx, clusterversion.V23_1_TenantIDSequence) { + if settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1_TenantIDSequence) { if err := updateTenantIDSequence(ctx, txn, info.ID); err != nil { return roachpb.TenantID{}, err } @@ -307,7 +307,7 @@ func CreateTenantRecord( if info.Name == "" { // No name: generate one if we are at the appropriate version. - if settings.Version.IsActive(ctx, clusterversion.V23_1TenantNamesStateAndServiceMode) { + if settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1TenantNamesStateAndServiceMode) { info.Name = roachpb.TenantName(fmt.Sprintf("cluster-%d", info.ID)) } } @@ -339,7 +339,7 @@ func CreateTenantRecord( // Insert into the tenant table and detect collisions. var name tree.Datum if info.Name != "" { - if !settings.Version.IsActive(ctx, clusterversion.V23_1TenantNamesStateAndServiceMode) { + if !settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1TenantNamesStateAndServiceMode) { return roachpb.TenantID{}, pgerror.Newf(pgcode.FeatureNotSupported, "cannot use tenant names") } name = tree.NewDString(string(info.Name)) @@ -349,7 +349,7 @@ func CreateTenantRecord( query := `INSERT INTO system.tenants (id, active, info, name, data_state, service_mode) VALUES ($1, $2, $3, $4, $5, $6)` args := []interface{}{tenID, active, infoBytes, name, info.DataState, info.ServiceMode} - if !settings.Version.IsActive(ctx, clusterversion.V23_1TenantNamesStateAndServiceMode) { + if !settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1TenantNamesStateAndServiceMode) { // Ensure the insert can succeed if the upgrade is not finalized yet. query = `INSERT INTO system.tenants (id, active, info) VALUES ($1, $2, $3)` args = args[:3] @@ -607,7 +607,7 @@ HAVING ($1 = '' OR NOT EXISTS (SELECT 1 FROM system.tenants t WHERE t.name = $1) // Is the sequence available yet? var lastIDFromSequence int64 - if settings.Version.IsActive(ctx, clusterversion.V23_1_TenantIDSequence) { + if settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1_TenantIDSequence) { lastIDFromSequence, err = getTenantIDSequenceValue(ctx, txn) if err != nil { return roachpb.TenantID{}, err diff --git a/pkg/sql/tenant_deletion.go b/pkg/sql/tenant_deletion.go index 016985f1feba..a987816c2cbb 100644 --- a/pkg/sql/tenant_deletion.go +++ b/pkg/sql/tenant_deletion.go @@ -86,7 +86,7 @@ func dropTenantInternal( return err } - if settings.Version.IsActive(ctx, clusterversion.V23_1TenantNamesStateAndServiceMode) { + if settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1TenantNamesStateAndServiceMode) { if ignoreServiceMode { // Compatibility with CC serverless use of // crdb_internal.destroy_tenant(): we want to disable the check diff --git a/pkg/sql/tenant_update.go b/pkg/sql/tenant_update.go index cc710d500b86..fc645ec9fb76 100644 --- a/pkg/sql/tenant_update.go +++ b/pkg/sql/tenant_update.go @@ -76,7 +76,7 @@ func UpdateTenantRecord( SET active = $2, info = $3, name = $4, data_state = $5, service_mode = $6 WHERE id = $1` args := []interface{}{info.ID, active, infoBytes, name, info.DataState, info.ServiceMode} - if !settings.Version.IsActive(ctx, clusterversion.V23_1TenantNamesStateAndServiceMode) { + if !settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1TenantNamesStateAndServiceMode) { // Ensure the update can succeed if the upgrade is not finalized yet. query = `UPDATE system.tenants SET active = $2, info = $3 WHERE id = $1` args = args[:3] @@ -106,7 +106,7 @@ func validateTenantInfo( return errors.Newf("tenant in data state %v with dropped name %q", info.DataState, info.DroppedName) } - if settings.Version.IsActive(ctx, clusterversion.V23_1TenantNamesStateAndServiceMode) { + if settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1TenantNamesStateAndServiceMode) { // We can only check the service mode after upgrading to a version // that supports the service mode column. if info.ServiceMode != mtinfopb.ServiceModeNone && info.DataState != mtinfopb.DataStateReady { @@ -262,7 +262,7 @@ func (p *planner) renameTenant( return pgerror.WithCandidateCode(err, pgcode.Syntax) } - if !p.EvalContext().Settings.Version.IsActive(ctx, clusterversion.V23_1TenantNamesStateAndServiceMode) { + if !p.EvalContext().Settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1TenantNamesStateAndServiceMode) { return pgerror.Newf(pgcode.FeatureNotSupported, "cannot use tenant names") } } diff --git a/pkg/sql/tests/kv_test.go b/pkg/sql/tests/kv_test.go index 822306b3015e..4058f809c5ee 100644 --- a/pkg/sql/tests/kv_test.go +++ b/pkg/sql/tests/kv_test.go @@ -69,7 +69,7 @@ func newKVNativeAndEngine(tb testing.TB, valueBlocks bool) (*kvNative, storage.E st := cluster.MakeTestingClusterSettings() version := st.Version.ActiveVersionOrEmpty(context.Background()) if version.Less(clusterversion.ByKey( - clusterversion.V23_1EnablePebbleFormatSSTableValueBlocks)) { + clusterversion.TODO_Delete_V23_1EnablePebbleFormatSSTableValueBlocks)) { tb.Fatalf("cluster version is too old %s", version.String()) } storage.ValueBlocksEnabled.Override(context.Background(), &st.SV, valueBlocks) diff --git a/pkg/storage/mvcc.go b/pkg/storage/mvcc.go index 0ce5dfbcb353..5ab902bf0c46 100644 --- a/pkg/storage/mvcc.go +++ b/pkg/storage/mvcc.go @@ -88,7 +88,7 @@ var minWALSyncInterval = settings.RegisterDurationSetting( // above note on jobs also applies in this case. // // If the version of the cluster is at or beyond the version -// V23_1_MVCCRangeTombstonesUnconditionallyEnabled, the feature is +// TODO_Delete_V23_1_MVCCRangeTombstonesUnconditionallyEnabled, the feature is // unconditionally enabled. var MVCCRangeTombstonesEnabledInMixedClusters = settings.RegisterBoolSetting( settings.SystemVisible, @@ -100,10 +100,10 @@ var MVCCRangeTombstonesEnabledInMixedClusters = settings.RegisterBoolSetting( // range tombstones, by setting DeleteRangeRequest.UseRangeTombstone. It // requires the storage.mvcc.range_tombstones.enabled cluster setting to be // enabled, OR the cluster version is at or beyond the -// V23_1_MVCCRangeTombstonesUnconditionallyEnabled version (i.e. in 23.1, the +// TODO_Delete_V23_1_MVCCRangeTombstonesUnconditionallyEnabled version (i.e. in 23.1, the // feature is unconditionally enabled). func CanUseMVCCRangeTombstones(ctx context.Context, st *cluster.Settings) bool { - return st.Version.IsActive(ctx, clusterversion.V23_1_MVCCRangeTombstonesUnconditionallyEnabled) || + return st.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1_MVCCRangeTombstonesUnconditionallyEnabled) || MVCCRangeTombstonesEnabledInMixedClusters.Get(&st.SV) } diff --git a/pkg/storage/pebble.go b/pkg/storage/pebble.go index 885787c48bf4..212d42dd6e2c 100644 --- a/pkg/storage/pebble.go +++ b/pkg/storage/pebble.go @@ -137,7 +137,7 @@ var UseExciseForSnapshots = settings.RegisterBoolSetting( // entry is replayed. // // The value of this cluster setting is ignored if the cluster version is not -// yet at least V23_1EnableFlushableIngest. +// yet at least TODO_Delete_V23_1EnableFlushableIngest. // // This cluster setting will be removed in a subsequent release. var IngestAsFlushable = settings.RegisterBoolSetting( @@ -903,7 +903,7 @@ func (p *Pebble) SetStoreID(ctx context.Context, storeID int32) error { // Note that SetCreatorID only does something if remote storage is configured // in the pebble options. The version gate protects against accidentally // setting the creator ID on an older store. - if storeID != base.TempStoreID && p.minVersion.AtLeast(clusterversion.ByKey(clusterversion.V23_1SetPebbleCreatorID)) { + if storeID != base.TempStoreID && p.minVersion.AtLeast(clusterversion.ByKey(clusterversion.TODO_Delete_V23_1SetPebbleCreatorID)) { if err := p.db.SetCreatorID(uint64(storeID)); err != nil { return err } @@ -1060,7 +1060,7 @@ func NewPebble(ctx context.Context, cfg PebbleConfig) (p *Pebble, err error) { opts.Experimental.EnableValueBlocks = func() bool { version := cfg.Settings.Version.ActiveVersionOrEmpty(logCtx) return !version.Less(clusterversion.ByKey( - clusterversion.V23_1EnablePebbleFormatSSTableValueBlocks)) && + clusterversion.TODO_Delete_V23_1EnablePebbleFormatSSTableValueBlocks)) && ValueBlocksEnabled.Get(&cfg.Settings.SV) } opts.Experimental.DisableIngestAsFlushable = func() bool { @@ -2329,7 +2329,7 @@ func (p *Pebble) SetMinVersion(version roachpb.Version) error { } // Set the shared object creator ID if the version is high enough. See SetStoreID(). - if version.AtLeast(clusterversion.ByKey(clusterversion.V23_1SetPebbleCreatorID)) { + if version.AtLeast(clusterversion.ByKey(clusterversion.TODO_Delete_V23_1SetPebbleCreatorID)) { if storeID := p.storeIDPebbleLog.Get(); storeID != 0 && storeID != base.TempStoreID { if err := p.db.SetCreatorID(uint64(storeID)); err != nil { return err @@ -2366,13 +2366,13 @@ func (p *Pebble) SetMinVersion(version roachpb.Version) error { case !version.Less(clusterversion.ByKey(clusterversion.V23_2_PebbleFormatDeleteSizedAndObsolete)): formatVers = pebble.FormatDeleteSizedAndObsolete - case !version.Less(clusterversion.ByKey(clusterversion.V23_1EnableFlushableIngest)): + case !version.Less(clusterversion.ByKey(clusterversion.TODO_Delete_V23_1EnableFlushableIngest)): formatVers = pebble.FormatFlushableIngest - case !version.Less(clusterversion.ByKey(clusterversion.V23_1EnsurePebbleFormatSSTableValueBlocks)): + case !version.Less(clusterversion.ByKey(clusterversion.TODO_Delete_V23_1EnsurePebbleFormatSSTableValueBlocks)): formatVers = pebble.FormatSSTableValueBlocks - case !version.Less(clusterversion.ByKey(clusterversion.V22_2)): + case !version.Less(clusterversion.ByKey(clusterversion.TODO_Delete_V22_2)): // This is the earliest supported format. The code assumes that the features // provided by this format are always available. formatVers = pebble.FormatPrePebblev1Marked diff --git a/pkg/storage/sst_writer.go b/pkg/storage/sst_writer.go index ff623c1c0178..54a2c3f997c3 100644 --- a/pkg/storage/sst_writer.go +++ b/pkg/storage/sst_writer.go @@ -69,7 +69,7 @@ func MakeIngestionWriterOptions(ctx context.Context, cs *cluster.Settings) sstab // table features available. Upgrade to an appropriate version only if the // cluster supports it. format := sstable.TableFormatPebblev2 - if cs.Version.IsActive(ctx, clusterversion.V23_1EnablePebbleFormatSSTableValueBlocks) && + if cs.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1EnablePebbleFormatSSTableValueBlocks) && ValueBlocksEnabled.Get(&cs.SV) { format = sstable.TableFormatPebblev3 } diff --git a/pkg/upgrade/upgrademanager/manager.go b/pkg/upgrade/upgrademanager/manager.go index cdf9ddb378ef..9bce3bd9b886 100644 --- a/pkg/upgrade/upgrademanager/manager.go +++ b/pkg/upgrade/upgrademanager/manager.go @@ -825,7 +825,7 @@ func (m *Manager) getRunningMigrationJob( // Payload proto has inside. cv := clusterversion.ClusterVersion{Version: version} var query string - if m.settings.Version.IsActive(ctx, clusterversion.V23_1JobInfoTableIsBackfilled) { + if m.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1JobInfoTableIsBackfilled) { query = PostJobInfoTableQuery } else { query = preJobInfoTableQuery diff --git a/pkg/upgrade/upgrades/system_rbr_indexes.go b/pkg/upgrade/upgrades/system_rbr_indexes.go index 3538dedc4402..4b9304d308c7 100644 --- a/pkg/upgrade/upgrades/system_rbr_indexes.go +++ b/pkg/upgrade/upgrades/system_rbr_indexes.go @@ -42,21 +42,21 @@ import ( // is hand coded because the tables are used to bootstrap the SQL layer and may // not use SQL. // -// # V23_1_SystemRbrDualWrite +// # TODO_Delete_V23_1_SystemRbrDualWrite // CRDB begins writing to the old and new indexes. // -// # V23_1_SystemRbrReadNew +// # TODO_Delete_V23_1_SystemRbrReadNew // The backFillRegionalByRowIndex upgrade job is attached to this version. It // backfills the new index then upgrades the descriptor to use the new index. // The descriptor is not used internally, but clients can use it to inspect // the system table. After the upgrade finishes, the version is advanced and // CRDB begins reading the new value. // -// # V23_1_SystemRbrSingleWrite +// # TODO_Delete_V23_1_SystemRbrSingleWrite // Now that all nodes are reading the new value, nodes only need to write to // the new value. // -// # V23_1_SystemRbrCleanup +// # TODO_Delete_V23_1_SystemRbrCleanup // The cleanUpRegionalByTableIndex is attached to this version gate and will // delete data associated with the old index. diff --git a/pkg/upgrade/upgrades/upgrades.go b/pkg/upgrade/upgrades/upgrades.go index b43a79d6ddfa..a89642ee6e25 100644 --- a/pkg/upgrade/upgrades/upgrades.go +++ b/pkg/upgrade/upgrades/upgrades.go @@ -98,58 +98,58 @@ var upgrades = []upgradebase.Upgrade{ "add default SQL schema telemetry schedule", ), upgrade.NewTenantUpgrade("add columns to system.tenants and populate a system tenant entry", - toCV(clusterversion.V23_1TenantNamesStateAndServiceMode), + toCV(clusterversion.TODO_Delete_V23_1TenantNamesStateAndServiceMode), upgrade.NoPrecondition, extendTenantsTable, ), upgrade.NewTenantUpgrade("set the value or system.descriptor_id_seq for the system tenant", - toCV(clusterversion.V23_1DescIDSequenceForSystemTenant), + toCV(clusterversion.TODO_Delete_V23_1DescIDSequenceForSystemTenant), upgrade.NoPrecondition, descIDSequenceForSystemTenant, ), upgrade.NewTenantUpgrade("add a partial predicate and full statistics ID columns to system.table_statistics", - toCV(clusterversion.V23_1AddPartialStatisticsColumns), + toCV(clusterversion.TODO_Delete_V23_1AddPartialStatisticsColumns), upgrade.NoPrecondition, alterSystemTableStatisticsAddPartialPredicateAndID, ), upgrade.NewTenantUpgrade( "create system.job_info table", - toCV(clusterversion.V23_1CreateSystemJobInfoTable), + toCV(clusterversion.TODO_Delete_V23_1CreateSystemJobInfoTable), upgrade.NoPrecondition, systemJobInfoTableMigration, ), upgrade.NewTenantUpgrade("add role_id and member_id columns to system.role_members", - toCV(clusterversion.V23_1RoleMembersTableHasIDColumns), + toCV(clusterversion.TODO_Delete_V23_1RoleMembersTableHasIDColumns), upgrade.NoPrecondition, alterSystemRoleMembersAddIDColumns, ), upgrade.NewTenantUpgrade("backfill role_id and member_id columns in system.role_members", - toCV(clusterversion.V23_1RoleMembersIDColumnsBackfilled), + toCV(clusterversion.TODO_Delete_V23_1RoleMembersIDColumnsBackfilled), upgrade.NoPrecondition, backfillSystemRoleMembersIDColumns, ), upgrade.NewTenantUpgrade( "add job_type column to system.jobs table", - toCV(clusterversion.V23_1AddTypeColumnToJobsTable), + toCV(clusterversion.TODO_Delete_V23_1AddTypeColumnToJobsTable), upgrade.NoPrecondition, alterSystemJobsAddJobType, ), upgrade.NewTenantUpgrade( "backfill job_type column in system.jobs table", - toCV(clusterversion.V23_1BackfillTypeColumnInJobsTable), + toCV(clusterversion.TODO_Delete_V23_1BackfillTypeColumnInJobsTable), upgrade.NoPrecondition, backfillJobTypeColumn, ), upgrade.NewTenantUpgrade( "create virtual column indexes_usage based on (statistics->'statistics'->'indexes') with index "+ "on table system.statement_statistics", - toCV(clusterversion.V23_1_AlterSystemStatementStatisticsAddIndexesUsage), + toCV(clusterversion.TODO_Delete_V23_1_AlterSystemStatementStatisticsAddIndexesUsage), upgrade.NoPrecondition, createIndexOnIndexUsageOnSystemStatementStatistics, ), upgrade.NewTenantUpgrade( "add column sql_addr to table system.sql_instances", - toCV(clusterversion.V23_1AlterSystemSQLInstancesAddSQLAddr), + toCV(clusterversion.TODO_Delete_V23_1AlterSystemSQLInstancesAddSQLAddr), upgrade.NoPrecondition, alterSystemSQLInstancesAddSqlAddr, ), @@ -159,7 +159,7 @@ var upgrades = []upgradebase.Upgrade{ "initialize key visualizer tables and jobs", ), upgrade.NewTenantUpgrade("delete descriptors of dropped functions", - toCV(clusterversion.V23_1_DeleteDroppedFunctionDescriptors), + toCV(clusterversion.TODO_Delete_V23_1_DeleteDroppedFunctionDescriptors), upgrade.NoPrecondition, deleteDescriptorsOfDroppedFunctions, ), @@ -170,90 +170,90 @@ var upgrades = []upgradebase.Upgrade{ ), upgrade.NewTenantUpgrade( "add user_id column to system.privileges table", - toCV(clusterversion.V23_1SystemPrivilegesTableHasUserIDColumn), + toCV(clusterversion.TODO_Delete_V23_1SystemPrivilegesTableHasUserIDColumn), upgrade.NoPrecondition, alterSystemPrivilegesAddUserIDColumn, ), upgrade.NewTenantUpgrade( "backfill user_id column in system.privileges table", - toCV(clusterversion.V23_1SystemPrivilegesTableUserIDColumnBackfilled), + toCV(clusterversion.TODO_Delete_V23_1SystemPrivilegesTableUserIDColumnBackfilled), upgrade.NoPrecondition, backfillSystemPrivilegesUserIDColumn, ), upgrade.NewTenantUpgrade( "add user_id column to system.web_sessions table", - toCV(clusterversion.V23_1WebSessionsTableHasUserIDColumn), + toCV(clusterversion.TODO_Delete_V23_1WebSessionsTableHasUserIDColumn), upgrade.NoPrecondition, alterWebSessionsTableAddUserIDColumn, ), upgrade.NewTenantUpgrade( "backfill user_id column in system.web_sessions table", - toCV(clusterversion.V23_1WebSessionsTableUserIDColumnBackfilled), + toCV(clusterversion.TODO_Delete_V23_1WebSessionsTableUserIDColumnBackfilled), upgrade.NoPrecondition, backfillWebSessionsTableUserIDColumn, ), upgrade.NewTenantUpgrade( "add column sql_addr to table system.sql_instances", - toCV(clusterversion.V23_1_SchemaChangerDeprecatedIndexPredicates), + toCV(clusterversion.TODO_Delete_V23_1_SchemaChangerDeprecatedIndexPredicates), upgrade.NoPrecondition, waitForSchemaChangerElementMigration, ), upgrade.NewTenantUpgrade( "add secondary index on (path,username) to table system.privileges", - toCV(clusterversion.V23_1AlterSystemPrivilegesAddIndexOnPathAndUsername), + toCV(clusterversion.TODO_Delete_V23_1AlterSystemPrivilegesAddIndexOnPathAndUsername), upgrade.NoPrecondition, alterSystemPrivilegesAddSecondaryIndex, ), upgrade.NewTenantUpgrade( "add role_id column to system.database_role_settings table", - toCV(clusterversion.V23_1DatabaseRoleSettingsHasRoleIDColumn), + toCV(clusterversion.TODO_Delete_V23_1DatabaseRoleSettingsHasRoleIDColumn), upgrade.NoPrecondition, alterDatabaseRoleSettingsTableAddRoleIDColumn, ), upgrade.NewTenantUpgrade( "backfill role_id column in system.database_role_settings table", - toCV(clusterversion.V23_1DatabaseRoleSettingsRoleIDColumnBackfilled), + toCV(clusterversion.TODO_Delete_V23_1DatabaseRoleSettingsRoleIDColumnBackfilled), upgrade.NoPrecondition, backfillDatabaseRoleSettingsTableRoleIDColumn, ), upgrade.NewTenantUpgrade( "backfill system tables with regional by row compatible indexes", - toCV(clusterversion.V23_1_SystemRbrReadNew), + toCV(clusterversion.TODO_Delete_V23_1_SystemRbrReadNew), upgrade.NoPrecondition, backfillRegionalByRowIndex, ), upgrade.NewTenantUpgrade( "clean up old indexes for regional by row compatible system tables", - toCV(clusterversion.V23_1_SystemRbrCleanup), + toCV(clusterversion.TODO_Delete_V23_1_SystemRbrCleanup), upgrade.NoPrecondition, cleanUpRegionalByTableIndex, ), upgrade.NewTenantUpgrade( "add owner_id column to system.external_connections table", - toCV(clusterversion.V23_1ExternalConnectionsTableHasOwnerIDColumn), + toCV(clusterversion.TODO_Delete_V23_1ExternalConnectionsTableHasOwnerIDColumn), upgrade.NoPrecondition, alterExternalConnectionsTableAddOwnerIDColumn, ), upgrade.NewTenantUpgrade( "backfill owner_id column in system.external_connections table", - toCV(clusterversion.V23_1ExternalConnectionsTableOwnerIDColumnBackfilled), + toCV(clusterversion.TODO_Delete_V23_1ExternalConnectionsTableOwnerIDColumnBackfilled), upgrade.NoPrecondition, backfillExternalConnectionsTableOwnerIDColumn, ), upgrade.NewTenantUpgrade( "backfill the system.job_info table with the payload and progress of each job in the system.jobs table", - toCV(clusterversion.V23_1JobInfoTableIsBackfilled), + toCV(clusterversion.TODO_Delete_V23_1JobInfoTableIsBackfilled), upgrade.NoPrecondition, backfillJobInfoTable, ), upgrade.NewTenantUpgrade("ensure all GC jobs send DeleteRange requests", - toCV(clusterversion.V23_1_UseDelRangeInGCJob), + toCV(clusterversion.TODO_Delete_V23_1_UseDelRangeInGCJob), checkForPausedGCJobs, waitForDelRangeInGCJob, ), upgrade.NewSystemUpgrade( "create system.tenant_tasks and system.task_payloads", - toCV(clusterversion.V23_1_TaskSystemTables), + toCV(clusterversion.TODO_Delete_V23_1_TaskSystemTables), createTaskSystemTables, ), upgrade.NewPermanentTenantUpgrade("create auto config runner job", @@ -263,13 +263,13 @@ var upgrades = []upgradebase.Upgrade{ ), upgrade.NewTenantUpgrade( "create and index new computed columns on system sql stats tables", - toCV(clusterversion.V23_1AddSQLStatsComputedIndexes), + toCV(clusterversion.TODO_Delete_V23_1AddSQLStatsComputedIndexes), upgrade.NoPrecondition, createComputedIndexesOnSystemSQLStatistics, ), upgrade.NewTenantUpgrade( "create statement_activity and transaction_activity tables", - toCV(clusterversion.V23_1AddSystemActivityTables), + toCV(clusterversion.TODO_Delete_V23_1AddSystemActivityTables), upgrade.NoPrecondition, systemStatisticsActivityTableMigration, ), @@ -281,13 +281,13 @@ var upgrades = []upgradebase.Upgrade{ ), upgrade.NewTenantUpgrade( "stop writing payload and progress to system.jobs", - toCV(clusterversion.V23_1StopWritingPayloadAndProgressToSystemJobs), + toCV(clusterversion.TODO_Delete_V23_1StopWritingPayloadAndProgressToSystemJobs), upgrade.NoPrecondition, alterPayloadColumnToNullable, ), upgrade.NewSystemUpgrade( "create system.tenant_id_seq", - toCV(clusterversion.V23_1_TenantIDSequence), + toCV(clusterversion.TODO_Delete_V23_1_TenantIDSequence), tenantIDSequenceForSystemTenant, ), upgrade.NewPermanentTenantUpgrade( diff --git a/pkg/workload/schemachange/operation_generator.go b/pkg/workload/schemachange/operation_generator.go index 31b035de58d9..03b1a233472f 100644 --- a/pkg/workload/schemachange/operation_generator.go +++ b/pkg/workload/schemachange/operation_generator.go @@ -3978,7 +3978,7 @@ func isClusterVersionLessThan( } func maybeExpectPotentialDescIDGenerationError(ctx context.Context, tx pgx.Tx) (bool, error) { - descIDGenerationVersion := clusterversion.ByKey(clusterversion.V23_1DescIDSequenceForSystemTenant) + descIDGenerationVersion := clusterversion.ByKey(clusterversion.TODO_Delete_V23_1DescIDSequenceForSystemTenant) descIDGenerationErrorPossible, err := isClusterVersionLessThan(ctx, tx, descIDGenerationVersion) return descIDGenerationErrorPossible, err