diff --git a/pkg/ccl/logictestccl/testdata/logic_test/alter_table_locality b/pkg/ccl/logictestccl/testdata/logic_test/alter_table_locality index c98448962925..379632d398a0 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/alter_table_locality +++ b/pkg/ccl/logictestccl/testdata/logic_test/alter_table_locality @@ -1810,3 +1810,295 @@ TABLE rbt_table_gc_ttl ALTER TABLE rbt_table_gc_ttl CONFIGURE ZONE USING constraints = '{+region=ap-southeast-2: 1, +region=ca-central-1: 1, +region=us-east-1: 1}', voter_constraints = '[+region=ca-central-1]', lease_preferences = '[[+region=ca-central-1]]' + +statement ok +CREATE DATABASE add_regions WITH PRIMARY REGION "ca-central-1"; +USE add_regions + +statement ok +CREATE TABLE regional_by_row ( + pk INT PRIMARY KEY, + i INT, + INDEX(i), + FAMILY (pk, i) +) LOCALITY REGIONAL BY ROW + +statement ok +CREATE TABLE regional_by_row_as ( + pk INT PRIMARY KEY, + i INT, + cr crdb_internal_region NOT NULL DEFAULT 'ca-central-1', + INDEX(i), + FAMILY (cr, pk, i) +) LOCALITY REGIONAL BY ROW AS "cr"; + +query TT +SHOW CREATE TABLE regional_by_row +---- +regional_by_row CREATE TABLE public.regional_by_row ( + pk INT8 NOT NULL, + i INT8 NULL, + crdb_region public.crdb_internal_region NOT VISIBLE NOT NULL DEFAULT default_to_database_primary_region(gateway_region())::public.crdb_internal_region, + CONSTRAINT "primary" PRIMARY KEY (pk ASC), + INDEX regional_by_row_i_idx (i ASC), + FAMILY fam_0_pk_i_crdb_region (pk, i, crdb_region) +) LOCALITY REGIONAL BY ROW; +ALTER PARTITION "ca-central-1" OF INDEX add_regions.public.regional_by_row@primary CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ca-central-1]', + lease_preferences = '[[+region=ca-central-1]]'; +ALTER PARTITION "ca-central-1" OF INDEX add_regions.public.regional_by_row@regional_by_row_i_idx CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ca-central-1]', + lease_preferences = '[[+region=ca-central-1]]' + + +query TT +SHOW CREATE TABLE regional_by_row_as +---- +regional_by_row_as CREATE TABLE public.regional_by_row_as ( + pk INT8 NOT NULL, + i INT8 NULL, + cr public.crdb_internal_region NOT NULL DEFAULT 'ca-central-1':::public.crdb_internal_region, + CONSTRAINT "primary" PRIMARY KEY (pk ASC), + INDEX regional_by_row_as_i_idx (i ASC), + FAMILY fam_0_cr_pk_i (cr, pk, i) +) LOCALITY REGIONAL BY ROW AS cr; +ALTER PARTITION "ca-central-1" OF INDEX add_regions.public.regional_by_row_as@primary CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ca-central-1]', + lease_preferences = '[[+region=ca-central-1]]'; +ALTER PARTITION "ca-central-1" OF INDEX add_regions.public.regional_by_row_as@regional_by_row_as_i_idx CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ca-central-1]', + lease_preferences = '[[+region=ca-central-1]]' + +statement ok +ALTER DATABASE add_regions ADD REGION "us-east-1" + +query TT +SHOW CREATE TABLE regional_by_row +---- +regional_by_row CREATE TABLE public.regional_by_row ( + pk INT8 NOT NULL, + i INT8 NULL, + crdb_region public.crdb_internal_region NOT VISIBLE NOT NULL DEFAULT default_to_database_primary_region(gateway_region())::public.crdb_internal_region, + CONSTRAINT "primary" PRIMARY KEY (crdb_region ASC, pk ASC), + INDEX regional_by_row_i_idx (crdb_region ASC, i ASC), + FAMILY fam_0_pk_i_crdb_region (pk, i, crdb_region) +) LOCALITY REGIONAL BY ROW; +ALTER PARTITION "ca-central-1" OF INDEX add_regions.public.regional_by_row@primary CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ca-central-1]', + lease_preferences = '[[+region=ca-central-1]]'; +ALTER PARTITION "ca-central-1" OF INDEX add_regions.public.regional_by_row@regional_by_row_i_idx CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ca-central-1]', + lease_preferences = '[[+region=ca-central-1]]'; +ALTER PARTITION "us-east-1" OF INDEX add_regions.public.regional_by_row@primary CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=us-east-1]', + lease_preferences = '[[+region=us-east-1]]'; +ALTER PARTITION "us-east-1" OF INDEX add_regions.public.regional_by_row@regional_by_row_i_idx CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=us-east-1]', + lease_preferences = '[[+region=us-east-1]]' + +query TT +SHOW CREATE TABLE regional_by_row_as +---- +regional_by_row_as CREATE TABLE public.regional_by_row_as ( + pk INT8 NOT NULL, + i INT8 NULL, + cr public.crdb_internal_region NOT NULL DEFAULT 'ca-central-1':::public.crdb_internal_region, + CONSTRAINT "primary" PRIMARY KEY (cr ASC, pk ASC), + INDEX regional_by_row_as_i_idx (cr ASC, i ASC), + FAMILY fam_0_cr_pk_i (cr, pk, i) +) LOCALITY REGIONAL BY ROW AS cr; +ALTER PARTITION "ca-central-1" OF INDEX add_regions.public.regional_by_row_as@primary CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ca-central-1]', + lease_preferences = '[[+region=ca-central-1]]'; +ALTER PARTITION "ca-central-1" OF INDEX add_regions.public.regional_by_row_as@regional_by_row_as_i_idx CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ca-central-1]', + lease_preferences = '[[+region=ca-central-1]]'; +ALTER PARTITION "us-east-1" OF INDEX add_regions.public.regional_by_row_as@primary CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=us-east-1]', + lease_preferences = '[[+region=us-east-1]]'; +ALTER PARTITION "us-east-1" OF INDEX add_regions.public.regional_by_row_as@regional_by_row_as_i_idx CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=us-east-1]', + lease_preferences = '[[+region=us-east-1]]' + +statement ok +ALTER DATABASE add_regions ADD REGION "ap-southeast-2" + +query TT +SHOW CREATE TABLE regional_by_row +---- +regional_by_row CREATE TABLE public.regional_by_row ( + pk INT8 NOT NULL, + i INT8 NULL, + crdb_region public.crdb_internal_region NOT VISIBLE NOT NULL DEFAULT default_to_database_primary_region(gateway_region())::public.crdb_internal_region, + CONSTRAINT "primary" PRIMARY KEY (crdb_region ASC, pk ASC), + INDEX regional_by_row_i_idx (crdb_region ASC, i ASC), + FAMILY fam_0_pk_i_crdb_region (pk, i, crdb_region) +) LOCALITY REGIONAL BY ROW; +ALTER PARTITION "ap-southeast-2" OF INDEX add_regions.public.regional_by_row@primary CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ap-southeast-2]', + lease_preferences = '[[+region=ap-southeast-2]]'; +ALTER PARTITION "ap-southeast-2" OF INDEX add_regions.public.regional_by_row@regional_by_row_i_idx CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ap-southeast-2]', + lease_preferences = '[[+region=ap-southeast-2]]'; +ALTER PARTITION "ca-central-1" OF INDEX add_regions.public.regional_by_row@primary CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ca-central-1]', + lease_preferences = '[[+region=ca-central-1]]'; +ALTER PARTITION "ca-central-1" OF INDEX add_regions.public.regional_by_row@regional_by_row_i_idx CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ca-central-1]', + lease_preferences = '[[+region=ca-central-1]]'; +ALTER PARTITION "us-east-1" OF INDEX add_regions.public.regional_by_row@primary CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=us-east-1]', + lease_preferences = '[[+region=us-east-1]]'; +ALTER PARTITION "us-east-1" OF INDEX add_regions.public.regional_by_row@regional_by_row_i_idx CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=us-east-1]', + lease_preferences = '[[+region=us-east-1]]' + +query TT +SHOW CREATE TABLE regional_by_row_as +---- +regional_by_row_as CREATE TABLE public.regional_by_row_as ( + pk INT8 NOT NULL, + i INT8 NULL, + cr public.crdb_internal_region NOT NULL DEFAULT 'ca-central-1':::public.crdb_internal_region, + CONSTRAINT "primary" PRIMARY KEY (cr ASC, pk ASC), + INDEX regional_by_row_as_i_idx (cr ASC, i ASC), + FAMILY fam_0_cr_pk_i (cr, pk, i) +) LOCALITY REGIONAL BY ROW AS cr; +ALTER PARTITION "ap-southeast-2" OF INDEX add_regions.public.regional_by_row_as@primary CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ap-southeast-2]', + lease_preferences = '[[+region=ap-southeast-2]]'; +ALTER PARTITION "ap-southeast-2" OF INDEX add_regions.public.regional_by_row_as@regional_by_row_as_i_idx CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ap-southeast-2]', + lease_preferences = '[[+region=ap-southeast-2]]'; +ALTER PARTITION "ca-central-1" OF INDEX add_regions.public.regional_by_row_as@primary CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ca-central-1]', + lease_preferences = '[[+region=ca-central-1]]'; +ALTER PARTITION "ca-central-1" OF INDEX add_regions.public.regional_by_row_as@regional_by_row_as_i_idx CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ca-central-1]', lease_preferences = '[[+region=ca-central-1]]'; ALTER PARTITION "us-east-1" OF INDEX add_regions.public.regional_by_row_as@primary CONFIGURE ZONE USING num_voters = 3, voter_constraints = '[+region=us-east-1]', + lease_preferences = '[[+region=us-east-1]]'; +ALTER PARTITION "us-east-1" OF INDEX add_regions.public.regional_by_row_as@regional_by_row_as_i_idx CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=us-east-1]', + lease_preferences = '[[+region=us-east-1]]' + +statement ok +CREATE DATABASE add_regions_in_txn WITH PRIMARY REGION "ca-central-1"; +USE add_regions_in_txn + +statement ok +CREATE TABLE regional_by_row ( + pk INT PRIMARY KEY, + i INT, + INDEX(i), + FAMILY (pk, i) +) LOCALITY REGIONAL BY ROW + +statement ok +CREATE TABLE regional_by_row_as ( + pk INT PRIMARY KEY, + i INT, + cr crdb_internal_region NOT NULL DEFAULT 'ca-central-1', + INDEX(i), + FAMILY (cr, pk, i) +) LOCALITY REGIONAL BY ROW AS "cr"; + +statement ok +BEGIN; +ALTER DATABASE add_regions_in_txn ADD REGION "us-east-1"; +ALTER DATABASE add_regions_in_txn ADD REGION "ap-southeast-2"; +COMMIT; + + +query TT +SHOW CREATE TABLE regional_by_row +---- +regional_by_row CREATE TABLE public.regional_by_row ( + pk INT8 NOT NULL, + i INT8 NULL, + crdb_region public.crdb_internal_region NOT VISIBLE NOT NULL DEFAULT default_to_database_primary_region(gateway_region())::public.crdb_internal_region, + CONSTRAINT "primary" PRIMARY KEY (crdb_region ASC, pk ASC), + INDEX regional_by_row_i_idx (crdb_region ASC, i ASC), + FAMILY fam_0_pk_i_crdb_region (pk, i, crdb_region) +) LOCALITY REGIONAL BY ROW; +ALTER PARTITION "ap-southeast-2" OF INDEX add_regions_in_txn.public.regional_by_row@primary CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ap-southeast-2]', + lease_preferences = '[[+region=ap-southeast-2]]'; +ALTER PARTITION "ap-southeast-2" OF INDEX add_regions_in_txn.public.regional_by_row@regional_by_row_i_idx CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ap-southeast-2]', + lease_preferences = '[[+region=ap-southeast-2]]'; +ALTER PARTITION "ca-central-1" OF INDEX add_regions_in_txn.public.regional_by_row@primary CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ca-central-1]', + lease_preferences = '[[+region=ca-central-1]]'; +ALTER PARTITION "ca-central-1" OF INDEX add_regions_in_txn.public.regional_by_row@regional_by_row_i_idx CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ca-central-1]', + lease_preferences = '[[+region=ca-central-1]]'; +ALTER PARTITION "us-east-1" OF INDEX add_regions_in_txn.public.regional_by_row@primary CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=us-east-1]', + lease_preferences = '[[+region=us-east-1]]'; +ALTER PARTITION "us-east-1" OF INDEX add_regions_in_txn.public.regional_by_row@regional_by_row_i_idx CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=us-east-1]', + lease_preferences = '[[+region=us-east-1]]' + +query TT +SHOW CREATE TABLE regional_by_row_as +---- +regional_by_row_as CREATE TABLE public.regional_by_row_as ( + pk INT8 NOT NULL, + i INT8 NULL, + cr public.crdb_internal_region NOT NULL DEFAULT 'ca-central-1':::public.crdb_internal_region, + CONSTRAINT "primary" PRIMARY KEY (cr ASC, pk ASC), + INDEX regional_by_row_as_i_idx (cr ASC, i ASC), + FAMILY fam_0_cr_pk_i (cr, pk, i) +) LOCALITY REGIONAL BY ROW AS cr; +ALTER PARTITION "ap-southeast-2" OF INDEX add_regions_in_txn.public.regional_by_row_as@primary CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ap-southeast-2]', + lease_preferences = '[[+region=ap-southeast-2]]'; +ALTER PARTITION "ap-southeast-2" OF INDEX add_regions_in_txn.public.regional_by_row_as@regional_by_row_as_i_idx CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ap-southeast-2]', + lease_preferences = '[[+region=ap-southeast-2]]'; +ALTER PARTITION "ca-central-1" OF INDEX add_regions_in_txn.public.regional_by_row_as@primary CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ca-central-1]', + lease_preferences = '[[+region=ca-central-1]]'; +ALTER PARTITION "ca-central-1" OF INDEX add_regions_in_txn.public.regional_by_row_as@regional_by_row_as_i_idx CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=ca-central-1]', + lease_preferences = '[[+region=ca-central-1]]'; +ALTER PARTITION "us-east-1" OF INDEX add_regions_in_txn.public.regional_by_row_as@primary CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=us-east-1]', + lease_preferences = '[[+region=us-east-1]]'; +ALTER PARTITION "us-east-1" OF INDEX add_regions_in_txn.public.regional_by_row_as@regional_by_row_as_i_idx CONFIGURE ZONE USING + num_voters = 3, + voter_constraints = '[+region=us-east-1]', + lease_preferences = '[[+region=us-east-1]]' diff --git a/pkg/sql/catalog/descriptor.go b/pkg/sql/catalog/descriptor.go index 56342a2b7fe1..1172dd990706 100644 --- a/pkg/sql/catalog/descriptor.go +++ b/pkg/sql/catalog/descriptor.go @@ -267,6 +267,7 @@ type TableDescriptor interface { IsLocalityRegionalByTable() bool IsLocalityGlobal() bool GetRegionalByTableRegion() (descpb.RegionName, error) + GetRegionalByRowTableRegionColumnName() (tree.Name, error) } // Index is an interface around the index descriptor types. diff --git a/pkg/sql/catalog/tabledesc/structured.go b/pkg/sql/catalog/tabledesc/structured.go index fe56f11a93b3..d1910e631b58 100644 --- a/pkg/sql/catalog/tabledesc/structured.go +++ b/pkg/sql/catalog/tabledesc/structured.go @@ -4022,6 +4022,19 @@ func (desc *wrapper) GetRegionalByTableRegion() (descpb.RegionName, error) { return *region, nil } +// GetRegionalByRowTableRegionColumnName returns the region column name of a +// REGIONAL BY ROW table. +func (desc *wrapper) GetRegionalByRowTableRegionColumnName() (tree.Name, error) { + if !desc.IsLocalityRegionalByRow() { + return "", errors.New("is not REGIONAL BY ROW") + } + colName := desc.LocalityConfig.GetRegionalByRow().As + if colName == nil { + return tree.RegionalByRowRegionDefaultColName, nil + } + return tree.Name(*colName), nil +} + // GetMultiRegionEnumDependency returns true if the given table has an "implicit" // dependency on the multi-region enum. An implicit dependency exists for // REGIONAL BY TABLE table's which are homed in an explicit region diff --git a/pkg/sql/type_change.go b/pkg/sql/type_change.go index 34d2d5d6e1bc..a68a43673309 100644 --- a/pkg/sql/type_change.go +++ b/pkg/sql/type_change.go @@ -27,12 +27,14 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/catalog/catalogkv" "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb" "github.com/cockroachdb/cockroach/pkg/sql/catalog/descs" + "github.com/cockroachdb/cockroach/pkg/sql/catalog/lease" "github.com/cockroachdb/cockroach/pkg/sql/catalog/tabledesc" "github.com/cockroachdb/cockroach/pkg/sql/catalog/typedesc" "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgcode" "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgerror" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sessiondata" + "github.com/cockroachdb/cockroach/pkg/sql/sessiondatapb" "github.com/cockroachdb/cockroach/pkg/util/log" "github.com/cockroachdb/cockroach/pkg/util/retry" "github.com/cockroachdb/errors" @@ -288,14 +290,44 @@ func (t *typeSchemaChanger) exec(ctx context.Context) error { ); err != nil { return err } - } - // Finally, make sure all of the leases are updated. - if err := WaitToUpdateLeases(ctx, leaseMgr, t.typeID); err != nil { - if errors.Is(err, catalog.ErrDescriptorNotFound) { - return nil + // Finally, make sure all of the leases are updated. + if err := WaitToUpdateLeases(ctx, leaseMgr, t.typeID); err != nil { + if errors.Is(err, catalog.ErrDescriptorNotFound) { + return nil + } + return err + } + + // Additional work must be performed once the promotion/demotion of enum + // members has successfully completed for multi-region enums. In particular, + // index partitions for REGIONAL BY ROW tables must be updated to reflect + // the new region values available. This is done in a separate transaction + // as enum members must be public before we can partition based on those + // values, which happens when the transaction above commits. + if typeDesc.Kind == descpb.TypeDescriptor_MULTIREGION_ENUM && len(t.transitioningMembers) > 0 { + repartitionTables := func(ctx context.Context, txn *kv.Txn, descsCol *descs.Collection) error { + typeDesc, err := descsCol.GetImmutableTypeByID(ctx, txn, t.typeID, tree.ObjectLookupFlags{}) + if err != nil { + return err + } + if err := repartitionRegionalByRowTables(ctx, typeDesc, txn, t.execCfg, t.execCfg.LeaseManager); err != nil { + return err + } + return nil + } + + if err := descs.Txn( + ctx, + t.execCfg.Settings, + t.execCfg.LeaseManager, + t.execCfg.InternalExecutor, + t.execCfg.DB, + repartitionTables, + ); err != nil { + return err + } } - return err } // If the type is being dropped, remove the descriptor here. @@ -311,6 +343,103 @@ func (t *typeSchemaChanger) exec(ctx context.Context) error { return nil } +func repartitionRegionalByRowTables( + ctx context.Context, + typeDesc *typedesc.Immutable, + txn *kv.Txn, + execCfg *ExecutorConfig, + leaseMgr *lease.Manager, +) error { + p, cleanup := NewInternalPlanner( + "repartition-tables", + txn, + security.RootUserName(), + &MemoryMetrics{}, + execCfg, + sessiondatapb.SessionData{}, + ) + defer cleanup() + localPlanner := p.(*planner) + + _, dbDesc, err := localPlanner.Descriptors().GetImmutableDatabaseByID( + ctx, txn, typeDesc.ParentID, tree.DatabaseLookupFlags{Required: true}) + if err != nil { + return err + } + allDescs, err := localPlanner.Descriptors().GetAllDescriptors(ctx, txn) + lCtx := newInternalLookupCtx(ctx, allDescs, dbDesc, nil /* fallback */) + + b := txn.NewBatch() + for _, tbID := range lCtx.tbIDs { + tableDesc, err := localPlanner.Descriptors().GetMutableTableByID( + ctx, txn, tbID, tree.ObjectLookupFlags{}) + if err != nil { + return err + } + if tableDesc.IsLocalityRegionalByRow() { + if tableDesc.Dropped() { + // Don't need to repartition a table if it has been dropped. + continue + } + colName, err := tableDesc.GetRegionalByRowTableRegionColumnName() + if err != nil { + return err + } + partitionAllBy := partitionByForRegionalByRow(*dbDesc.RegionConfig, colName) + + // Update the partitioning on all indexes of the table that aren't being + // dropped. + for _, index := range tableDesc.NonDropIndexes() { + newIdx, err := CreatePartitioning( + ctx, + localPlanner.extendedEvalCtx.Settings, + localPlanner.EvalContext(), + tableDesc, + *index.IndexDesc(), + partitionAllBy, + nil, /* allowedNewColumnName*/ + true, /* allowImplicitPartitioning */ + ) + if err != nil { + return err + } + // Update the index descriptor proto's partitioning. + index.IndexDesc().Partitioning = newIdx.Partitioning + } + + // Update the zone configurations now that the partition's been added. + if err := ApplyZoneConfigForMultiRegionTable( + ctx, + txn, + localPlanner.ExecCfg(), + *dbDesc.RegionConfig, + tableDesc, + ApplyZoneConfigForMultiRegionTableOptionTableAndIndexes, + ); err != nil { + return err + } + + if err := localPlanner.Descriptors().WriteDescToBatch(ctx, false /* kvTrace */, tableDesc, b); err != nil { + return err + } + } + } + if err := txn.Run(ctx, b); err != nil { + return err + } + + // Wait for leases on the modified tables to update. + for _, tbID := range lCtx.tbIDs { + if err := WaitToUpdateLeases(ctx, leaseMgr, tbID); err != nil { + if errors.Is(err, catalog.ErrDescriptorNotFound) { + return nil + } + return err + } + } + return nil +} + // isTransitioningInCurrentJob returns true if the given member is either being // added or removed in the current job. func (t *typeSchemaChanger) isTransitioningInCurrentJob(