From cb332a8e185f6ced8c2de743a96f8e42926e7353 Mon Sep 17 00:00:00 2001 From: Radu Berinde Date: Wed, 15 Nov 2023 08:34:51 -0800 Subject: [PATCH] *: remove last remaining pre-23.1 gates Epic: none Release note: None --- pkg/cli/auth.go | 2 +- .../tenantcapabilitiesauthorizer/BUILD.bazel | 1 - .../authorizer.go | 9 --- pkg/upgrade/upgrademanager/manager.go | 20 +------ .../schemachange/operation_generator.go | 59 ------------------- 5 files changed, 2 insertions(+), 89 deletions(-) diff --git a/pkg/cli/auth.go b/pkg/cli/auth.go index 206427815610..4e582d176cf3 100644 --- a/pkg/cli/auth.go +++ b/pkg/cli/auth.go @@ -127,7 +127,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.TODO_Delete_V23_1WebSessionsTableHasUserIDColumn)) + clusterversion.MinSupported.Version()) if err != nil { return err } diff --git a/pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer/BUILD.bazel b/pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer/BUILD.bazel index 3123d91d6626..13ef00f7ddc5 100644 --- a/pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer/BUILD.bazel +++ b/pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer/BUILD.bazel @@ -10,7 +10,6 @@ go_library( importpath = "github.com/cockroachdb/cockroach/pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer", visibility = ["//visibility:public"], deps = [ - "//pkg/clusterversion", "//pkg/kv/kvpb", "//pkg/multitenant/tenantcapabilities", "//pkg/multitenant/tenantcapabilities/tenantcapabilitiespb", diff --git a/pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer/authorizer.go b/pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer/authorizer.go index 3536668c4260..5304b5b249d7 100644 --- a/pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer/authorizer.go +++ b/pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer/authorizer.go @@ -13,7 +13,6 @@ package tenantcapabilitiesauthorizer import ( "context" - "github.com/cockroachdb/cockroach/pkg/clusterversion" "github.com/cockroachdb/cockroach/pkg/kv/kvpb" "github.com/cockroachdb/cockroach/pkg/multitenant/tenantcapabilities" "github.com/cockroachdb/cockroach/pkg/multitenant/tenantcapabilities/tenantcapabilitiespb" @@ -355,14 +354,6 @@ func (a *Authorizer) getMode( ) (cp *tenantcapabilitiespb.TenantCapabilities, selectedMode authorizerModeType) { // 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.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. - selectedMode = authorizerModeV222 - } - } // If the mode is "on", we need to check the capabilities. Are they // available? diff --git a/pkg/upgrade/upgrademanager/manager.go b/pkg/upgrade/upgrademanager/manager.go index f5548a9c83be..a50e622478f6 100644 --- a/pkg/upgrade/upgrademanager/manager.go +++ b/pkg/upgrade/upgrademanager/manager.go @@ -785,19 +785,6 @@ func (m *Manager) getOrCreateMigrationJob( } const ( - preJobInfoTableQuery = ` -SELECT id, status -FROM ( - SELECT id, status, - crdb_internal.pb_to_json( - 'cockroach.sql.jobs.jobspb.Payload', - payload, - false -- emit_defaults - ) AS pl - FROM system.jobs - WHERE status IN ` + jobs.NonTerminalStatusTupleString + ` -) -WHERE ((pl->'migration')->'clusterVersion') = $1::JSONB` // PostJobInfoQuery avoids the crdb_internal.system_jobs table // to avoid expensive full scans. // Exported for testing. @@ -829,12 +816,7 @@ func (m *Manager) getRunningMigrationJob( // Wrap the version into a ClusterVersion so that the JSON looks like what the // Payload proto has inside. cv := clusterversion.ClusterVersion{Version: version} - var query string - if m.settings.Version.IsActive(ctx, clusterversion.TODO_Delete_V23_1JobInfoTableIsBackfilled) { - query = PostJobInfoTableQuery - } else { - query = preJobInfoTableQuery - } + query := PostJobInfoTableQuery jsonMsg, err := protoreflect.MessageToJSON(&cv, protoreflect.FmtFlags{EmitDefaults: false}) if err != nil { return false, 0, errors.Wrap(err, "failed to marshal version to JSON") diff --git a/pkg/workload/schemachange/operation_generator.go b/pkg/workload/schemachange/operation_generator.go index b26c0724793e..a46834244841 100644 --- a/pkg/workload/schemachange/operation_generator.go +++ b/pkg/workload/schemachange/operation_generator.go @@ -1024,15 +1024,6 @@ func (og *operationGenerator) createSequence(ctx context.Context, tx pgx.Tx) (*o {code: pgcode.UndefinedSchema, condition: !schemaExists}, {code: pgcode.DuplicateRelation, condition: sequenceExists && !ifNotExists}, }) - // Descriptor ID generator may be temporarily unavailable, so - // allow this to be detected. - potentialDescIDGeneratorError, err := maybeExpectPotentialDescIDGenerationError(ctx, tx) - if err != nil { - return nil, err - } - stmt.potentialExecErrors.addAll(codesWithConditions{ - {code: pgcode.Uncategorized, condition: potentialDescIDGeneratorError}, - }) var seqOptions tree.SequenceOptions // Decide if the sequence should be owned by a column. If so, it can @@ -1263,15 +1254,6 @@ func (og *operationGenerator) createTable(ctx context.Context, tx pgx.Tx) (*opSt {code: pgcode.FeatureNotSupported, condition: hasUnsupportedIdxQueries}, {code: pgcode.InvalidTableDefinition, condition: hasUnsupportedIdxQueries}, }) - // Descriptor ID generator may be temporarily unavailable, so - // allow uncategorized errors temporarily. - potentialDescIDGeneratorError, err := maybeExpectPotentialDescIDGenerationError(ctx, tx) - if err != nil { - return nil, err - } - opStmt.potentialExecErrors.addAll(codesWithConditions{ - {code: pgcode.Uncategorized, condition: potentialDescIDGeneratorError}, - }) opStmt.sql = tree.Serialize(stmt) return opStmt, nil } @@ -1290,15 +1272,6 @@ func (og *operationGenerator) createEnum(ctx context.Context, tx pgx.Tx) (*opStm {code: pgcode.DuplicateObject, condition: typeExists}, {code: pgcode.InvalidSchemaName, condition: !schemaExists}, }) - // Descriptor ID generator may be temporarily unavailable, so - // allow uncategorized errors temporarily. - potentialDescIDGeneratorError, err := maybeExpectPotentialDescIDGenerationError(ctx, tx) - if err != nil { - return nil, err - } - opStmt.potentialExecErrors.addAll(codesWithConditions{ - {code: pgcode.Uncategorized, condition: potentialDescIDGeneratorError}, - }) stmt := randgen.RandCreateType(og.params.rng, typName.Object(), "asdf") stmt.(*tree.CreateType).TypeName = typName.ToUnresolvedObjectName() opStmt.sql = tree.Serialize(stmt) @@ -1421,15 +1394,6 @@ func (og *operationGenerator) createTableAs(ctx context.Context, tx pgx.Tx) (*op {code: pgcode.DuplicateAlias, condition: duplicateSourceTables}, {code: pgcode.DuplicateColumn, condition: duplicateColumns}, }) - // Descriptor ID generator may be temporarily unavailable, so - // allow uncategorized errors temporarily. - potentialDescIDGeneratorError, err := maybeExpectPotentialDescIDGenerationError(ctx, tx) - if err != nil { - return nil, err - } - opStmt.potentialExecErrors.addAll(codesWithConditions{ - {code: pgcode.Uncategorized, condition: potentialDescIDGeneratorError}, - }) // Confirm the select itself doesn't run into any column generation errors, // by executing it independently first until we add validation when adding // generated columns. See issue: #81698?, which will allow us to remove this @@ -1561,13 +1525,6 @@ func (og *operationGenerator) createView(ctx context.Context, tx pgx.Tx) (*opStm }) // Descriptor ID generator may be temporarily unavailable, so // allow uncategorized errors temporarily. - potentialDescIDGeneratorError, err := maybeExpectPotentialDescIDGenerationError(ctx, tx) - if err != nil { - return nil, err - } - opStmt.potentialExecErrors.addAll(codesWithConditions{ - {code: pgcode.Uncategorized, condition: potentialDescIDGeneratorError}, - }) opStmt.sql = fmt.Sprintf(`CREATE VIEW %s AS %s`, destViewName, selectStatement.String()) return opStmt, nil @@ -3512,15 +3469,6 @@ func (og *operationGenerator) createSchema(ctx context.Context, tx pgx.Tx) (*opS // TODO(jayshrivastava): Support authorization stmt := randgen.MakeSchemaName(ifNotExists, schemaName, tree.MakeRoleSpecWithRoleName(username.RootUserName().Normalized())) opStmt.sql = tree.Serialize(stmt) - // Descriptor ID generator may be temporarily unavailable, so - // allow uncategorized errors temporarily. - potentialDescIDGeneratorError, err := maybeExpectPotentialDescIDGenerationError(ctx, tx) - if err != nil { - return nil, err - } - opStmt.potentialExecErrors.addAll(codesWithConditions{ - {code: pgcode.Uncategorized, condition: potentialDescIDGeneratorError}, - }) return opStmt, nil } @@ -3784,10 +3732,3 @@ func isClusterVersionLessThan( } return clusterVersion.LessEq(targetVersion), nil } - -func maybeExpectPotentialDescIDGenerationError(ctx context.Context, tx pgx.Tx) (bool, error) { - descIDGenerationVersion := clusterversion.ByKey(clusterversion.TODO_Delete_V23_1DescIDSequenceForSystemTenant) - descIDGenerationErrorPossible, err := isClusterVersionLessThan(ctx, - tx, descIDGenerationVersion) - return descIDGenerationErrorPossible, err -}