Skip to content

Commit

Permalink
Merge 53ee43c into blathers/backport-release-24.1-137868
Browse files Browse the repository at this point in the history
  • Loading branch information
blathers-crl[bot] authored Dec 21, 2024
2 parents 4ae6691 + 53ee43c commit b979880
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/sql/schema_changer.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgerror"
"github.com/cockroachdb/cockroach/pkg/sql/regionliveness"
"github.com/cockroachdb/cockroach/pkg/sql/regions"
"github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scerrors"
"github.com/cockroachdb/cockroach/pkg/sql/sem/catid"
"github.com/cockroachdb/cockroach/pkg/sql/sem/eval"
"github.com/cockroachdb/cockroach/pkg/sql/sem/tree"
Expand Down Expand Up @@ -795,6 +796,13 @@ func (sc *SchemaChanger) exec(ctx context.Context) error {
if err := sc.checkForMVCCCompliantAddIndexMutations(ctx, desc); err != nil {
return err
}
// Check that the DSC is not active for this descriptor.
if catalog.HasConcurrentDeclarativeSchemaChange(desc) {
log.Infof(ctx,
"aborting legacy schema change job execution because DSC was already active for %q (%d)",
desc.GetName(), desc.GetID())
return scerrors.ConcurrentSchemaChangeError(desc)
}

log.Infof(ctx,
"schema change on %q (v%d) starting execution...",
Expand Down Expand Up @@ -3147,7 +3155,8 @@ func (sc *SchemaChanger) applyZoneConfigChangeForMutation(
func DeleteTableDescAndZoneConfig(
ctx context.Context, execCfg *ExecutorConfig, tableDesc catalog.TableDescriptor,
) error {
log.Infof(ctx, "removing table descriptor and zone config for table %d", tableDesc.GetID())
log.Infof(ctx, "removing table descriptor and zone config for table %d (has active dsc=%t)",
tableDesc.GetID(), catalog.HasConcurrentDeclarativeSchemaChange(tableDesc))
const kvTrace = false
return DescsTxn(ctx, execCfg, func(ctx context.Context, txn isql.Txn, col *descs.Collection) error {
b := txn.KV().NewBatch()
Expand Down

0 comments on commit b979880

Please sign in to comment.