From 47aa2d5e179220f9144575bf6ca6a08f868bc133 Mon Sep 17 00:00:00 2001 From: rimadeodhar Date: Sat, 16 Mar 2024 22:50:42 -0700 Subject: [PATCH] scplan: Fix deprules for dropping computed columns This PR fixes the new schema changer deprules for dropping virtual computed columns which are also used for hash and expression indexes. Currently, the optimizer allows for virtual, computed columns to be evaluated even when under mutation. However, this causes concurrent DML issues when the schemachanger job is running as the column that the virtual computed column depends on moves into WRITE_ONLY stage prior to the computed column being dropped. As a result, the optimizer is unable to access the column for evaluating the compute expression. This PR updates the dep rules to ensure the virtual, computed column is dropped before the dependent column moves to WRITE_ONLY ensuring that the compute expression can be enforced correctly for concurrent DML during all stages of the schema change. Epic: none Fixes: #111608 Fixes: #111619 Release note: None --- pkg/sql/schemachanger/dml_injection_test.go | 2 - .../internal/rules/current/dep_add_column.go | 2 +- .../internal/rules/current/dep_drop_column.go | 71 ++ .../internal/rules/current/testdata/deprules | 150 +++- .../scplan/internal/rules/helpers.go | 21 + .../testdata/alter_table_alter_primary_key | 4 + .../scplan/testdata/alter_table_drop_column | 12 + .../drop_column_computed_index.explain | 77 +- .../drop_column_computed_index.explain_shape | 2 +- .../drop_column_computed_index.side_effects | 311 ++++---- ...mn_computed_index__rollback_1_of_7.explain | 9 +- ...mn_computed_index__rollback_2_of_7.explain | 9 +- ...mn_computed_index__rollback_3_of_7.explain | 9 +- ...mn_computed_index__rollback_4_of_7.explain | 9 +- ...mn_computed_index__rollback_5_of_7.explain | 9 +- ...mn_computed_index__rollback_6_of_7.explain | 9 +- ...mn_computed_index__rollback_7_of_7.explain | 9 +- ...ate_index_separate_statements.side_effects | 733 ++++++++---------- ...rate_statements__rollback_10_of_15.explain | 85 -- ...rate_statements__rollback_11_of_15.explain | 85 -- ...rate_statements__rollback_12_of_15.explain | 85 -- ...rate_statements__rollback_13_of_15.explain | 87 --- ...rate_statements__rollback_14_of_15.explain | 87 --- ...rate_statements__rollback_15_of_15.explain | 85 -- ...arate_statements__rollback_1_of_7.explain} | 11 +- ...arate_statements__rollback_2_of_7.explain} | 11 +- ...arate_statements__rollback_3_of_7.explain} | 11 +- ...arate_statements__rollback_4_of_7.explain} | 11 +- ...arate_statements__rollback_5_of_7.explain} | 11 +- ...arate_statements__rollback_6_of_7.explain} | 11 +- ...arate_statements__rollback_7_of_15.explain | 52 -- ...arate_statements__rollback_7_of_7.explain} | 11 +- ...arate_statements__rollback_9_of_15.explain | 81 -- ...arate_statements__statement_1_of_2.explain | 77 +- ...statements__statement_1_of_2.explain_shape | 2 +- ...arate_statements__statement_2_of_2.explain | 280 +++---- ...statements__statement_2_of_2.explain_shape | 4 +- ...ple_columns_separate_statements.definition | 35 +- ...e_columns_separate_statements.side_effects | 353 ++++----- ...parate_statements__rollback_1_of_7.explain | 13 +- ...parate_statements__rollback_2_of_7.explain | 15 +- ...parate_statements__rollback_3_of_7.explain | 15 +- ...parate_statements__rollback_4_of_7.explain | 11 +- ...parate_statements__rollback_5_of_7.explain | 13 +- ...parate_statements__rollback_6_of_7.explain | 13 +- ...parate_statements__rollback_7_of_7.explain | 15 +- ...arate_statements__statement_1_of_2.explain | 77 +- ...statements__statement_1_of_2.explain_shape | 2 +- ...arate_statements__statement_2_of_2.explain | 73 +- ...statements__statement_2_of_2.explain_shape | 2 +- 50 files changed, 1263 insertions(+), 1909 deletions(-) delete mode 100644 pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_10_of_15.explain delete mode 100644 pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_11_of_15.explain delete mode 100644 pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_12_of_15.explain delete mode 100644 pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_13_of_15.explain delete mode 100644 pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_14_of_15.explain delete mode 100644 pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_15_of_15.explain rename pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/{drop_column_create_index_separate_statements__rollback_1_of_15.explain => drop_column_create_index_separate_statements__rollback_1_of_7.explain} (84%) rename pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/{drop_column_create_index_separate_statements__rollback_3_of_15.explain => drop_column_create_index_separate_statements__rollback_2_of_7.explain} (87%) rename pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/{drop_column_create_index_separate_statements__rollback_2_of_15.explain => drop_column_create_index_separate_statements__rollback_3_of_7.explain} (87%) rename pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/{drop_column_create_index_separate_statements__rollback_4_of_15.explain => drop_column_create_index_separate_statements__rollback_4_of_7.explain} (87%) rename pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/{drop_column_create_index_separate_statements__rollback_6_of_15.explain => drop_column_create_index_separate_statements__rollback_5_of_7.explain} (87%) rename pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/{drop_column_create_index_separate_statements__rollback_5_of_15.explain => drop_column_create_index_separate_statements__rollback_6_of_7.explain} (87%) delete mode 100644 pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_7_of_15.explain rename pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/{drop_column_create_index_separate_statements__rollback_8_of_15.explain => drop_column_create_index_separate_statements__rollback_7_of_7.explain} (87%) delete mode 100644 pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_9_of_15.explain diff --git a/pkg/sql/schemachanger/dml_injection_test.go b/pkg/sql/schemachanger/dml_injection_test.go index b43a4ada088f..2be305acc8fb 100644 --- a/pkg/sql/schemachanger/dml_injection_test.go +++ b/pkg/sql/schemachanger/dml_injection_test.go @@ -345,7 +345,6 @@ func TestAlterTableDMLInjection(t *testing.T) { "CREATE INDEX idx ON tbl (i) USING HASH", }, schemaChange: "ALTER TABLE tbl DROP COLUMN i CASCADE", - skipIssue: 111619, }, { desc: "drop column with composite index + fk", @@ -407,7 +406,6 @@ func TestAlterTableDMLInjection(t *testing.T) { "CREATE INDEX idx ON tbl ((i + 1))", }, schemaChange: "ALTER TABLE tbl DROP COLUMN i CASCADE", - skipIssue: 111608, }, { desc: "create materialized view from index", diff --git a/pkg/sql/schemachanger/scplan/internal/rules/current/dep_add_column.go b/pkg/sql/schemachanger/scplan/internal/rules/current/dep_add_column.go index 9c89e1004902..3b034abbb85f 100644 --- a/pkg/sql/schemachanger/scplan/internal/rules/current/dep_add_column.go +++ b/pkg/sql/schemachanger/scplan/internal/rules/current/dep_add_column.go @@ -116,7 +116,7 @@ func init() { func init() { registerDepRule( "ensure columns are in increasing order", - scgraph.SameStagePrecedence, + scgraph.Precedence, "later-column", "earlier-column", func(from, to NodeVars) rel.Clauses { status := rel.Var("status") diff --git a/pkg/sql/schemachanger/scplan/internal/rules/current/dep_drop_column.go b/pkg/sql/schemachanger/scplan/internal/rules/current/dep_drop_column.go index f10310fa86d2..bc032d65319b 100644 --- a/pkg/sql/schemachanger/scplan/internal/rules/current/dep_drop_column.go +++ b/pkg/sql/schemachanger/scplan/internal/rules/current/dep_drop_column.go @@ -113,6 +113,51 @@ func init() { }, ) + // This rule ensures that a column is dropped only after any virtual, computed column dependent + // on the column is dropped i.e. if B is a virtual, computed column using column A + // in its compute expression, this rule ensures that the compute expression of B is dropped before + // A is dropped. The rules above ensure that the column B is dropped before the expression is dropped + // so this rule also implicitly implies that column B is dropped before column A. + // This is relevant for expression and hash indexes which create an internal, virtual column + // which computes the hash/expression key for the index. + // + // N.B. This rules has been intentionally made very specific to only virtual, computed columns as opposed + // to all computed columns. This is due an edge case within the optimizer which actually allows + // the compute expressions of virtual computed columns to be evaluated during an active schema change. + // Without this rule, the optimizer is unable to read the dependent column as the dependent column + // moves to the WRITE_ONLY stage before the computed column is fully dropped. As of now, we don't + // need to apply to all computed columns as the optimizer doesn't evaluate their expressions while + // dropping them so the above rule where the column type is dropped before the column is sufficient + // to enforce the dependency. + registerDepRuleForDrop( + "Virtual computed column expression is dropped before the column it depends on", + scgraph.Precedence, + "virtual-column-expr", "column", + scpb.Status_ABSENT, scpb.Status_WRITE_ONLY, + func(from, to NodeVars) rel.Clauses { + return rel.Clauses{ + from.Type((*scpb.ColumnType)(nil)), + to.Type((*scpb.Column)(nil)), + JoinOnDescID(from, to, "table-id"), + FilterElements("computedColumnTypeReferencesColumn", from, to, + func(colType *scpb.ColumnType, column *scpb.Column) bool { + if !colType.IsVirtual { + return false + } + if colType.ComputeExpr == nil { + return false + } + for _, refColumns := range colType.ComputeExpr.ReferencedColumnIDs { + if refColumns == column.ColumnID { + return true + } + } + return false + }), + } + }, + ) + // Column constraint disappears in the same stage as the column // becomes WRITE_ONLY. // @@ -138,6 +183,31 @@ func init() { } }, ) + + // This rule enforces that a new primary index moves to the public stage only after all columns stored + // within the old primary index move to WRITE_ONLY. Without this, the new primary index is at risk of not + // storing all public columns within the table (as the column being dropped is still considered public + // before it moves to WRITE_ONLY but the new primary index does not contain it since the schema changer + // knows it is transitioning to a target status of ABSENT). + registerDepRule( + "New primary index should go public only after columns being dropped move to WRITE_ONLY", + scgraph.Precedence, + "column", "new-primary-index", + func(from, to NodeVars) rel.Clauses { + ic := MkNodeVars("index-column") + relationID, columnID, indexID := rel.Var("table-id"), rel.Var("column-id"), rel.Var("index-id") + return rel.Clauses{ + from.Type((*scpb.Column)(nil)), + to.Type((*scpb.PrimaryIndex)(nil)), + ColumnInSourcePrimaryIndex(ic, to, relationID, columnID, indexID), + JoinOnColumnID(ic, from, relationID, columnID), + from.TargetStatus(scpb.ToAbsent), + from.CurrentStatus(scpb.Status_WRITE_ONLY), + to.TargetStatus(scpb.ToPublic), + to.CurrentStatus(scpb.Status_PUBLIC), + } + }, + ) } // Special rules partial predicate expressions, which ensure that any columns @@ -170,6 +240,7 @@ func init() { } }, ) + registerDepRuleForDrop( "secondary index partial no longer public before referenced column", scgraph.Precedence, diff --git a/pkg/sql/schemachanger/scplan/internal/rules/current/testdata/deprules b/pkg/sql/schemachanger/scplan/internal/rules/current/testdata/deprules index e72d193bbdbb..31e9cdb4eac1 100644 --- a/pkg/sql/schemachanger/scplan/internal/rules/current/testdata/deprules +++ b/pkg/sql/schemachanger/scplan/internal/rules/current/testdata/deprules @@ -628,6 +628,21 @@ deprules - descriptorIsDataNotBeingAdded-24.1($descID) - joinTargetNode($prev, $prev-Target, $prev-Node) - joinTargetNode($next, $next-Target, $next-Node) +- name: New primary index should go public only after columns being dropped move to WRITE_ONLY + from: column-Node + kind: Precedence + to: new-primary-index-Node + query: + - $column[Type] = '*scpb.Column' + - $new-primary-index[Type] = '*scpb.PrimaryIndex' + - ColumnInSourcePrimaryIndex($index-column, $new-primary-index, $table-id, $column-id, $index-id) + - joinOnColumnID($index-column, $column, $table-id, $column-id) + - $column-Target[TargetStatus] = ABSENT + - $column-Node[CurrentStatus] = WRITE_ONLY + - $new-primary-index-Target[TargetStatus] = PUBLIC + - $new-primary-index-Node[CurrentStatus] = PUBLIC + - joinTargetNode($column, $column-Target, $column-Node) + - joinTargetNode($new-primary-index, $new-primary-index-Target, $new-primary-index-Node) - name: 'PrimaryIndex transitions to ABSENT uphold 2-version invariant: BACKFILLED->DELETE_ONLY' from: prev-Node kind: PreviousTransactionPrecedence @@ -2107,6 +2122,64 @@ deprules - descriptorIsDataNotBeingAdded-24.1($descID) - joinTargetNode($prev, $prev-Target, $prev-Node) - joinTargetNode($next, $next-Target, $next-Node) +- name: Virtual computed column expression is dropped before the column it depends on + from: virtual-column-expr-Node + kind: Precedence + to: column-Node + query: + - $virtual-column-expr[Type] = '*scpb.ColumnType' + - $column[Type] = '*scpb.Column' + - joinOnDescID($virtual-column-expr, $column, $table-id) + - computedColumnTypeReferencesColumn(*scpb.ColumnType, *scpb.Column)($virtual-column-expr, $column) + - toAbsent($virtual-column-expr-Target, $column-Target) + - $virtual-column-expr-Node[CurrentStatus] = ABSENT + - $column-Node[CurrentStatus] = WRITE_ONLY + - joinTargetNode($virtual-column-expr, $virtual-column-expr-Target, $virtual-column-expr-Node) + - joinTargetNode($column, $column-Target, $column-Node) +- name: Virtual computed column expression is dropped before the column it depends on + from: virtual-column-expr-Node + kind: Precedence + to: column-Node + query: + - $virtual-column-expr[Type] = '*scpb.ColumnType' + - $column[Type] = '*scpb.Column' + - joinOnDescID($virtual-column-expr, $column, $table-id) + - computedColumnTypeReferencesColumn(*scpb.ColumnType, *scpb.Column)($virtual-column-expr, $column) + - transient($virtual-column-expr-Target, $column-Target) + - $virtual-column-expr-Node[CurrentStatus] = TRANSIENT_ABSENT + - $column-Node[CurrentStatus] = TRANSIENT_WRITE_ONLY + - joinTargetNode($virtual-column-expr, $virtual-column-expr-Target, $virtual-column-expr-Node) + - joinTargetNode($column, $column-Target, $column-Node) +- name: Virtual computed column expression is dropped before the column it depends on + from: virtual-column-expr-Node + kind: Precedence + to: column-Node + query: + - $virtual-column-expr[Type] = '*scpb.ColumnType' + - $column[Type] = '*scpb.Column' + - joinOnDescID($virtual-column-expr, $column, $table-id) + - computedColumnTypeReferencesColumn(*scpb.ColumnType, *scpb.Column)($virtual-column-expr, $column) + - $virtual-column-expr-Target[TargetStatus] = TRANSIENT_ABSENT + - $virtual-column-expr-Node[CurrentStatus] = TRANSIENT_ABSENT + - $column-Target[TargetStatus] = ABSENT + - $column-Node[CurrentStatus] = WRITE_ONLY + - joinTargetNode($virtual-column-expr, $virtual-column-expr-Target, $virtual-column-expr-Node) + - joinTargetNode($column, $column-Target, $column-Node) +- name: Virtual computed column expression is dropped before the column it depends on + from: virtual-column-expr-Node + kind: Precedence + to: column-Node + query: + - $virtual-column-expr[Type] = '*scpb.ColumnType' + - $column[Type] = '*scpb.Column' + - joinOnDescID($virtual-column-expr, $column, $table-id) + - computedColumnTypeReferencesColumn(*scpb.ColumnType, *scpb.Column)($virtual-column-expr, $column) + - $virtual-column-expr-Target[TargetStatus] = ABSENT + - $virtual-column-expr-Node[CurrentStatus] = ABSENT + - $column-Target[TargetStatus] = TRANSIENT_ABSENT + - $column-Node[CurrentStatus] = TRANSIENT_WRITE_ONLY + - joinTargetNode($virtual-column-expr, $virtual-column-expr-Target, $virtual-column-expr-Node) + - joinTargetNode($column, $column-Target, $column-Node) - name: all adding indexes reached BACKFILL_ONLY before any of their columns disappear from: index-Node kind: Precedence @@ -2959,7 +3032,7 @@ deprules - joinTargetNode($data, $data-Target, $data-Node) - name: ensure columns are in increasing order from: later-column-Node - kind: SameStagePrecedence + kind: Precedence to: earlier-column-Node query: - $later-column[Type] = '*scpb.Column' @@ -4711,6 +4784,21 @@ deprules - descriptorIsDataNotBeingAdded-24.1($descID) - joinTargetNode($prev, $prev-Target, $prev-Node) - joinTargetNode($next, $next-Target, $next-Node) +- name: New primary index should go public only after columns being dropped move to WRITE_ONLY + from: column-Node + kind: Precedence + to: new-primary-index-Node + query: + - $column[Type] = '*scpb.Column' + - $new-primary-index[Type] = '*scpb.PrimaryIndex' + - ColumnInSourcePrimaryIndex($index-column, $new-primary-index, $table-id, $column-id, $index-id) + - joinOnColumnID($index-column, $column, $table-id, $column-id) + - $column-Target[TargetStatus] = ABSENT + - $column-Node[CurrentStatus] = WRITE_ONLY + - $new-primary-index-Target[TargetStatus] = PUBLIC + - $new-primary-index-Node[CurrentStatus] = PUBLIC + - joinTargetNode($column, $column-Target, $column-Node) + - joinTargetNode($new-primary-index, $new-primary-index-Target, $new-primary-index-Node) - name: 'PrimaryIndex transitions to ABSENT uphold 2-version invariant: BACKFILLED->DELETE_ONLY' from: prev-Node kind: PreviousTransactionPrecedence @@ -6190,6 +6278,64 @@ deprules - descriptorIsDataNotBeingAdded-24.1($descID) - joinTargetNode($prev, $prev-Target, $prev-Node) - joinTargetNode($next, $next-Target, $next-Node) +- name: Virtual computed column expression is dropped before the column it depends on + from: virtual-column-expr-Node + kind: Precedence + to: column-Node + query: + - $virtual-column-expr[Type] = '*scpb.ColumnType' + - $column[Type] = '*scpb.Column' + - joinOnDescID($virtual-column-expr, $column, $table-id) + - computedColumnTypeReferencesColumn(*scpb.ColumnType, *scpb.Column)($virtual-column-expr, $column) + - toAbsent($virtual-column-expr-Target, $column-Target) + - $virtual-column-expr-Node[CurrentStatus] = ABSENT + - $column-Node[CurrentStatus] = WRITE_ONLY + - joinTargetNode($virtual-column-expr, $virtual-column-expr-Target, $virtual-column-expr-Node) + - joinTargetNode($column, $column-Target, $column-Node) +- name: Virtual computed column expression is dropped before the column it depends on + from: virtual-column-expr-Node + kind: Precedence + to: column-Node + query: + - $virtual-column-expr[Type] = '*scpb.ColumnType' + - $column[Type] = '*scpb.Column' + - joinOnDescID($virtual-column-expr, $column, $table-id) + - computedColumnTypeReferencesColumn(*scpb.ColumnType, *scpb.Column)($virtual-column-expr, $column) + - transient($virtual-column-expr-Target, $column-Target) + - $virtual-column-expr-Node[CurrentStatus] = TRANSIENT_ABSENT + - $column-Node[CurrentStatus] = TRANSIENT_WRITE_ONLY + - joinTargetNode($virtual-column-expr, $virtual-column-expr-Target, $virtual-column-expr-Node) + - joinTargetNode($column, $column-Target, $column-Node) +- name: Virtual computed column expression is dropped before the column it depends on + from: virtual-column-expr-Node + kind: Precedence + to: column-Node + query: + - $virtual-column-expr[Type] = '*scpb.ColumnType' + - $column[Type] = '*scpb.Column' + - joinOnDescID($virtual-column-expr, $column, $table-id) + - computedColumnTypeReferencesColumn(*scpb.ColumnType, *scpb.Column)($virtual-column-expr, $column) + - $virtual-column-expr-Target[TargetStatus] = TRANSIENT_ABSENT + - $virtual-column-expr-Node[CurrentStatus] = TRANSIENT_ABSENT + - $column-Target[TargetStatus] = ABSENT + - $column-Node[CurrentStatus] = WRITE_ONLY + - joinTargetNode($virtual-column-expr, $virtual-column-expr-Target, $virtual-column-expr-Node) + - joinTargetNode($column, $column-Target, $column-Node) +- name: Virtual computed column expression is dropped before the column it depends on + from: virtual-column-expr-Node + kind: Precedence + to: column-Node + query: + - $virtual-column-expr[Type] = '*scpb.ColumnType' + - $column[Type] = '*scpb.Column' + - joinOnDescID($virtual-column-expr, $column, $table-id) + - computedColumnTypeReferencesColumn(*scpb.ColumnType, *scpb.Column)($virtual-column-expr, $column) + - $virtual-column-expr-Target[TargetStatus] = ABSENT + - $virtual-column-expr-Node[CurrentStatus] = ABSENT + - $column-Target[TargetStatus] = TRANSIENT_ABSENT + - $column-Node[CurrentStatus] = TRANSIENT_WRITE_ONLY + - joinTargetNode($virtual-column-expr, $virtual-column-expr-Target, $virtual-column-expr-Node) + - joinTargetNode($column, $column-Target, $column-Node) - name: all adding indexes reached BACKFILL_ONLY before any of their columns disappear from: index-Node kind: Precedence @@ -7042,7 +7188,7 @@ deprules - joinTargetNode($data, $data-Target, $data-Node) - name: ensure columns are in increasing order from: later-column-Node - kind: SameStagePrecedence + kind: Precedence to: earlier-column-Node query: - $later-column[Type] = '*scpb.Column' diff --git a/pkg/sql/schemachanger/scplan/internal/rules/helpers.go b/pkg/sql/schemachanger/scplan/internal/rules/helpers.go index ff4c34c2c694..9889d08daf80 100644 --- a/pkg/sql/schemachanger/scplan/internal/rules/helpers.go +++ b/pkg/sql/schemachanger/scplan/internal/rules/helpers.go @@ -140,6 +140,12 @@ func ColumnInSwappedInPrimaryIndex( return columnInSwappedInPrimaryIndexUntyped(indexColumn.El, index.El, relationIDVar, columnIDVar, indexIDVar) } +func ColumnInSourcePrimaryIndex( + indexColumn, index NodeVars, relationIDVar, columnIDVar, indexIDVar rel.Var, +) rel.Clause { + return columnInSourcePrimaryIndex(indexColumn.El, index.El, relationIDVar, columnIDVar, indexIDVar) +} + // IsPotentialSecondaryIndexSwap determines if a secondary index recreate is // occurring because of a primary key alter. func IsPotentialSecondaryIndexSwap(indexIdVar rel.Var, tableIDVar rel.Var) rel.Clauses { @@ -292,6 +298,21 @@ var ( } }) + columnInSourcePrimaryIndex = screl.Schema.Def5( + "ColumnInSourcePrimaryIndex", + "index-column", "index", "table-id", "column-id", "index-id", func( + indexColumn, index, tableID, columnID, indexID rel.Var, + ) rel.Clauses { + return rel.Clauses{ + indexColumn.Type((*scpb.IndexColumn)(nil)), + indexColumn.AttrEqVar(screl.DescID, tableID), + indexColumn.AttrEqVar(screl.ColumnID, columnID), + indexColumn.AttrEqVar(screl.IndexID, indexID), + index.AttrEqVar(screl.SourceIndexID, indexID), + JoinOnDescIDUntyped(index, indexColumn, tableID), + } + }) + // IsNotPotentialSecondaryIndexSwap determines if no secondary index recreation // is happening because of a primary key alter. IsNotPotentialSecondaryIndexSwap = screl.Schema.DefNotJoin2("no secondary index swap is on going", diff --git a/pkg/sql/schemachanger/scplan/testdata/alter_table_alter_primary_key b/pkg/sql/schemachanger/scplan/testdata/alter_table_alter_primary_key index 0e29418667b4..ecd7e5ad5046 100644 --- a/pkg/sql/schemachanger/scplan/testdata/alter_table_alter_primary_key +++ b/pkg/sql/schemachanger/scplan/testdata/alter_table_alter_primary_key @@ -635,6 +635,10 @@ ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (k); to: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3}, TRANSIENT_ABSENT] kind: Precedence rule: column no longer public before dependents +- from: [Column:{DescID: 104, ColumnID: 3}, WRITE_ONLY] + to: [PrimaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2}, PUBLIC] + kind: Precedence + rule: New primary index should go public only after columns being dropped move to WRITE_ONLY - from: [ColumnDefaultExpression:{DescID: 104, ColumnID: 3, Expr: unique_rowid()}, ABSENT] to: [Column:{DescID: 104, ColumnID: 3}, ABSENT] kind: Precedence diff --git a/pkg/sql/schemachanger/scplan/testdata/alter_table_drop_column b/pkg/sql/schemachanger/scplan/testdata/alter_table_drop_column index addc712c5600..8cfc72501a34 100644 --- a/pkg/sql/schemachanger/scplan/testdata/alter_table_drop_column +++ b/pkg/sql/schemachanger/scplan/testdata/alter_table_drop_column @@ -788,6 +788,10 @@ ALTER TABLE defaultdb.foo DROP COLUMN v1 CASCADE; to: [IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 2}, ABSENT] kind: Precedence rule: column no longer public before dependents +- from: [Column:{DescID: 107, ColumnID: 2}, WRITE_ONLY] + to: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, PUBLIC] + kind: Precedence + rule: New primary index should go public only after columns being dropped move to WRITE_ONLY - from: [Column:{DescID: 108, ColumnID: 1}, ABSENT] to: [View:{DescID: 108}, ABSENT] kind: Precedence @@ -2146,6 +2150,10 @@ ALTER TABLE defaultdb.foo DROP COLUMN v2 CASCADE; to: [IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 2}, ABSENT] kind: Precedence rule: column no longer public before dependents +- from: [Column:{DescID: 107, ColumnID: 3}, WRITE_ONLY] + to: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, PUBLIC] + kind: Precedence + rule: New primary index should go public only after columns being dropped move to WRITE_ONLY - from: [Column:{DescID: 108, ColumnID: 1}, ABSENT] to: [View:{DescID: 108}, ABSENT] kind: Precedence @@ -3157,6 +3165,10 @@ ALTER TABLE defaultdb.foo DROP COLUMN udfcol; to: [IndexColumn:{DescID: 107, ColumnID: 4, IndexID: 1}, ABSENT] kind: Precedence rule: column no longer public before dependents +- from: [Column:{DescID: 107, ColumnID: 4}, WRITE_ONLY] + to: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, PUBLIC] + kind: Precedence + rule: New primary index should go public only after columns being dropped move to WRITE_ONLY - from: [ColumnDefaultExpression:{DescID: 107, ColumnID: 4, Expr: [FUNCTION 100109](), ReferencedFunctionIDs: [109]}, ABSENT] to: [Column:{DescID: 107, ColumnID: 4}, ABSENT] kind: Precedence diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index.explain index fc161bf39a90..bbe40cc854c9 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index.explain @@ -14,15 +14,11 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── 2 elements transitioning toward TRANSIENT_ABSENT │ │ ├── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4, ConstraintID: 3, SourceIndexID: 1 (t_pkey-)} │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4} - │ ├── 5 elements transitioning toward ABSENT - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j-)} + │ ├── 3 elements transitioning toward ABSENT │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104 (t), ColumnID: 3 (crdb_internal_idx_expr-)} │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 3 (crdb_internal_idx_expr-)} │ │ └── PUBLIC → VALIDATED SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_idx-), RecreateSourceIndexID: 0} - │ └── 9 Mutation operations - │ ├── MakePublicColumnWriteOnly {"ColumnID":2,"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":104} + │ └── 7 Mutation operations │ ├── MakePublicSecondaryIndexWriteOnly {"IndexID":2,"TableID":104} │ ├── MakeAbsentIndexBackfilling {"Index":{"ConstraintID":2,"IndexID":3,"IsUnique":true,"SourceIndexID":1,"TableID":104,"TemporaryIndexID":4}} │ ├── AddColumnToIndex {"ColumnID":1,"IndexID":3,"TableID":104} @@ -39,9 +35,7 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── 2 elements transitioning toward TRANSIENT_ABSENT │ │ │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4, ConstraintID: 3, SourceIndexID: 1 (t_pkey-)} │ │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4} - │ │ ├── 5 elements transitioning toward ABSENT - │ │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j-)} - │ │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j-)} + │ │ ├── 3 elements transitioning toward ABSENT │ │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 3 (crdb_internal_idx_expr-)} │ │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 3 (crdb_internal_idx_expr-)} │ │ │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_idx-), RecreateSourceIndexID: 0} @@ -55,15 +49,11 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── 2 elements transitioning toward TRANSIENT_ABSENT │ │ ├── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4, ConstraintID: 3, SourceIndexID: 1 (t_pkey-)} │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4} - │ ├── 5 elements transitioning toward ABSENT - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j-)} + │ ├── 3 elements transitioning toward ABSENT │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104 (t), ColumnID: 3 (crdb_internal_idx_expr-)} │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 3 (crdb_internal_idx_expr-)} │ │ └── PUBLIC → VALIDATED SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_idx-), RecreateSourceIndexID: 0} - │ └── 13 Mutation operations - │ ├── MakePublicColumnWriteOnly {"ColumnID":2,"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":104} + │ └── 11 Mutation operations │ ├── MakePublicSecondaryIndexWriteOnly {"IndexID":2,"TableID":104} │ ├── MakeAbsentIndexBackfilling {"Index":{"ConstraintID":2,"IndexID":3,"IsUnique":true,"SourceIndexID":1,"TableID":104,"TemporaryIndexID":4}} │ ├── MaybeAddSplitForIndex {"IndexID":3,"TableID":104} @@ -124,54 +114,63 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ └── 1 Validation operation │ └── ValidateIndex {"IndexID":3,"TableID":104} └── PostCommitNonRevertiblePhase - ├── Stage 1 of 3 in PostCommitNonRevertiblePhase - │ ├── 2 elements transitioning toward PUBLIC - │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey+), ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1 (t_pkey-)} - │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 3 (t_pkey+)} + ├── Stage 1 of 4 in PostCommitNonRevertiblePhase │ ├── 2 elements transitioning toward TRANSIENT_ABSENT │ │ ├── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4, ConstraintID: 3, SourceIndexID: 1 (t_pkey-)} │ │ └── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4} - │ ├── 8 elements transitioning toward ABSENT - │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} + │ ├── 5 elements transitioning toward ABSENT │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104 (t), ColumnID: 3 (crdb_internal_idx_expr-)} - │ │ ├── PUBLIC → VALIDATED PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} - │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 1 (t_pkey-)} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (crdb_internal_idx_expr-), IndexID: 2 (t_expr_idx-)} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 2 (t_expr_idx-)} │ │ ├── VALIDATED → DELETE_ONLY SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_idx-), RecreateSourceIndexID: 0} │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "t_expr_idx", IndexID: 2 (t_expr_idx-)} - │ └── 14 Mutation operations - │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":104} + │ └── 9 Mutation operations │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":3,"TableID":104} - │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":1,"TableID":104} - │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":104} - │ ├── SetIndexName {"IndexID":3,"Name":"t_pkey","TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} - │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":3,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":2,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"Kind":1,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - ├── Stage 2 of 3 in PostCommitNonRevertiblePhase - │ ├── 6 elements transitioning toward ABSENT - │ │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104 (t), ColumnID: 3 (crdb_internal_idx_expr-)} - │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104 (t), ColumnFamilyID: 0 (primary), ColumnID: 3 (crdb_internal_idx_expr-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 1 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 2 (j-), IndexID: 1 (t_pkey-)} - │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} - │ │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_idx-), RecreateSourceIndexID: 0} - │ └── 7 Mutation operations + ├── Stage 2 of 4 in PostCommitNonRevertiblePhase + │ ├── 2 elements transitioning toward PUBLIC + │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey+), ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1 (t_pkey-)} + │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 3 (t_pkey+)} + │ ├── 7 elements transitioning toward ABSENT + │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} + │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j-)} + │ │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104 (t), ColumnID: 3 (crdb_internal_idx_expr-)} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104 (t), ColumnFamilyID: 0 (primary), ColumnID: 3 (crdb_internal_idx_expr-)} + │ │ ├── PUBLIC → VALIDATED PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} + │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 1 (t_pkey-)} + │ │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_idx-), RecreateSourceIndexID: 0} + │ └── 10 Mutation operations + │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":1,"TableID":104} + │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} + │ ├── SetIndexName {"IndexID":3,"Name":"t_pkey","TableID":104} + │ ├── MakePublicColumnWriteOnly {"ColumnID":2,"TableID":104} + │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":104} │ ├── MakeDeleteOnlyColumnAbsent {"ColumnID":3,"TableID":104} + │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":3,"TableID":104} + │ ├── SetJobStateOnDescriptor {"DescriptorID":104} + │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} + ├── Stage 3 of 4 in PostCommitNonRevertiblePhase + │ ├── 4 elements transitioning toward ABSENT + │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} + │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 1 (t_pkey-)} + │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 2 (j-), IndexID: 1 (t_pkey-)} + │ │ └── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} + │ └── 6 Mutation operations + │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":1,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":1,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":1,"Kind":2,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - └── Stage 3 of 3 in PostCommitNonRevertiblePhase + └── Stage 4 of 4 in PostCommitNonRevertiblePhase ├── 1 element transitioning toward TRANSIENT_ABSENT │ └── PUBLIC → TRANSIENT_ABSENT IndexData:{DescID: 104 (t), IndexID: 4} ├── 5 elements transitioning toward ABSENT diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index.explain_shape b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index.explain_shape index 7c1f8ced274c..808de0a83aab 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index.explain_shape +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index.explain_shape @@ -13,4 +13,4 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ └── from t@[4] into t_pkey+ ├── execute 1 system table mutations transaction ├── validate UNIQUE constraint backed by index t_pkey+ in relation t - └── execute 3 system table mutations transactions + └── execute 4 system table mutations transactions diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index.side_effects b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index.side_effects index 5a59477c84bf..ae041889b693 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index.side_effects +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index.side_effects @@ -20,18 +20,11 @@ write *eventpb.AlterTable to event log: tag: ALTER TABLE user: root tableName: defaultdb.public.t -## StatementPhase stage 1 of 1 with 9 MutationType ops +## StatementPhase stage 1 of 1 with 7 MutationType ops upsert descriptor #104 ... oid: 20 width: 64 - - - id: 2 - - name: j - - nullable: true - - type: - - family: IntFamily - - oid: 20 - - width: 64 - - computeExpr: j + 1:::INT8 - id: 3 - inaccessible: true @@ -45,12 +38,6 @@ upsert descriptor #104 createAsOfTime: wallTime: "1640995200000000000" ... - columnNames: - - i - - - j - + - crdb_internal_column_2_name_placeholder - defaultColumnId: 2 - name: primary formatVersion: 3 id: 104 - indexes: @@ -74,17 +61,6 @@ upsert descriptor #104 + indexes: [] modificationTime: {} + mutations: - + - column: - + id: 2 - + name: crdb_internal_column_2_name_placeholder - + nullable: true - + type: - + family: IntFamily - + oid: 20 - + width: 64 - + direction: DROP - + mutationId: 1 - + state: WRITE_ONLY + - direction: DROP + index: + createdAtNanos: "1640995200000000000" @@ -154,7 +130,7 @@ upsert descriptor #104 + mutationId: 1 + state: DELETE_ONLY + - column: - + computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 + + computeExpr: j + 1:::INT8 + id: 3 + inaccessible: true + name: crdb_internal_column_3_name_placeholder @@ -176,13 +152,6 @@ upsert descriptor #104 + nextIndexId: 5 nextMutationId: 1 parentId: 100 - ... - - 2 - storeColumnNames: - - - j - + - crdb_internal_column_2_name_placeholder - unique: true - version: 4 ... time: {} unexposedParentSchemaId: 101 @@ -193,18 +162,11 @@ upsert descriptor #104 ## PreCommitPhase stage 1 of 2 with 1 MutationType op undo all catalog changes within txn #1 persist all catalog changes to storage -## PreCommitPhase stage 2 of 2 with 13 MutationType ops +## PreCommitPhase stage 2 of 2 with 11 MutationType ops upsert descriptor #104 ... oid: 20 width: 64 - - - id: 2 - - name: j - - nullable: true - - type: - - family: IntFamily - - oid: 20 - - width: 64 - - computeExpr: j + 1:::INT8 - id: 3 - inaccessible: true @@ -244,12 +206,6 @@ upsert descriptor #104 families: - columnIds: ... - columnNames: - - i - - - j - + - crdb_internal_column_2_name_placeholder - defaultColumnId: 2 - name: primary formatVersion: 3 id: 104 - indexes: @@ -273,17 +229,6 @@ upsert descriptor #104 + indexes: [] modificationTime: {} + mutations: - + - column: - + id: 2 - + name: crdb_internal_column_2_name_placeholder - + nullable: true - + type: - + family: IntFamily - + oid: 20 - + width: 64 - + direction: DROP - + mutationId: 1 - + state: WRITE_ONLY + - direction: DROP + index: + createdAtNanos: "1640995200000000000" @@ -353,7 +298,7 @@ upsert descriptor #104 + mutationId: 1 + state: DELETE_ONLY + - column: - + computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 + + computeExpr: j + 1:::INT8 + id: 3 + inaccessible: true + name: crdb_internal_column_3_name_placeholder @@ -375,13 +320,6 @@ upsert descriptor #104 + nextIndexId: 5 nextMutationId: 1 parentId: 100 - ... - - 2 - storeColumnNames: - - - j - + - crdb_internal_column_2_name_placeholder - unique: true - version: 4 ... time: {} unexposedParentSchemaId: 101 @@ -405,7 +343,7 @@ upsert descriptor #104 - state: DELETE_ONLY + state: WRITE_ONLY - column: - computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 + computeExpr: j + 1:::INT8 ... time: {} unexposedParentSchemaId: 101 @@ -476,7 +414,7 @@ upsert descriptor #104 - state: WRITE_ONLY + state: DELETE_ONLY - column: - computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 + computeExpr: j + 1:::INT8 ... time: {} unexposedParentSchemaId: 101 @@ -490,7 +428,7 @@ begin transaction #9 validate forward indexes [3] in table #104 commit transaction #9 begin transaction #10 -## PostCommitNonRevertiblePhase stage 1 of 3 with 14 MutationType ops +## PostCommitNonRevertiblePhase stage 1 of 4 with 9 MutationType ops upsert descriptor #104 ... statement: ALTER TABLE t DROP COLUMN j CASCADE @@ -498,13 +436,6 @@ upsert descriptor #104 - revertible: true targetRanks: targets: - ... - direction: DROP - mutationId: 1 - - state: WRITE_ONLY - + state: DELETE_ONLY - - direction: DROP - index: ... keySuffixColumnIds: - 1 @@ -515,17 +446,20 @@ upsert descriptor #104 version: 3 mutationId: 1 - state: WRITE_ONLY - - - direction: ADD + + state: DELETE_ONLY + - direction: ADD + index: + ... + mutationId: 1 + state: WRITE_ONLY + - - direction: DROP - index: - - constraintId: 2 + - constraintId: 3 - createdExplicitly: true - encodingType: 1 - foreignKey: {} - geoConfig: {} - + state: DELETE_ONLY - + - column: - + computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 - id: 3 + - id: 4 - interleave: {} - keyColumnDirections: - - ASC @@ -533,41 +467,93 @@ upsert descriptor #104 - - 1 - keyColumnNames: - - i - - name: crdb_internal_index_3_name_placeholder + - name: crdb_internal_index_4_name_placeholder - partitioning: {} - sharded: {} - storeColumnNames: [] - unique: true + - useDeletePreservingEncoding: true - version: 4 - + inaccessible: true - + name: crdb_internal_column_3_name_placeholder - + nullable: true - + type: - + family: IntFamily - + oid: 20 - + width: 64 - + virtual: true - + direction: DROP + - mutationId: 1 + - state: DELETE_ONLY + - column: + computeExpr: j + 1:::INT8 + ... + direction: DROP mutationId: 1 - state: WRITE_ONLY + state: DELETE_ONLY + name: t + nextColumnId: 4 + ... + time: {} + unexposedParentSchemaId: 101 + - version: "6" + + version: "7" +persist all catalog changes to storage +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 4 with 8 MutationType ops pending" +set schema change job #1 to non-cancellable +commit transaction #10 +begin transaction #11 +## PostCommitNonRevertiblePhase stage 2 of 4 with 10 MutationType ops +upsert descriptor #104 + ... + oid: 20 + width: 64 + - - id: 2 + - name: j + - nullable: true + - type: + - family: IntFamily + - oid: 20 + - width: 64 + createAsOfTime: + wallTime: "1640995200000000000" + ... + columnNames: + - i + - - j + + - crdb_internal_column_2_name_placeholder + defaultColumnId: 2 + name: primary + ... - direction: DROP index: - - constraintId: 3 - - createdExplicitly: true + constraintId: 1 - + createdAtNanos: "1640995200000000000" + createdAtNanos: "1640995200000000000" + - foreignKey: {} + - geoConfig: {} + - id: 2 + - interleave: {} + - keyColumnDirections: + - - ASC + - keyColumnIds: + - - 3 + - keyColumnNames: + - - crdb_internal_column_3_name_placeholder + - keySuffixColumnIds: + - - 1 + - name: crdb_internal_index_2_name_placeholder + - partitioning: {} + - sharded: {} + - version: 3 + - mutationId: 1 + - state: DELETE_ONLY + - - direction: ADD + - index: + - constraintId: 2 + - createdExplicitly: true encodingType: 1 foreignKey: {} geoConfig: {} - - id: 4 + - id: 3 + id: 1 interleave: {} keyColumnDirections: ... keyColumnNames: - i - - name: crdb_internal_index_4_name_placeholder + - name: crdb_internal_index_3_name_placeholder + name: crdb_internal_index_1_name_placeholder partitioning: {} sharded: {} @@ -577,25 +563,28 @@ upsert descriptor #104 + storeColumnNames: + - crdb_internal_column_2_name_placeholder unique: true - - useDeletePreservingEncoding: true version: 4 - mutationId: 1 - - state: DELETE_ONLY - - - column: - - computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 + ... + state: WRITE_ONLY + - column: + - computeExpr: j + 1:::INT8 - id: 3 - inaccessible: true - name: crdb_internal_column_3_name_placeholder - - nullable: true - - type: - - family: IntFamily - - oid: 20 - - width: 64 + + id: 2 + + name: crdb_internal_column_2_name_placeholder + nullable: true + type: + ... + oid: 20 + width: 64 - virtual: true - - direction: DROP - - mutationId: 1 - state: WRITE_ONLY + direction: DROP + mutationId: 1 + - state: DELETE_ONLY + + state: WRITE_ONLY name: t + nextColumnId: 4 ... parentId: 100 primaryIndex: @@ -616,79 +605,45 @@ upsert descriptor #104 - storeColumnIds: - - 2 - storeColumnNames: - - - crdb_internal_column_2_name_placeholder + - - j + storeColumnNames: [] unique: true version: 4 ... time: {} unexposedParentSchemaId: 101 - - version: "6" - + version: "7" + - version: "7" + + version: "8" persist all catalog changes to storage -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 3 with 5 MutationType ops pending" -set schema change job #1 to non-cancellable -commit transaction #10 -begin transaction #11 -## PostCommitNonRevertiblePhase stage 2 of 3 with 7 MutationType ops +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 4 with 4 MutationType ops pending" +commit transaction #11 +begin transaction #12 +## PostCommitNonRevertiblePhase stage 3 of 4 with 6 MutationType ops upsert descriptor #104 - ... - - direction: DROP - index: - - createdAtNanos: "1640995200000000000" - - foreignKey: {} - - geoConfig: {} - - id: 2 - - interleave: {} - - keyColumnDirections: - - - ASC - - keyColumnIds: - - - 3 - - keyColumnNames: - - - crdb_internal_column_3_name_placeholder - - keySuffixColumnIds: - - - 1 - - name: crdb_internal_index_2_name_placeholder - - partitioning: {} - - sharded: {} - - version: 3 - - mutationId: 1 - - state: DELETE_ONLY - - - column: - - computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 - - id: 3 - - inaccessible: true - - name: crdb_internal_column_3_name_placeholder - - nullable: true - - type: - - family: IntFamily - - oid: 20 - - width: 64 - - virtual: true - - direction: DROP - - mutationId: 1 - - state: DELETE_ONLY - - - direction: DROP - - index: - constraintId: 1 - createdAtNanos: "1640995200000000000" ... version: 4 mutationId: 1 - state: WRITE_ONLY + + state: DELETE_ONLY + - column: + id: 2 + ... + direction: DROP + mutationId: 1 + - state: WRITE_ONLY + state: DELETE_ONLY name: t nextColumnId: 4 ... time: {} unexposedParentSchemaId: 101 - - version: "7" - + version: "8" + - version: "8" + + version: "9" persist all catalog changes to storage -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 3 with 5 MutationType ops pending" -commit transaction #11 -begin transaction #12 -## PostCommitNonRevertiblePhase stage 3 of 3 with 7 MutationType ops +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 4 of 4 with 5 MutationType ops pending" +commit transaction #12 +begin transaction #13 +## PostCommitNonRevertiblePhase stage 4 of 4 with 7 MutationType ops upsert descriptor #104 ... createAsOfTime: @@ -729,17 +684,6 @@ upsert descriptor #104 indexes: [] modificationTime: {} - mutations: - - - column: - - id: 2 - - name: crdb_internal_column_2_name_placeholder - - nullable: true - - type: - - family: IntFamily - - oid: 20 - - width: 64 - - direction: DROP - - mutationId: 1 - - state: DELETE_ONLY - - direction: DROP - index: - constraintId: 1 @@ -766,14 +710,25 @@ upsert descriptor #104 - version: 4 - mutationId: 1 - state: DELETE_ONLY + - - column: + - id: 2 + - name: crdb_internal_column_2_name_placeholder + - nullable: true + - type: + - family: IntFamily + - oid: 20 + - width: 64 + - direction: DROP + - mutationId: 1 + - state: DELETE_ONLY + mutations: [] name: t nextColumnId: 4 ... time: {} unexposedParentSchemaId: 101 - - version: "8" - + version: "9" + - version: "9" + + version: "10" persist all catalog changes to storage create job #2 (non-cancelable: true): "GC for ALTER TABLE defaultdb.public.t DROP COLUMN j CASCADE" descriptor IDs: [104] @@ -783,6 +738,6 @@ updated schema change job #1 descriptor IDs to [] write *eventpb.FinishSchemaChange to event log: sc: descriptorId: 104 -commit transaction #12 +commit transaction #13 notified job registry to adopt jobs: [2] # end PostCommitPhase diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_1_of_7.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_1_of_7.explain index ac4335c60b85..0383241353f0 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_1_of_7.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_1_of_7.explain @@ -8,9 +8,7 @@ EXPLAIN (DDL) rollback at post-commit stage 1 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase └── Stage 1 of 1 in PostCommitNonRevertiblePhase - ├── 5 elements transitioning toward PUBLIC - │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} - │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} + ├── 3 elements transitioning toward PUBLIC │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 3 (crdb_internal_idx_expr+)} │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 3 (crdb_internal_idx_expr+)} │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_idx+), RecreateSourceIndexID: 0} @@ -20,15 +18,12 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 3 (t_pkey-)} │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4, ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4} - └── 15 Mutation operations - ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} + └── 12 Mutation operations ├── SetColumnName {"ColumnID":3,"Name":"crdb_internal_id...","TableID":104} ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} ├── RefreshStats {"TableID":104} ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - ├── RefreshStats {"TableID":104} ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} ├── RefreshStats {"TableID":104} ├── MakeIndexAbsent {"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_2_of_7.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_2_of_7.explain index 769592c7c4c6..f9c1a898a6b4 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_2_of_7.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_2_of_7.explain @@ -8,9 +8,7 @@ EXPLAIN (DDL) rollback at post-commit stage 2 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 5 elements transitioning toward PUBLIC - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} + │ ├── 3 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 3 (crdb_internal_idx_expr+)} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 3 (crdb_internal_idx_expr+)} │ │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_idx+), RecreateSourceIndexID: 0} @@ -19,16 +17,13 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4, ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4} - │ └── 14 Mutation operations - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} + │ └── 11 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"crdb_internal_id...","TableID":104} │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_3_of_7.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_3_of_7.explain index 404ab440a20e..661af8da569f 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_3_of_7.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_3_of_7.explain @@ -8,9 +8,7 @@ EXPLAIN (DDL) rollback at post-commit stage 3 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 5 elements transitioning toward PUBLIC - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} + │ ├── 3 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 3 (crdb_internal_idx_expr+)} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 3 (crdb_internal_idx_expr+)} │ │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_idx+), RecreateSourceIndexID: 0} @@ -19,16 +17,13 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4, ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4} - │ └── 14 Mutation operations - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} + │ └── 11 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"crdb_internal_id...","TableID":104} │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_4_of_7.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_4_of_7.explain index 3548491afbf9..678b204e102e 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_4_of_7.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_4_of_7.explain @@ -8,9 +8,7 @@ EXPLAIN (DDL) rollback at post-commit stage 4 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 5 elements transitioning toward PUBLIC - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} + │ ├── 3 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 3 (crdb_internal_idx_expr+)} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 3 (crdb_internal_idx_expr+)} │ │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_idx+), RecreateSourceIndexID: 0} @@ -19,16 +17,13 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4, ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4} - │ └── 14 Mutation operations - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} + │ └── 11 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"crdb_internal_id...","TableID":104} │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_5_of_7.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_5_of_7.explain index 9e171587c8a0..d5bbdd08fde2 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_5_of_7.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_5_of_7.explain @@ -8,9 +8,7 @@ EXPLAIN (DDL) rollback at post-commit stage 5 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 5 elements transitioning toward PUBLIC - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} + │ ├── 3 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 3 (crdb_internal_idx_expr+)} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 3 (crdb_internal_idx_expr+)} │ │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_idx+), RecreateSourceIndexID: 0} @@ -19,15 +17,12 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4, ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4} - │ └── 14 Mutation operations - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} + │ └── 11 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"crdb_internal_id...","TableID":104} │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_6_of_7.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_6_of_7.explain index 818a6c572c9b..c5fb74046d79 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_6_of_7.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_6_of_7.explain @@ -8,9 +8,7 @@ EXPLAIN (DDL) rollback at post-commit stage 6 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 5 elements transitioning toward PUBLIC - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} + │ ├── 3 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 3 (crdb_internal_idx_expr+)} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 3 (crdb_internal_idx_expr+)} │ │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_idx+), RecreateSourceIndexID: 0} @@ -19,15 +17,12 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4, ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4} - │ └── 14 Mutation operations - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} + │ └── 11 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"crdb_internal_id...","TableID":104} │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_7_of_7.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_7_of_7.explain index d3f227a380a8..cd42c735b8a3 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_7_of_7.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index/drop_column_computed_index__rollback_7_of_7.explain @@ -8,9 +8,7 @@ EXPLAIN (DDL) rollback at post-commit stage 7 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 5 elements transitioning toward PUBLIC - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} + │ ├── 3 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 3 (crdb_internal_idx_expr+)} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 3 (crdb_internal_idx_expr+)} │ │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_idx+), RecreateSourceIndexID: 0} @@ -19,16 +17,13 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} │ │ ├── TRANSIENT_DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4, ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4} - │ └── 14 Mutation operations - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} + │ └── 11 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"crdb_internal_id...","TableID":104} │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements.side_effects b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements.side_effects index 844afc147524..575c7520bdac 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements.side_effects +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements.side_effects @@ -21,20 +21,8 @@ write *eventpb.AlterTable to event log: tag: ALTER TABLE user: root tableName: defaultdb.public.t -## StatementPhase stage 1 of 1 with 11 MutationType ops +## StatementPhase stage 1 of 1 with 9 MutationType ops upsert descriptor #104 - ... - oid: 20 - width: 64 - - - id: 2 - - name: j - - nullable: true - - type: - - family: IntFamily - - oid: 20 - - width: 64 - - defaultExpr: 32:::INT8 - id: 3 ... oid: 20 width: 64 @@ -51,12 +39,6 @@ upsert descriptor #104 createAsOfTime: wallTime: "1640995200000000000" ... - columnNames: - - i - - - j - + - crdb_internal_column_2_name_placeholder - - k - name: primary formatVersion: 3 id: 104 - indexes: @@ -83,17 +65,6 @@ upsert descriptor #104 + indexes: [] modificationTime: {} + mutations: - + - column: - + id: 2 - + name: crdb_internal_column_2_name_placeholder - + nullable: true - + type: - + family: IntFamily - + oid: 20 - + width: 64 - + direction: DROP - + mutationId: 1 - + state: WRITE_ONLY + - direction: DROP + index: + createdAtNanos: "1640995200000000000" @@ -172,7 +143,7 @@ upsert descriptor #104 + mutationId: 1 + state: DELETE_ONLY + - column: - + computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 + + computeExpr: j + 1:::INT8 + id: 4 + inaccessible: true + name: crdb_internal_column_4_name_placeholder @@ -194,13 +165,6 @@ upsert descriptor #104 + nextIndexId: 5 nextMutationId: 1 parentId: 100 - ... - - 3 - storeColumnNames: - - - j - + - crdb_internal_column_2_name_placeholder - - k - unique: true ... time: {} unexposedParentSchemaId: 101 @@ -223,20 +187,8 @@ write *eventpb.CreateIndex to event log: ## PreCommitPhase stage 1 of 2 with 1 MutationType op undo all catalog changes within txn #1 persist all catalog changes to storage -## PreCommitPhase stage 2 of 2 with 15 MutationType ops +## PreCommitPhase stage 2 of 2 with 13 MutationType ops upsert descriptor #104 - ... - oid: 20 - width: 64 - - - id: 2 - - name: j - - nullable: true - - type: - - family: IntFamily - - oid: 20 - - width: 64 - - defaultExpr: 32:::INT8 - id: 3 ... oid: 20 width: 64 @@ -260,7 +212,6 @@ upsert descriptor #104 + nameMapping: + columns: + "1": i - + "2": crdb_internal_column_2_name_placeholder + "3": k + "4": crdb_internal_column_4_name_placeholder + "4294967294": tableoid @@ -289,12 +240,6 @@ upsert descriptor #104 families: - columnIds: ... - columnNames: - - i - - - j - + - crdb_internal_column_2_name_placeholder - - k - name: primary formatVersion: 3 id: 104 - indexes: @@ -321,17 +266,6 @@ upsert descriptor #104 + indexes: [] modificationTime: {} + mutations: - + - column: - + id: 2 - + name: crdb_internal_column_2_name_placeholder - + nullable: true - + type: - + family: IntFamily - + oid: 20 - + width: 64 - + direction: DROP - + mutationId: 1 - + state: WRITE_ONLY + - direction: DROP + index: + createdAtNanos: "1640995200000000000" @@ -410,7 +344,7 @@ upsert descriptor #104 + mutationId: 1 + state: DELETE_ONLY + - column: - + computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 + + computeExpr: j + 1:::INT8 + id: 4 + inaccessible: true + name: crdb_internal_column_4_name_placeholder @@ -432,13 +366,6 @@ upsert descriptor #104 + nextIndexId: 5 nextMutationId: 1 parentId: 100 - ... - - 3 - storeColumnNames: - - - j - + - crdb_internal_column_2_name_placeholder - - k - unique: true ... time: {} unexposedParentSchemaId: 101 @@ -454,7 +381,7 @@ notified job registry to adopt jobs: [1] begin transaction #2 commit transaction #2 begin transaction #3 -## PostCommitPhase stage 1 of 15 with 3 MutationType ops +## PostCommitPhase stage 1 of 7 with 3 MutationType ops upsert descriptor #104 ... version: 4 @@ -462,21 +389,21 @@ upsert descriptor #104 - state: DELETE_ONLY + state: WRITE_ONLY - column: - computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 + computeExpr: j + 1:::INT8 ... time: {} unexposedParentSchemaId: 101 - version: "2" + version: "3" persist all catalog changes to storage -update progress of schema change job #1: "PostCommitPhase stage 2 of 15 with 1 BackfillType op pending" +update progress of schema change job #1: "PostCommitPhase stage 2 of 7 with 1 BackfillType op pending" commit transaction #3 begin transaction #4 -## PostCommitPhase stage 2 of 15 with 1 BackfillType op +## PostCommitPhase stage 2 of 7 with 1 BackfillType op backfill indexes [3] from index #1 in table #104 commit transaction #4 begin transaction #5 -## PostCommitPhase stage 3 of 15 with 3 MutationType ops +## PostCommitPhase stage 3 of 7 with 3 MutationType ops upsert descriptor #104 ... version: 4 @@ -491,10 +418,10 @@ upsert descriptor #104 - version: "3" + version: "4" persist all catalog changes to storage -update progress of schema change job #1: "PostCommitPhase stage 4 of 15 with 1 MutationType op pending" +update progress of schema change job #1: "PostCommitPhase stage 4 of 7 with 1 MutationType op pending" commit transaction #5 begin transaction #6 -## PostCommitPhase stage 4 of 15 with 3 MutationType ops +## PostCommitPhase stage 4 of 7 with 3 MutationType ops upsert descriptor #104 ... version: 4 @@ -509,14 +436,14 @@ upsert descriptor #104 - version: "4" + version: "5" persist all catalog changes to storage -update progress of schema change job #1: "PostCommitPhase stage 5 of 15 with 1 BackfillType op pending" +update progress of schema change job #1: "PostCommitPhase stage 5 of 7 with 1 BackfillType op pending" commit transaction #6 begin transaction #7 -## PostCommitPhase stage 5 of 15 with 1 BackfillType op +## PostCommitPhase stage 5 of 7 with 1 BackfillType op merge temporary indexes [4] into backfilled indexes [3] in table #104 commit transaction #7 begin transaction #8 -## PostCommitPhase stage 6 of 15 with 4 MutationType ops +## PostCommitPhase stage 6 of 7 with 4 MutationType ops upsert descriptor #104 ... version: 4 @@ -533,96 +460,151 @@ upsert descriptor #104 - state: WRITE_ONLY + state: DELETE_ONLY - column: - computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 + computeExpr: j + 1:::INT8 ... time: {} unexposedParentSchemaId: 101 - version: "5" + version: "6" persist all catalog changes to storage -update progress of schema change job #1: "PostCommitPhase stage 7 of 15 with 1 ValidationType op pending" +update progress of schema change job #1: "PostCommitPhase stage 7 of 7 with 1 ValidationType op pending" commit transaction #8 begin transaction #9 -## PostCommitPhase stage 7 of 15 with 1 ValidationType op +## PostCommitPhase stage 7 of 7 with 1 ValidationType op validate forward indexes [3] in table #104 commit transaction #9 begin transaction #10 -## PostCommitPhase stage 8 of 15 with 15 MutationType ops +## PostCommitNonRevertiblePhase stage 1 of 10 with 11 MutationType ops upsert descriptor #104 ... - mutationId: 1 - state: WRITE_ONLY - - - direction: ADD - + - direction: DROP - index: - - constraintId: 2 - + constraintId: 3 - createdExplicitly: true - encodingType: 1 - foreignKey: {} - geoConfig: {} - - id: 3 - + id: 4 - interleave: {} - keyColumnDirections: + statementTag: CREATE INDEX + statementRank: 1 + - revertible: true + targetRanks: + targets: ... - keyColumnNames: - - i - - name: crdb_internal_index_3_name_placeholder - + name: crdb_internal_index_4_name_placeholder + keySuffixColumnIds: + - 1 + - name: t_expr_k_idx + + name: crdb_internal_index_2_name_placeholder partitioning: {} sharded: {} - ... - - k - unique: true - + useDeletePreservingEncoding: true - version: 4 + version: 3 mutationId: 1 + - state: WRITE_ONLY + state: DELETE_ONLY - + - column: - + computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 - + id: 4 - + inaccessible: true - + name: crdb_internal_column_4_name_placeholder - + nullable: true - + type: - + family: IntFamily - + oid: 20 - + width: 64 - + virtual: true - + direction: DROP - + mutationId: 1 - state: WRITE_ONLY - - direction: DROP + - direction: ADD index: + ... + mutationId: 1 + state: WRITE_ONLY + - - direction: DROP + - index: - constraintId: 3 - createdExplicitly: true + - encodingType: 1 + - foreignKey: {} + - geoConfig: {} + - id: 4 + - interleave: {} + - keyColumnDirections: + - - ASC + - keyColumnIds: + - - 1 + - keyColumnNames: + - - i + - name: crdb_internal_index_4_name_placeholder + - partitioning: {} + - sharded: {} + - storeColumnIds: + - - 3 + - storeColumnNames: + - - k + - unique: true + - useDeletePreservingEncoding: true + - version: 4 + - mutationId: 1 + - state: DELETE_ONLY + - column: + computeExpr: j + 1:::INT8 + ... + direction: DROP + mutationId: 1 + - state: WRITE_ONLY + + state: DELETE_ONLY + name: t + nextColumnId: 5 + ... + time: {} + unexposedParentSchemaId: 101 + - version: "6" + + version: "7" +persist all catalog changes to storage +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 10 with 17 MutationType ops pending" +set schema change job #1 to non-cancellable +commit transaction #10 +begin transaction #11 +## PostCommitNonRevertiblePhase stage 2 of 10 with 19 MutationType ops +upsert descriptor #104 + ... + oid: 20 + width: 64 + - - id: 2 + - name: j + - nullable: true + - type: + - family: IntFamily + - oid: 20 + - width: 64 + - defaultExpr: 32:::INT8 + id: 3 + ... + columnNames: + - i + - - j + + - crdb_internal_column_2_name_placeholder + - k + name: primary + ... + - direction: DROP + index: + constraintId: 1 - + createdAtNanos: "1640995200000000000" - encodingType: 1 + createdAtNanos: "1640995200000000000" + + encodingType: 1 foreignKey: {} geoConfig: {} - - id: 4 + id: 1 - interleave: {} - keyColumnDirections: - ... - keyColumnNames: - - i - - name: crdb_internal_index_4_name_placeholder + + interleave: {} + + keyColumnDirections: + + - ASC + + keyColumnIds: + + - 1 + + keyColumnNames: + + - i + name: crdb_internal_index_1_name_placeholder - partitioning: {} - sharded: {} - storeColumnIds: + + partitioning: {} + + sharded: {} + + storeColumnIds: + - 2 - - 3 - storeColumnNames: + + - 3 + + storeColumnNames: + - crdb_internal_column_2_name_placeholder - - k - unique: true + + - k + + unique: true + version: 4 + mutationId: 1 + state: WRITE_ONLY + + - column: + id: 2 + + name: crdb_internal_column_2_name_placeholder + + nullable: true + + type: + + family: IntFamily + + oid: 20 + + width: 64 + + direction: DROP + + mutationId: 1 + + state: WRITE_ONLY + - direction: ADD + index: + constraintId: 4 @@ -631,50 +613,66 @@ upsert descriptor #104 + foreignKey: {} + geoConfig: {} + id: 5 - + interleave: {} - + keyColumnDirections: - + - ASC - + keyColumnIds: - + - 3 - + keyColumnNames: - + - k - + keySuffixColumnIds: - + - 1 + interleave: {} + keyColumnDirections: + - ASC + - - ASC + keyColumnIds: + - - 4 + - 3 + keyColumnNames: + - - crdb_internal_column_4_name_placeholder + - k + keySuffixColumnIds: + - 1 + - name: crdb_internal_index_2_name_placeholder + name: idx - + partitioning: {} - + sharded: {} + partitioning: {} + sharded: {} + - version: 3 + storeColumnNames: [] + unique: true + version: 4 - + mutationId: 1 + mutationId: 1 + - state: DELETE_ONLY + state: BACKFILLING - + - direction: ADD - + index: - + constraintId: 5 - + createdExplicitly: true - + foreignKey: {} - + geoConfig: {} + - direction: ADD + index: + - constraintId: 2 + + constraintId: 5 + createdExplicitly: true + - encodingType: 1 + foreignKey: {} + geoConfig: {} + - id: 3 + id: 6 - + interleave: {} - + keyColumnDirections: - + - ASC - + keyColumnIds: + interleave: {} + keyColumnDirections: + - ASC + keyColumnIds: + - - 1 + - 3 - + keyColumnNames: + keyColumnNames: + - - i + - name: crdb_internal_index_3_name_placeholder + - k + keySuffixColumnIds: + - 1 + name: crdb_internal_index_6_name_placeholder - + partitioning: {} - + sharded: {} + partitioning: {} + sharded: {} + - storeColumnIds: + - - 3 + - storeColumnNames: + - - k + storeColumnNames: [] - + unique: true - useDeletePreservingEncoding: true + unique: true + + useDeletePreservingEncoding: true version: 4 mutationId: 1 - state: DELETE_ONLY + - state: WRITE_ONLY - - column: - - computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 + - computeExpr: j + 1:::INT8 - id: 4 - inaccessible: true - name: crdb_internal_column_4_name_placeholder @@ -686,7 +684,7 @@ upsert descriptor #104 - virtual: true - direction: DROP - mutationId: 1 - - state: WRITE_ONLY + state: DELETE_ONLY name: t nextColumnId: 5 - nextConstraintId: 4 @@ -714,20 +712,34 @@ upsert descriptor #104 - - 2 - 3 storeColumnNames: - - - crdb_internal_column_2_name_placeholder + - - j - k unique: true ... time: {} unexposedParentSchemaId: 101 - - version: "6" - + version: "7" + - version: "7" + + version: "8" persist all catalog changes to storage -update progress of schema change job #1: "PostCommitPhase stage 9 of 15 with 1 MutationType op pending" -commit transaction #10 -begin transaction #11 -## PostCommitPhase stage 9 of 15 with 3 MutationType ops +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 10 with 6 MutationType ops pending" +commit transaction #11 +begin transaction #12 +## PostCommitNonRevertiblePhase stage 3 of 10 with 8 MutationType ops upsert descriptor #104 + ... + version: 4 + mutationId: 1 + - state: WRITE_ONLY + + state: DELETE_ONLY + - column: + id: 2 + ... + direction: DROP + mutationId: 1 + - state: WRITE_ONLY + + state: DELETE_ONLY + - direction: ADD + index: ... version: 4 mutationId: 1 @@ -738,18 +750,72 @@ upsert descriptor #104 ... time: {} unexposedParentSchemaId: 101 - - version: "7" - + version: "8" + - version: "8" + + version: "9" persist all catalog changes to storage -update progress of schema change job #1: "PostCommitPhase stage 10 of 15 with 1 BackfillType op pending" -commit transaction #11 -begin transaction #12 -## PostCommitPhase stage 10 of 15 with 1 BackfillType op -backfill indexes [5] from index #3 in table #104 +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 4 of 10 with 1 BackfillType op pending" commit transaction #12 begin transaction #13 -## PostCommitPhase stage 11 of 15 with 3 MutationType ops +## PostCommitNonRevertiblePhase stage 4 of 10 with 1 BackfillType op +backfill indexes [5] from index #3 in table #104 +commit transaction #13 +begin transaction #14 +## PostCommitNonRevertiblePhase stage 5 of 10 with 5 MutationType ops upsert descriptor #104 + ... + - columnIds: + - 1 + - - 2 + - 3 + columnNames: + - i + - - crdb_internal_column_2_name_placeholder + - k + name: primary + ... + modificationTime: {} + mutations: + - - direction: DROP + - index: + - constraintId: 1 + - createdAtNanos: "1640995200000000000" + - encodingType: 1 + - foreignKey: {} + - geoConfig: {} + - id: 1 + - interleave: {} + - keyColumnDirections: + - - ASC + - keyColumnIds: + - - 1 + - keyColumnNames: + - - i + - name: crdb_internal_index_1_name_placeholder + - partitioning: {} + - sharded: {} + - storeColumnIds: + - - 2 + - - 3 + - storeColumnNames: + - - crdb_internal_column_2_name_placeholder + - - k + - unique: true + - version: 4 + - mutationId: 1 + - state: DELETE_ONLY + - - column: + - id: 2 + - name: crdb_internal_column_2_name_placeholder + - nullable: true + - type: + - family: IntFamily + - oid: 20 + - width: 64 + - direction: DROP + - mutationId: 1 + - state: DELETE_ONLY + - direction: ADD + index: ... version: 4 mutationId: 1 @@ -760,13 +826,13 @@ upsert descriptor #104 ... time: {} unexposedParentSchemaId: 101 - - version: "8" - + version: "9" + - version: "9" + + version: "10" persist all catalog changes to storage -update progress of schema change job #1: "PostCommitPhase stage 12 of 15 with 1 MutationType op pending" -commit transaction #13 -begin transaction #14 -## PostCommitPhase stage 12 of 15 with 3 MutationType ops +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 6 of 10 with 1 MutationType op pending" +commit transaction #14 +begin transaction #15 +## PostCommitNonRevertiblePhase stage 6 of 10 with 3 MutationType ops upsert descriptor #104 ... version: 4 @@ -778,17 +844,17 @@ upsert descriptor #104 ... time: {} unexposedParentSchemaId: 101 - - version: "9" - + version: "10" + - version: "10" + + version: "11" persist all catalog changes to storage -update progress of schema change job #1: "PostCommitPhase stage 13 of 15 with 1 BackfillType op pending" -commit transaction #14 -begin transaction #15 -## PostCommitPhase stage 13 of 15 with 1 BackfillType op -merge temporary indexes [6] into backfilled indexes [5] in table #104 +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 7 of 10 with 1 BackfillType op pending" commit transaction #15 begin transaction #16 -## PostCommitPhase stage 14 of 15 with 4 MutationType ops +## PostCommitNonRevertiblePhase stage 7 of 10 with 1 BackfillType op +merge temporary indexes [6] into backfilled indexes [5] in table #104 +commit transaction #16 +begin transaction #17 +## PostCommitNonRevertiblePhase stage 8 of 10 with 6 MutationType ops upsert descriptor #104 ... version: 4 @@ -809,24 +875,55 @@ upsert descriptor #104 ... time: {} unexposedParentSchemaId: 101 - - version: "10" - + version: "11" + - version: "11" + + version: "12" persist all catalog changes to storage -update progress of schema change job #1: "PostCommitPhase stage 15 of 15 with 1 ValidationType op pending" -commit transaction #16 -begin transaction #17 -## PostCommitPhase stage 15 of 15 with 1 ValidationType op -validate forward indexes [5] in table #104 +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 9 of 10 with 1 ValidationType op pending" commit transaction #17 begin transaction #18 -## PostCommitNonRevertiblePhase stage 1 of 2 with 21 MutationType ops +## PostCommitNonRevertiblePhase stage 9 of 10 with 1 ValidationType op +validate forward indexes [5] in table #104 +commit transaction #18 +begin transaction #19 +## PostCommitNonRevertiblePhase stage 10 of 10 with 9 MutationType ops upsert descriptor #104 ... - statementTag: CREATE INDEX - statementRank: 1 - - revertible: true - targetRanks: - targets: + createAsOfTime: + wallTime: "1640995200000000000" + - declarativeSchemaChangerState: + - authorization: + - userName: root + - currentStatuses: + - jobId: "1" + - nameMapping: + - columns: + - "1": i + - "3": k + - "4": crdb_internal_column_4_name_placeholder + - "4294967294": tableoid + - "4294967295": crdb_internal_mvcc_timestamp + - families: + - "0": primary + - id: 104 + - indexes: + - "3": t_pkey + - "4": crdb_internal_index_4_name_placeholder + - "5": idx + - name: t + - relevantStatements: + - - statement: + - redactedStatement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE + - statement: ALTER TABLE t DROP COLUMN j CASCADE + - statementTag: ALTER TABLE + - - statement: + - redactedStatement: CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.‹public›.‹t› (‹k›) + - statement: CREATE UNIQUE INDEX idx ON t (k) + - statementTag: CREATE INDEX + - statementRank: 1 + - targetRanks: + - targets: + families: + - columnIds: ... formatVersion: 3 id: 104 @@ -854,63 +951,7 @@ upsert descriptor #104 + unique: true + version: 4 modificationTime: {} - mutations: - ... - direction: DROP - mutationId: 1 - - state: WRITE_ONLY - + state: DELETE_ONLY - - direction: DROP - index: - ... - keySuffixColumnIds: - - 1 - - name: t_expr_k_idx - + name: crdb_internal_index_2_name_placeholder - partitioning: {} - sharded: {} - version: 3 - mutationId: 1 - - state: WRITE_ONLY - - - direction: DROP - - index: - - constraintId: 3 - - createdExplicitly: true - - encodingType: 1 - - foreignKey: {} - - geoConfig: {} - - id: 4 - - interleave: {} - - keyColumnDirections: - - - ASC - - keyColumnIds: - - - 1 - - keyColumnNames: - - - i - - name: crdb_internal_index_4_name_placeholder - - partitioning: {} - - sharded: {} - - storeColumnIds: - - - 3 - - storeColumnNames: - - - k - - unique: true - - useDeletePreservingEncoding: true - - version: 4 - - mutationId: 1 - state: DELETE_ONLY - - column: - ... - direction: DROP - mutationId: 1 - - state: WRITE_ONLY - + state: DELETE_ONLY - - direction: DROP - index: - ... - version: 4 - mutationId: 1 - - state: WRITE_ONLY + - mutations: - - direction: ADD - index: - constraintId: 4 @@ -959,147 +1000,6 @@ upsert descriptor #104 - unique: true - useDeletePreservingEncoding: true - version: 4 - - mutationId: 1 - state: DELETE_ONLY - name: t - ... - time: {} - unexposedParentSchemaId: 101 - - version: "11" - + version: "12" -persist all catalog changes to storage -adding table for stats refresh: 104 -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 2 with 8 MutationType ops pending" -set schema change job #1 to non-cancellable -commit transaction #18 -begin transaction #19 -## PostCommitNonRevertiblePhase stage 2 of 2 with 10 MutationType ops -upsert descriptor #104 - ... - createAsOfTime: - wallTime: "1640995200000000000" - - declarativeSchemaChangerState: - - authorization: - - userName: root - - currentStatuses: - - jobId: "1" - - nameMapping: - - columns: - - "1": i - - "2": crdb_internal_column_2_name_placeholder - - "3": k - - "4": crdb_internal_column_4_name_placeholder - - "4294967294": tableoid - - "4294967295": crdb_internal_mvcc_timestamp - - families: - - "0": primary - - id: 104 - - indexes: - - "3": t_pkey - - "4": crdb_internal_index_4_name_placeholder - - "5": idx - - name: t - - relevantStatements: - - - statement: - - redactedStatement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE - - statement: ALTER TABLE t DROP COLUMN j CASCADE - - statementTag: ALTER TABLE - - - statement: - - redactedStatement: CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.‹public›.‹t› (‹k›) - - statement: CREATE UNIQUE INDEX idx ON t (k) - - statementTag: CREATE INDEX - - statementRank: 1 - - targetRanks: - - targets: - families: - - columnIds: - - 1 - - - 2 - - 3 - columnNames: - - i - - - crdb_internal_column_2_name_placeholder - - k - name: primary - ... - version: 4 - modificationTime: {} - - mutations: - - - column: - - id: 2 - - name: crdb_internal_column_2_name_placeholder - - nullable: true - - type: - - family: IntFamily - - oid: 20 - - width: 64 - - direction: DROP - - mutationId: 1 - - state: DELETE_ONLY - - - direction: DROP - - index: - - createdAtNanos: "1640995200000000000" - - foreignKey: {} - - geoConfig: {} - - id: 2 - - interleave: {} - - keyColumnDirections: - - - ASC - - - ASC - - keyColumnIds: - - - 4 - - - 3 - - keyColumnNames: - - - crdb_internal_column_4_name_placeholder - - - k - - keySuffixColumnIds: - - - 1 - - name: crdb_internal_index_2_name_placeholder - - partitioning: {} - - sharded: {} - - version: 3 - - mutationId: 1 - - state: DELETE_ONLY - - - column: - - computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 - - id: 4 - - inaccessible: true - - name: crdb_internal_column_4_name_placeholder - - nullable: true - - type: - - family: IntFamily - - oid: 20 - - width: 64 - - virtual: true - - direction: DROP - - mutationId: 1 - - state: DELETE_ONLY - - - direction: DROP - - index: - - constraintId: 1 - - createdAtNanos: "1640995200000000000" - - encodingType: 1 - - foreignKey: {} - - geoConfig: {} - - id: 1 - - interleave: {} - - keyColumnDirections: - - - ASC - - keyColumnIds: - - - 1 - - keyColumnNames: - - - i - - name: crdb_internal_index_1_name_placeholder - - partitioning: {} - - sharded: {} - - storeColumnIds: - - - 2 - - - 3 - - storeColumnNames: - - - crdb_internal_column_2_name_placeholder - - - k - - unique: true - - version: 4 - mutationId: 1 - state: DELETE_ONLY + mutations: [] @@ -1111,6 +1011,7 @@ upsert descriptor #104 - version: "12" + version: "13" persist all catalog changes to storage +adding table for stats refresh: 104 create job #2 (non-cancelable: true): "GC for ALTER TABLE defaultdb.public.t DROP COLUMN j CASCADE; CREATE UNIQUE INDEX idx ON defaultdb.public.t (k)" descriptor IDs: [104] update progress of schema change job #1: "all stages completed" diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_10_of_15.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_10_of_15.explain deleted file mode 100644 index 4b0f98922aa2..000000000000 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_10_of_15.explain +++ /dev/null @@ -1,85 +0,0 @@ -/* setup */ -CREATE TABLE t (i INT PRIMARY KEY, j INT, k INT DEFAULT 32 ON UPDATE 42, INDEX((j+1), k)); - -/* test */ -ALTER TABLE t DROP COLUMN j CASCADE; -CREATE UNIQUE INDEX idx ON t(k); -EXPLAIN (DDL) rollback at post-commit stage 10 of 15; ----- -Schema change plan for rolling back CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); following ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; - └── PostCommitNonRevertiblePhase - ├── Stage 1 of 3 in PostCommitNonRevertiblePhase - │ ├── 7 elements transitioning toward PUBLIC - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr+)} - │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey+), ConstraintID: 1} - │ │ ├── ABSENT → PUBLIC IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 1 (t_pkey+)} - │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx+), RecreateSourceIndexID: 0} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} - │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr+)} - │ ├── 12 elements transitioning toward ABSENT - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── PUBLIC → VALIDATED PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 3 (t_pkey-)} - │ │ ├── TRANSIENT_DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} - │ │ ├── BACKFILL_ONLY → ABSENT SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx-), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey-), RecreateSourceIndexID: 0} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 5 (idx-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 5 (idx-)} - │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "idx", IndexID: 5 (idx-)} - │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 6, ConstraintID: 5, SourceIndexID: 3 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 6} - │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 6} - │ └── 24 Mutation operations - │ ├── SetIndexName {"IndexID":1,"Name":"t_pkey","TableID":104} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} - │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":3,"TableID":104} - │ ├── SetIndexName {"IndexID":3,"Name":"crdb_internal_in...","TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"Kind":1,"TableID":104} - │ ├── SetIndexName {"IndexID":5,"Name":"crdb_internal_in...","TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":6,"Kind":1,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} - │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} - │ ├── MakeIndexAbsent {"IndexID":5,"TableID":104} - │ ├── SetJobStateOnDescriptor {"DescriptorID":104} - │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - ├── Stage 2 of 3 in PostCommitNonRevertiblePhase - │ ├── 4 elements transitioning toward ABSENT - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 3 (t_pkey-)} - │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - │ │ └── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 6, ConstraintID: 5, SourceIndexID: 3 (t_pkey-)} - │ └── 6 Mutation operations - │ ├── MakeIndexAbsent {"IndexID":6,"TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} - │ ├── SetJobStateOnDescriptor {"DescriptorID":104} - │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - └── Stage 3 of 3 in PostCommitNonRevertiblePhase - ├── 5 elements transitioning toward ABSENT - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 3 (t_pkey-)} - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ ├── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 5 (idx-)} - │ └── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 6} - └── 7 Mutation operations - ├── MakeIndexAbsent {"IndexID":3,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":3,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":4,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":5,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":6,"TableID":104} - ├── RemoveJobStateFromDescriptor {"DescriptorID":104} - └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"all stages compl..."} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_11_of_15.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_11_of_15.explain deleted file mode 100644 index e40d95f4b443..000000000000 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_11_of_15.explain +++ /dev/null @@ -1,85 +0,0 @@ -/* setup */ -CREATE TABLE t (i INT PRIMARY KEY, j INT, k INT DEFAULT 32 ON UPDATE 42, INDEX((j+1), k)); - -/* test */ -ALTER TABLE t DROP COLUMN j CASCADE; -CREATE UNIQUE INDEX idx ON t(k); -EXPLAIN (DDL) rollback at post-commit stage 11 of 15; ----- -Schema change plan for rolling back CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); following ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; - └── PostCommitNonRevertiblePhase - ├── Stage 1 of 3 in PostCommitNonRevertiblePhase - │ ├── 7 elements transitioning toward PUBLIC - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr+)} - │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey+), ConstraintID: 1} - │ │ ├── ABSENT → PUBLIC IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 1 (t_pkey+)} - │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx+), RecreateSourceIndexID: 0} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} - │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr+)} - │ ├── 12 elements transitioning toward ABSENT - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── PUBLIC → VALIDATED PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 3 (t_pkey-)} - │ │ ├── TRANSIENT_DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} - │ │ ├── BACKFILL_ONLY → ABSENT SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx-), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey-), RecreateSourceIndexID: 0} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 5 (idx-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 5 (idx-)} - │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "idx", IndexID: 5 (idx-)} - │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 6, ConstraintID: 5, SourceIndexID: 3 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 6} - │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 6} - │ └── 24 Mutation operations - │ ├── SetIndexName {"IndexID":1,"Name":"t_pkey","TableID":104} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} - │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":3,"TableID":104} - │ ├── SetIndexName {"IndexID":3,"Name":"crdb_internal_in...","TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"Kind":1,"TableID":104} - │ ├── SetIndexName {"IndexID":5,"Name":"crdb_internal_in...","TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":6,"Kind":1,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} - │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} - │ ├── MakeIndexAbsent {"IndexID":5,"TableID":104} - │ ├── SetJobStateOnDescriptor {"DescriptorID":104} - │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - ├── Stage 2 of 3 in PostCommitNonRevertiblePhase - │ ├── 4 elements transitioning toward ABSENT - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 3 (t_pkey-)} - │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - │ │ └── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 6, ConstraintID: 5, SourceIndexID: 3 (t_pkey-)} - │ └── 6 Mutation operations - │ ├── MakeIndexAbsent {"IndexID":6,"TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} - │ ├── SetJobStateOnDescriptor {"DescriptorID":104} - │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - └── Stage 3 of 3 in PostCommitNonRevertiblePhase - ├── 5 elements transitioning toward ABSENT - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 3 (t_pkey-)} - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ ├── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 5 (idx-)} - │ └── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 6} - └── 7 Mutation operations - ├── MakeIndexAbsent {"IndexID":3,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":3,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":4,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":5,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":6,"TableID":104} - ├── RemoveJobStateFromDescriptor {"DescriptorID":104} - └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"all stages compl..."} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_12_of_15.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_12_of_15.explain deleted file mode 100644 index eaf16ae60c6d..000000000000 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_12_of_15.explain +++ /dev/null @@ -1,85 +0,0 @@ -/* setup */ -CREATE TABLE t (i INT PRIMARY KEY, j INT, k INT DEFAULT 32 ON UPDATE 42, INDEX((j+1), k)); - -/* test */ -ALTER TABLE t DROP COLUMN j CASCADE; -CREATE UNIQUE INDEX idx ON t(k); -EXPLAIN (DDL) rollback at post-commit stage 12 of 15; ----- -Schema change plan for rolling back CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); following ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; - └── PostCommitNonRevertiblePhase - ├── Stage 1 of 3 in PostCommitNonRevertiblePhase - │ ├── 7 elements transitioning toward PUBLIC - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr+)} - │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey+), ConstraintID: 1} - │ │ ├── ABSENT → PUBLIC IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 1 (t_pkey+)} - │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx+), RecreateSourceIndexID: 0} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} - │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr+)} - │ ├── 12 elements transitioning toward ABSENT - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── PUBLIC → VALIDATED PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 3 (t_pkey-)} - │ │ ├── TRANSIENT_DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} - │ │ ├── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx-), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey-), RecreateSourceIndexID: 0} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 5 (idx-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 5 (idx-)} - │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "idx", IndexID: 5 (idx-)} - │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 6, ConstraintID: 5, SourceIndexID: 3 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 6} - │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 6} - │ └── 24 Mutation operations - │ ├── SetIndexName {"IndexID":1,"Name":"t_pkey","TableID":104} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} - │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":3,"TableID":104} - │ ├── SetIndexName {"IndexID":3,"Name":"crdb_internal_in...","TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"Kind":1,"TableID":104} - │ ├── SetIndexName {"IndexID":5,"Name":"crdb_internal_in...","TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":6,"Kind":1,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} - │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} - │ ├── MakeIndexAbsent {"IndexID":5,"TableID":104} - │ ├── SetJobStateOnDescriptor {"DescriptorID":104} - │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - ├── Stage 2 of 3 in PostCommitNonRevertiblePhase - │ ├── 4 elements transitioning toward ABSENT - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 3 (t_pkey-)} - │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - │ │ └── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 6, ConstraintID: 5, SourceIndexID: 3 (t_pkey-)} - │ └── 6 Mutation operations - │ ├── MakeIndexAbsent {"IndexID":6,"TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} - │ ├── SetJobStateOnDescriptor {"DescriptorID":104} - │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - └── Stage 3 of 3 in PostCommitNonRevertiblePhase - ├── 5 elements transitioning toward ABSENT - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 3 (t_pkey-)} - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ ├── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 5 (idx-)} - │ └── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 6} - └── 7 Mutation operations - ├── MakeIndexAbsent {"IndexID":3,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":3,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":4,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":5,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":6,"TableID":104} - ├── RemoveJobStateFromDescriptor {"DescriptorID":104} - └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"all stages compl..."} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_13_of_15.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_13_of_15.explain deleted file mode 100644 index 83895f7e4f24..000000000000 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_13_of_15.explain +++ /dev/null @@ -1,87 +0,0 @@ -/* setup */ -CREATE TABLE t (i INT PRIMARY KEY, j INT, k INT DEFAULT 32 ON UPDATE 42, INDEX((j+1), k)); - -/* test */ -ALTER TABLE t DROP COLUMN j CASCADE; -CREATE UNIQUE INDEX idx ON t(k); -EXPLAIN (DDL) rollback at post-commit stage 13 of 15; ----- -Schema change plan for rolling back CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); following ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; - └── PostCommitNonRevertiblePhase - ├── Stage 1 of 3 in PostCommitNonRevertiblePhase - │ ├── 7 elements transitioning toward PUBLIC - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr+)} - │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey+), ConstraintID: 1} - │ │ ├── ABSENT → PUBLIC IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 1 (t_pkey+)} - │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx+), RecreateSourceIndexID: 0} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} - │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr+)} - │ ├── 12 elements transitioning toward ABSENT - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── PUBLIC → VALIDATED PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 3 (t_pkey-)} - │ │ ├── TRANSIENT_DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} - │ │ ├── MERGE_ONLY → DELETE_ONLY SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx-), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey-), RecreateSourceIndexID: 0} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 5 (idx-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 5 (idx-)} - │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "idx", IndexID: 5 (idx-)} - │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 6, ConstraintID: 5, SourceIndexID: 3 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 6} - │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 6} - │ └── 24 Mutation operations - │ ├── SetIndexName {"IndexID":1,"Name":"t_pkey","TableID":104} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} - │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":3,"TableID":104} - │ ├── SetIndexName {"IndexID":3,"Name":"crdb_internal_in...","TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":6,"Kind":1,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} - │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"Kind":1,"TableID":104} - │ ├── SetIndexName {"IndexID":5,"Name":"crdb_internal_in...","TableID":104} - │ ├── SetJobStateOnDescriptor {"DescriptorID":104} - │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - ├── Stage 2 of 3 in PostCommitNonRevertiblePhase - │ ├── 5 elements transitioning toward ABSENT - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 3 (t_pkey-)} - │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - │ │ ├── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx-), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey-), RecreateSourceIndexID: 0} - │ │ └── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 6, ConstraintID: 5, SourceIndexID: 3 (t_pkey-)} - │ └── 7 Mutation operations - │ ├── MakeIndexAbsent {"IndexID":5,"TableID":104} - │ ├── MakeIndexAbsent {"IndexID":6,"TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} - │ ├── SetJobStateOnDescriptor {"DescriptorID":104} - │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - └── Stage 3 of 3 in PostCommitNonRevertiblePhase - ├── 5 elements transitioning toward ABSENT - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 3 (t_pkey-)} - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ ├── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 5 (idx-)} - │ └── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 6} - └── 7 Mutation operations - ├── MakeIndexAbsent {"IndexID":3,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":3,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":4,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":5,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":6,"TableID":104} - ├── RemoveJobStateFromDescriptor {"DescriptorID":104} - └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"all stages compl..."} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_14_of_15.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_14_of_15.explain deleted file mode 100644 index dcbb93dcf3af..000000000000 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_14_of_15.explain +++ /dev/null @@ -1,87 +0,0 @@ -/* setup */ -CREATE TABLE t (i INT PRIMARY KEY, j INT, k INT DEFAULT 32 ON UPDATE 42, INDEX((j+1), k)); - -/* test */ -ALTER TABLE t DROP COLUMN j CASCADE; -CREATE UNIQUE INDEX idx ON t(k); -EXPLAIN (DDL) rollback at post-commit stage 14 of 15; ----- -Schema change plan for rolling back CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); following ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; - └── PostCommitNonRevertiblePhase - ├── Stage 1 of 3 in PostCommitNonRevertiblePhase - │ ├── 7 elements transitioning toward PUBLIC - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr+)} - │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey+), ConstraintID: 1} - │ │ ├── ABSENT → PUBLIC IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 1 (t_pkey+)} - │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx+), RecreateSourceIndexID: 0} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} - │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr+)} - │ ├── 12 elements transitioning toward ABSENT - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── PUBLIC → VALIDATED PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 3 (t_pkey-)} - │ │ ├── TRANSIENT_DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} - │ │ ├── MERGE_ONLY → DELETE_ONLY SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx-), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey-), RecreateSourceIndexID: 0} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 5 (idx-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 5 (idx-)} - │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "idx", IndexID: 5 (idx-)} - │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 6, ConstraintID: 5, SourceIndexID: 3 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 6} - │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 6} - │ └── 24 Mutation operations - │ ├── SetIndexName {"IndexID":1,"Name":"t_pkey","TableID":104} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} - │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":3,"TableID":104} - │ ├── SetIndexName {"IndexID":3,"Name":"crdb_internal_in...","TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":6,"Kind":1,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} - │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"Kind":1,"TableID":104} - │ ├── SetIndexName {"IndexID":5,"Name":"crdb_internal_in...","TableID":104} - │ ├── SetJobStateOnDescriptor {"DescriptorID":104} - │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - ├── Stage 2 of 3 in PostCommitNonRevertiblePhase - │ ├── 5 elements transitioning toward ABSENT - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 3 (t_pkey-)} - │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - │ │ ├── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx-), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey-), RecreateSourceIndexID: 0} - │ │ └── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 6, ConstraintID: 5, SourceIndexID: 3 (t_pkey-)} - │ └── 7 Mutation operations - │ ├── MakeIndexAbsent {"IndexID":5,"TableID":104} - │ ├── MakeIndexAbsent {"IndexID":6,"TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} - │ ├── SetJobStateOnDescriptor {"DescriptorID":104} - │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - └── Stage 3 of 3 in PostCommitNonRevertiblePhase - ├── 5 elements transitioning toward ABSENT - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 3 (t_pkey-)} - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ ├── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 5 (idx-)} - │ └── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 6} - └── 7 Mutation operations - ├── MakeIndexAbsent {"IndexID":3,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":3,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":4,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":5,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":6,"TableID":104} - ├── RemoveJobStateFromDescriptor {"DescriptorID":104} - └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"all stages compl..."} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_15_of_15.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_15_of_15.explain deleted file mode 100644 index bacbd46664ab..000000000000 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_15_of_15.explain +++ /dev/null @@ -1,85 +0,0 @@ -/* setup */ -CREATE TABLE t (i INT PRIMARY KEY, j INT, k INT DEFAULT 32 ON UPDATE 42, INDEX((j+1), k)); - -/* test */ -ALTER TABLE t DROP COLUMN j CASCADE; -CREATE UNIQUE INDEX idx ON t(k); -EXPLAIN (DDL) rollback at post-commit stage 15 of 15; ----- -Schema change plan for rolling back CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); following ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; - └── PostCommitNonRevertiblePhase - ├── Stage 1 of 3 in PostCommitNonRevertiblePhase - │ ├── 7 elements transitioning toward PUBLIC - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr+)} - │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey+), ConstraintID: 1} - │ │ ├── ABSENT → PUBLIC IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 1 (t_pkey+)} - │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx+), RecreateSourceIndexID: 0} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} - │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr+)} - │ ├── 12 elements transitioning toward ABSENT - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── PUBLIC → VALIDATED PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 3 (t_pkey-)} - │ │ ├── TRANSIENT_DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} - │ │ ├── WRITE_ONLY → DELETE_ONLY SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx-), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey-), RecreateSourceIndexID: 0} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 5 (idx-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 5 (idx-)} - │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "idx", IndexID: 5 (idx-)} - │ │ ├── TRANSIENT_DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 6, ConstraintID: 5, SourceIndexID: 3 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 6} - │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 6} - │ └── 24 Mutation operations - │ ├── SetIndexName {"IndexID":1,"Name":"t_pkey","TableID":104} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} - │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":3,"TableID":104} - │ ├── SetIndexName {"IndexID":3,"Name":"crdb_internal_in...","TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"Kind":1,"TableID":104} - │ ├── SetIndexName {"IndexID":5,"Name":"crdb_internal_in...","TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":6,"Kind":1,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} - │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} - │ ├── MakeIndexAbsent {"IndexID":6,"TableID":104} - │ ├── SetJobStateOnDescriptor {"DescriptorID":104} - │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - ├── Stage 2 of 3 in PostCommitNonRevertiblePhase - │ ├── 4 elements transitioning toward ABSENT - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 3 (t_pkey-)} - │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - │ │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx-), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey-), RecreateSourceIndexID: 0} - │ └── 6 Mutation operations - │ ├── MakeIndexAbsent {"IndexID":5,"TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} - │ ├── SetJobStateOnDescriptor {"DescriptorID":104} - │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - └── Stage 3 of 3 in PostCommitNonRevertiblePhase - ├── 5 elements transitioning toward ABSENT - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 3 (t_pkey-)} - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ ├── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 5 (idx-)} - │ └── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 6} - └── 7 Mutation operations - ├── MakeIndexAbsent {"IndexID":3,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":3,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":4,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":5,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":6,"TableID":104} - ├── RemoveJobStateFromDescriptor {"DescriptorID":104} - └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"all stages compl..."} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_1_of_15.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_1_of_7.explain similarity index 84% rename from pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_1_of_15.explain rename to pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_1_of_7.explain index b0fcfbf0bd7a..720e61531f71 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_1_of_15.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_1_of_7.explain @@ -4,16 +4,14 @@ CREATE TABLE t (i INT PRIMARY KEY, j INT, k INT DEFAULT 32 ON UPDATE 42, INDEX(( /* test */ ALTER TABLE t DROP COLUMN j CASCADE; CREATE UNIQUE INDEX idx ON t(k); -EXPLAIN (DDL) rollback at post-commit stage 1 of 15; +EXPLAIN (DDL) rollback at post-commit stage 1 of 7; ---- Schema change plan for rolling back CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); following ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase └── Stage 1 of 1 in PostCommitNonRevertiblePhase - ├── 5 elements transitioning toward PUBLIC - │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} + ├── 3 elements transitioning toward PUBLIC │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr+)} │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx+), RecreateSourceIndexID: 0} - │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr+)} ├── 7 elements transitioning toward ABSENT │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} @@ -23,16 +21,13 @@ Schema change plan for rolling back CREATE UNIQUE INDEX ‹idx› ON ‹defaultd │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ ├── BACKFILL_ONLY → ABSENT PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} │ └── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} - └── 17 Mutation operations + └── 14 Mutation operations ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} ├── RefreshStats {"TableID":104} ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} - ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} ├── MakeIndexAbsent {"IndexID":4,"TableID":104} - ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - ├── RefreshStats {"TableID":104} ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} ├── RefreshStats {"TableID":104} ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_3_of_15.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_2_of_7.explain similarity index 87% rename from pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_3_of_15.explain rename to pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_2_of_7.explain index 53b8664da612..3ac2fe0f990a 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_3_of_15.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_2_of_7.explain @@ -4,16 +4,14 @@ CREATE TABLE t (i INT PRIMARY KEY, j INT, k INT DEFAULT 32 ON UPDATE 42, INDEX(( /* test */ ALTER TABLE t DROP COLUMN j CASCADE; CREATE UNIQUE INDEX idx ON t(k); -EXPLAIN (DDL) rollback at post-commit stage 3 of 15; +EXPLAIN (DDL) rollback at post-commit stage 2 of 7; ---- Schema change plan for rolling back CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); following ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 5 elements transitioning toward PUBLIC - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} + │ ├── 3 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr+)} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx+), RecreateSourceIndexID: 0} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr+)} │ ├── 6 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} @@ -22,14 +20,11 @@ Schema change plan for rolling back CREATE UNIQUE INDEX ‹idx› ON ‹defaultd │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ │ ├── BACKFILL_ONLY → ABSENT PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} - │ └── 16 Mutation operations + │ └── 13 Mutation operations │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_2_of_15.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_3_of_7.explain similarity index 87% rename from pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_2_of_15.explain rename to pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_3_of_7.explain index 75fe4b992e3a..06301eb14a2d 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_2_of_15.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_3_of_7.explain @@ -4,16 +4,14 @@ CREATE TABLE t (i INT PRIMARY KEY, j INT, k INT DEFAULT 32 ON UPDATE 42, INDEX(( /* test */ ALTER TABLE t DROP COLUMN j CASCADE; CREATE UNIQUE INDEX idx ON t(k); -EXPLAIN (DDL) rollback at post-commit stage 2 of 15; +EXPLAIN (DDL) rollback at post-commit stage 3 of 7; ---- Schema change plan for rolling back CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); following ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 5 elements transitioning toward PUBLIC - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} + │ ├── 3 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr+)} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx+), RecreateSourceIndexID: 0} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr+)} │ ├── 6 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} @@ -22,14 +20,11 @@ Schema change plan for rolling back CREATE UNIQUE INDEX ‹idx› ON ‹defaultd │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ │ ├── BACKFILL_ONLY → ABSENT PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} - │ └── 16 Mutation operations + │ └── 13 Mutation operations │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_4_of_15.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_4_of_7.explain similarity index 87% rename from pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_4_of_15.explain rename to pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_4_of_7.explain index 8e2add0049ea..4ccbe4b7074e 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_4_of_15.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_4_of_7.explain @@ -4,16 +4,14 @@ CREATE TABLE t (i INT PRIMARY KEY, j INT, k INT DEFAULT 32 ON UPDATE 42, INDEX(( /* test */ ALTER TABLE t DROP COLUMN j CASCADE; CREATE UNIQUE INDEX idx ON t(k); -EXPLAIN (DDL) rollback at post-commit stage 4 of 15; +EXPLAIN (DDL) rollback at post-commit stage 4 of 7; ---- Schema change plan for rolling back CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); following ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 5 elements transitioning toward PUBLIC - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} + │ ├── 3 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr+)} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx+), RecreateSourceIndexID: 0} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr+)} │ ├── 6 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} @@ -22,17 +20,14 @@ Schema change plan for rolling back CREATE UNIQUE INDEX ‹idx› ON ‹defaultd │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ │ ├── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} - │ └── 16 Mutation operations + │ └── 13 Mutation operations │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_6_of_15.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_5_of_7.explain similarity index 87% rename from pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_6_of_15.explain rename to pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_5_of_7.explain index fc92818580d2..0f21a43c637b 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_6_of_15.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_5_of_7.explain @@ -4,16 +4,14 @@ CREATE TABLE t (i INT PRIMARY KEY, j INT, k INT DEFAULT 32 ON UPDATE 42, INDEX(( /* test */ ALTER TABLE t DROP COLUMN j CASCADE; CREATE UNIQUE INDEX idx ON t(k); -EXPLAIN (DDL) rollback at post-commit stage 6 of 15; +EXPLAIN (DDL) rollback at post-commit stage 5 of 7; ---- Schema change plan for rolling back CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); following ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 5 elements transitioning toward PUBLIC - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} + │ ├── 3 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr+)} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx+), RecreateSourceIndexID: 0} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr+)} │ ├── 6 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} @@ -22,14 +20,11 @@ Schema change plan for rolling back CREATE UNIQUE INDEX ‹idx› ON ‹defaultd │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ │ ├── MERGE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} - │ └── 16 Mutation operations + │ └── 13 Mutation operations │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_5_of_15.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_6_of_7.explain similarity index 87% rename from pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_5_of_15.explain rename to pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_6_of_7.explain index 2c91a82cd6f2..394cdf2133be 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_5_of_15.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_6_of_7.explain @@ -4,16 +4,14 @@ CREATE TABLE t (i INT PRIMARY KEY, j INT, k INT DEFAULT 32 ON UPDATE 42, INDEX(( /* test */ ALTER TABLE t DROP COLUMN j CASCADE; CREATE UNIQUE INDEX idx ON t(k); -EXPLAIN (DDL) rollback at post-commit stage 5 of 15; +EXPLAIN (DDL) rollback at post-commit stage 6 of 7; ---- Schema change plan for rolling back CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); following ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 5 elements transitioning toward PUBLIC - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} + │ ├── 3 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr+)} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx+), RecreateSourceIndexID: 0} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr+)} │ ├── 6 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} @@ -22,14 +20,11 @@ Schema change plan for rolling back CREATE UNIQUE INDEX ‹idx› ON ‹defaultd │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ │ ├── MERGE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} - │ └── 16 Mutation operations + │ └── 13 Mutation operations │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_7_of_15.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_7_of_15.explain deleted file mode 100644 index 2ab0282e9b3f..000000000000 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_7_of_15.explain +++ /dev/null @@ -1,52 +0,0 @@ -/* setup */ -CREATE TABLE t (i INT PRIMARY KEY, j INT, k INT DEFAULT 32 ON UPDATE 42, INDEX((j+1), k)); - -/* test */ -ALTER TABLE t DROP COLUMN j CASCADE; -CREATE UNIQUE INDEX idx ON t(k); -EXPLAIN (DDL) rollback at post-commit stage 7 of 15; ----- -Schema change plan for rolling back CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); following ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; - └── PostCommitNonRevertiblePhase - ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 5 elements transitioning toward PUBLIC - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr+)} - │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx+), RecreateSourceIndexID: 0} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} - │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr+)} - │ ├── 6 elements transitioning toward ABSENT - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 3 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - │ │ └── TRANSIENT_DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} - │ └── 16 Mutation operations - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} - │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} - │ ├── SetJobStateOnDescriptor {"DescriptorID":104} - │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - └── Stage 2 of 2 in PostCommitNonRevertiblePhase - ├── 3 elements transitioning toward ABSENT - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 3 (t_pkey-)} - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ └── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - └── 5 Mutation operations - ├── MakeIndexAbsent {"IndexID":3,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":3,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":4,"TableID":104} - ├── RemoveJobStateFromDescriptor {"DescriptorID":104} - └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"all stages compl..."} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_8_of_15.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_7_of_7.explain similarity index 87% rename from pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_8_of_15.explain rename to pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_7_of_7.explain index bb15a22cd541..b8a590b9d8fd 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_8_of_15.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_7_of_7.explain @@ -4,16 +4,14 @@ CREATE TABLE t (i INT PRIMARY KEY, j INT, k INT DEFAULT 32 ON UPDATE 42, INDEX(( /* test */ ALTER TABLE t DROP COLUMN j CASCADE; CREATE UNIQUE INDEX idx ON t(k); -EXPLAIN (DDL) rollback at post-commit stage 8 of 15; +EXPLAIN (DDL) rollback at post-commit stage 7 of 7; ---- Schema change plan for rolling back CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); following ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 5 elements transitioning toward PUBLIC - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} + │ ├── 3 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr+)} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx+), RecreateSourceIndexID: 0} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr+)} │ ├── 6 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} @@ -22,14 +20,11 @@ Schema change plan for rolling back CREATE UNIQUE INDEX ‹idx› ON ‹defaultd │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ │ ├── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} │ │ └── TRANSIENT_DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} - │ └── 16 Mutation operations + │ └── 13 Mutation operations │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_9_of_15.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_9_of_15.explain deleted file mode 100644 index 2db7a537a938..000000000000 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__rollback_9_of_15.explain +++ /dev/null @@ -1,81 +0,0 @@ -/* setup */ -CREATE TABLE t (i INT PRIMARY KEY, j INT, k INT DEFAULT 32 ON UPDATE 42, INDEX((j+1), k)); - -/* test */ -ALTER TABLE t DROP COLUMN j CASCADE; -CREATE UNIQUE INDEX idx ON t(k); -EXPLAIN (DDL) rollback at post-commit stage 9 of 15; ----- -Schema change plan for rolling back CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); following ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; - └── PostCommitNonRevertiblePhase - ├── Stage 1 of 3 in PostCommitNonRevertiblePhase - │ ├── 7 elements transitioning toward PUBLIC - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr+)} - │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey+), ConstraintID: 1} - │ │ ├── ABSENT → PUBLIC IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 1 (t_pkey+)} - │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx+), RecreateSourceIndexID: 0} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} - │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr+)} - │ ├── 12 elements transitioning toward ABSENT - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── PUBLIC → VALIDATED PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 3 (t_pkey-)} - │ │ ├── TRANSIENT_DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} - │ │ ├── BACKFILL_ONLY → ABSENT SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx-), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey-), RecreateSourceIndexID: 0} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 5 (idx-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 5 (idx-)} - │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "idx", IndexID: 5 (idx-)} - │ │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 6, ConstraintID: 5, SourceIndexID: 3 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 6} - │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 6} - │ └── 24 Mutation operations - │ ├── SetIndexName {"IndexID":1,"Name":"t_pkey","TableID":104} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} - │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":3,"TableID":104} - │ ├── SetIndexName {"IndexID":3,"Name":"crdb_internal_in...","TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"Kind":1,"TableID":104} - │ ├── SetIndexName {"IndexID":5,"Name":"crdb_internal_in...","TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":6,"Kind":1,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} - │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} - │ ├── MakeIndexAbsent {"IndexID":5,"TableID":104} - │ ├── MakeIndexAbsent {"IndexID":6,"TableID":104} - │ ├── SetJobStateOnDescriptor {"DescriptorID":104} - │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - ├── Stage 2 of 3 in PostCommitNonRevertiblePhase - │ ├── 3 elements transitioning toward ABSENT - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 3 (t_pkey-)} - │ │ └── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - │ └── 5 Mutation operations - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} - │ ├── SetJobStateOnDescriptor {"DescriptorID":104} - │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - └── Stage 3 of 3 in PostCommitNonRevertiblePhase - ├── 4 elements transitioning toward ABSENT - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 3 (t_pkey-)} - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ ├── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} - │ └── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 5 (idx-)} - └── 6 Mutation operations - ├── MakeIndexAbsent {"IndexID":3,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":3,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":4,"TableID":104} - ├── CreateGCJobForIndex {"IndexID":5,"TableID":104} - ├── RemoveJobStateFromDescriptor {"DescriptorID":104} - └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"all stages compl..."} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__statement_1_of_2.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__statement_1_of_2.explain index aade09762b3a..a996d150b669 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__statement_1_of_2.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__statement_1_of_2.explain @@ -16,15 +16,11 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4, ConstraintID: 3, SourceIndexID: 1 (t_pkey-)} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4} │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4} - │ ├── 5 elements transitioning toward ABSENT - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j-)} + │ ├── 3 elements transitioning toward ABSENT │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-)} │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr-)} │ │ └── PUBLIC → VALIDATED SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-), RecreateSourceIndexID: 0} - │ └── 11 Mutation operations - │ ├── MakePublicColumnWriteOnly {"ColumnID":2,"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":104} + │ └── 9 Mutation operations │ ├── MakePublicSecondaryIndexWriteOnly {"IndexID":2,"TableID":104} │ ├── MakeAbsentIndexBackfilling {"Index":{"ConstraintID":2,"IndexID":3,"IsUnique":true,"SourceIndexID":1,"TableID":104,"TemporaryIndexID":4}} │ ├── AddColumnToIndex {"ColumnID":1,"IndexID":3,"TableID":104} @@ -45,9 +41,7 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4, ConstraintID: 3, SourceIndexID: 1 (t_pkey-)} │ │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4} │ │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4} - │ │ ├── 5 elements transitioning toward ABSENT - │ │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j-)} - │ │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j-)} + │ │ ├── 3 elements transitioning toward ABSENT │ │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-)} │ │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr-)} │ │ │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-), RecreateSourceIndexID: 0} @@ -63,15 +57,11 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4, ConstraintID: 3, SourceIndexID: 1 (t_pkey-)} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4} │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4} - │ ├── 5 elements transitioning toward ABSENT - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j-)} + │ ├── 3 elements transitioning toward ABSENT │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-)} │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr-)} │ │ └── PUBLIC → VALIDATED SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-), RecreateSourceIndexID: 0} - │ └── 15 Mutation operations - │ ├── MakePublicColumnWriteOnly {"ColumnID":2,"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":104} + │ └── 13 Mutation operations │ ├── MakePublicSecondaryIndexWriteOnly {"IndexID":2,"TableID":104} │ ├── MakeAbsentIndexBackfilling {"Index":{"ConstraintID":2,"IndexID":3,"IsUnique":true,"SourceIndexID":1,"TableID":104,"TemporaryIndexID":4}} │ ├── MaybeAddSplitForIndex {"IndexID":3,"TableID":104} @@ -134,60 +124,69 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ └── 1 Validation operation │ └── ValidateIndex {"IndexID":3,"TableID":104} └── PostCommitNonRevertiblePhase - ├── Stage 1 of 3 in PostCommitNonRevertiblePhase - │ ├── 2 elements transitioning toward PUBLIC - │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey+), ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1 (t_pkey-)} - │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 3 (t_pkey+)} + ├── Stage 1 of 4 in PostCommitNonRevertiblePhase │ ├── 3 elements transitioning toward TRANSIENT_ABSENT │ │ ├── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4, ConstraintID: 3, SourceIndexID: 1 (t_pkey-)} │ │ ├── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4} │ │ └── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4} - │ ├── 9 elements transitioning toward ABSENT - │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} + │ ├── 6 elements transitioning toward ABSENT │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-)} - │ │ ├── PUBLIC → VALIDATED PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} - │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 1 (t_pkey-)} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-), IndexID: 2 (t_expr_k_idx-)} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 2 (t_expr_k_idx-)} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 2 (t_expr_k_idx-)} │ │ ├── VALIDATED → DELETE_ONLY SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-), RecreateSourceIndexID: 0} │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "t_expr_k_idx", IndexID: 2 (t_expr_k_idx-)} - │ └── 16 Mutation operations - │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":104} + │ └── 11 Mutation operations │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":4,"TableID":104} - │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":1,"TableID":104} - │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":104} - │ ├── SetIndexName {"IndexID":3,"Name":"t_pkey","TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} - │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":3,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":4,"IndexID":2,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":2,"Ordinal":1,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"Kind":1,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - ├── Stage 2 of 3 in PostCommitNonRevertiblePhase + ├── Stage 2 of 4 in PostCommitNonRevertiblePhase + │ ├── 2 elements transitioning toward PUBLIC + │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey+), ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1 (t_pkey-)} + │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 3 (t_pkey+)} │ ├── 7 elements transitioning toward ABSENT - │ │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-)} - │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104 (t), ColumnFamilyID: 0 (primary), ColumnID: 4 (crdb_internal_idx_expr-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 1 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 2 (j-), IndexID: 1 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 1 (t_pkey-)} - │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} - │ │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-), RecreateSourceIndexID: 0} - │ └── 8 Mutation operations + │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} + │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j-)} + │ │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-)} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104 (t), ColumnFamilyID: 0 (primary), ColumnID: 4 (crdb_internal_idx_expr-)} + │ │ ├── PUBLIC → VALIDATED PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} + │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 1 (t_pkey-)} + │ │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-), RecreateSourceIndexID: 0} + │ └── 10 Mutation operations + │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":1,"TableID":104} + │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} + │ ├── SetIndexName {"IndexID":3,"Name":"t_pkey","TableID":104} + │ ├── MakePublicColumnWriteOnly {"ColumnID":2,"TableID":104} + │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":104} │ ├── MakeDeleteOnlyColumnAbsent {"ColumnID":4,"TableID":104} + │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":3,"TableID":104} + │ ├── SetJobStateOnDescriptor {"DescriptorID":104} + │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} + ├── Stage 3 of 4 in PostCommitNonRevertiblePhase + │ ├── 5 elements transitioning toward ABSENT + │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} + │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 1 (t_pkey-)} + │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 2 (j-), IndexID: 1 (t_pkey-)} + │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 1 (t_pkey-)} + │ │ └── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} + │ └── 7 Mutation operations + │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":1,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":1,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":1,"Kind":2,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":1,"Kind":2,"Ordinal":1,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - └── Stage 3 of 3 in PostCommitNonRevertiblePhase + └── Stage 4 of 4 in PostCommitNonRevertiblePhase ├── 1 element transitioning toward TRANSIENT_ABSENT │ └── PUBLIC → TRANSIENT_ABSENT IndexData:{DescID: 104 (t), IndexID: 4} ├── 5 elements transitioning toward ABSENT diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__statement_1_of_2.explain_shape b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__statement_1_of_2.explain_shape index e0a6f01bba74..34a455203831 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__statement_1_of_2.explain_shape +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__statement_1_of_2.explain_shape @@ -13,4 +13,4 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ └── from t@[4] into t_pkey+ ├── execute 1 system table mutations transaction ├── validate UNIQUE constraint backed by index t_pkey+ in relation t - └── execute 3 system table mutations transactions + └── execute 4 system table mutations transactions diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__statement_2_of_2.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__statement_2_of_2.explain index e1b74b4ef3d6..a365fcb32419 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__statement_2_of_2.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__statement_2_of_2.explain @@ -19,11 +19,9 @@ Schema change plan for CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.‹publi │ │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ │ │ └── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey-)} - │ │ ├── 5 elements transitioning toward ABSENT - │ │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j-)} + │ │ ├── 3 elements transitioning toward ABSENT │ │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-)} │ │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-), RecreateSourceIndexID: 0} - │ │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j-)} │ │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr-)} │ │ └── 1 Mutation operation │ │ └── UndoAllInTxnImmediateMutationOpSideEffects @@ -37,16 +35,12 @@ Schema change plan for CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.‹publi │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ │ └── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey-)} - │ ├── 5 elements transitioning toward ABSENT - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} + │ ├── 3 elements transitioning toward ABSENT │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-)} │ │ ├── PUBLIC → VALIDATED SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-), RecreateSourceIndexID: 0} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j-)} │ │ └── PUBLIC → ABSENT ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr-)} - │ └── 15 Mutation operations - │ ├── MakePublicColumnWriteOnly {"ColumnID":2,"TableID":104} + │ └── 13 Mutation operations │ ├── MakePublicSecondaryIndexWriteOnly {"IndexID":2,"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":104} │ ├── MakeAbsentIndexBackfilling {"Index":{"ConstraintID":2,"IndexID":3,"IsUnique":true,"SourceIndexID":1,"TableID":104,"TemporaryIndexID":4}} │ ├── MaybeAddSplitForIndex {"IndexID":3,"TableID":104} │ ├── MakeAbsentTempIndexDeleteOnly {"Index":{"ConstraintID":3,"IndexID":4,"IsUnique":true,"SourceIndexID":1,"TableID":104}} @@ -60,7 +54,7 @@ Schema change plan for CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.‹publi │ ├── SetJobStateOnDescriptor {"DescriptorID":104,"Initialize":true} │ └── CreateSchemaChangerJob {"RunningStatus":"PostCommitPhase ..."} ├── PostCommitPhase - │ ├── Stage 1 of 15 in PostCommitPhase + │ ├── Stage 1 of 7 in PostCommitPhase │ │ ├── 2 elements transitioning toward TRANSIENT_ABSENT │ │ │ ├── ABSENT → PUBLIC IndexData:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ │ │ └── DELETE_ONLY → WRITE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey-)} @@ -68,31 +62,31 @@ Schema change plan for CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.‹publi │ │ ├── MakeDeleteOnlyIndexWriteOnly {"IndexID":4,"TableID":104} │ │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ │ └── UpdateSchemaChangerJob {"RunningStatus":"PostCommitPhase ..."} - │ ├── Stage 2 of 15 in PostCommitPhase + │ ├── Stage 2 of 7 in PostCommitPhase │ │ ├── 1 element transitioning toward PUBLIC │ │ │ └── BACKFILL_ONLY → BACKFILLED PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey+), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey-)} │ │ └── 1 Backfill operation │ │ └── BackfillIndex {"IndexID":3,"SourceIndexID":1,"TableID":104} - │ ├── Stage 3 of 15 in PostCommitPhase + │ ├── Stage 3 of 7 in PostCommitPhase │ │ ├── 1 element transitioning toward PUBLIC │ │ │ └── BACKFILLED → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey+), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey-)} │ │ └── 3 Mutation operations │ │ ├── MakeBackfillingIndexDeleteOnly {"IndexID":3,"TableID":104} │ │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ │ └── UpdateSchemaChangerJob {"RunningStatus":"PostCommitPhase ..."} - │ ├── Stage 4 of 15 in PostCommitPhase + │ ├── Stage 4 of 7 in PostCommitPhase │ │ ├── 1 element transitioning toward PUBLIC │ │ │ └── DELETE_ONLY → MERGE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey+), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey-)} │ │ └── 3 Mutation operations │ │ ├── MakeBackfilledIndexMerging {"IndexID":3,"TableID":104} │ │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ │ └── UpdateSchemaChangerJob {"RunningStatus":"PostCommitPhase ..."} - │ ├── Stage 5 of 15 in PostCommitPhase + │ ├── Stage 5 of 7 in PostCommitPhase │ │ ├── 1 element transitioning toward PUBLIC │ │ │ └── MERGE_ONLY → MERGED PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey+), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey-)} │ │ └── 1 Backfill operation │ │ └── MergeIndex {"BackfilledIndexID":3,"TableID":104,"TemporaryIndexID":4} - │ ├── Stage 6 of 15 in PostCommitPhase + │ ├── Stage 6 of 7 in PostCommitPhase │ │ ├── 1 element transitioning toward PUBLIC │ │ │ └── MERGED → WRITE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey+), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey-)} │ │ ├── 1 element transitioning toward TRANSIENT_ABSENT @@ -102,156 +96,162 @@ Schema change plan for CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.‹publi │ │ ├── MakeMergedIndexWriteOnly {"IndexID":3,"TableID":104} │ │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ │ └── UpdateSchemaChangerJob {"RunningStatus":"PostCommitPhase ..."} - │ ├── Stage 7 of 15 in PostCommitPhase - │ │ ├── 1 element transitioning toward PUBLIC - │ │ │ └── WRITE_ONLY → VALIDATED PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey+), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey-)} - │ │ └── 1 Validation operation - │ │ └── ValidateIndex {"IndexID":3,"TableID":104} - │ ├── Stage 8 of 15 in PostCommitPhase - │ │ ├── 7 elements transitioning toward PUBLIC - │ │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey+), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey-)} - │ │ │ ├── ABSENT → PUBLIC IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 3 (t_pkey+)} - │ │ │ ├── ABSENT → BACKFILL_ONLY SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx+), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey+), RecreateSourceIndexID: 0} - │ │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 5 (idx+)} - │ │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 5 (idx+)} - │ │ │ ├── ABSENT → PUBLIC IndexData:{DescID: 104 (t), IndexID: 5 (idx+)} - │ │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104 (t), Name: "idx", IndexID: 5 (idx+)} - │ │ ├── 3 elements transitioning toward TRANSIENT_ABSENT - │ │ │ ├── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 6, ConstraintID: 5, SourceIndexID: 3 (t_pkey+)} - │ │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 6} - │ │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 6} - │ │ ├── 2 elements transitioning toward ABSENT - │ │ │ ├── PUBLIC → VALIDATED PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} - │ │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 1 (t_pkey-)} - │ │ └── 15 Mutation operations - │ │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":1,"TableID":104} - │ │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":104} - │ │ ├── SetIndexName {"IndexID":3,"Name":"t_pkey","TableID":104} - │ │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":3,"TableID":104} - │ │ ├── MakeAbsentIndexBackfilling {"IsSecondaryIndex":true} - │ │ ├── MaybeAddSplitForIndex {"IndexID":5,"TableID":104} - │ │ ├── AddColumnToIndex {"ColumnID":3,"IndexID":5,"TableID":104} - │ │ ├── AddColumnToIndex {"ColumnID":1,"IndexID":5,"Kind":1,"TableID":104} - │ │ ├── SetIndexName {"IndexID":5,"Name":"idx","TableID":104} - │ │ ├── MakeAbsentTempIndexDeleteOnly {"IsSecondaryIndex":true} - │ │ ├── MaybeAddSplitForIndex {"IndexID":6,"TableID":104} - │ │ ├── AddColumnToIndex {"ColumnID":3,"IndexID":6,"TableID":104} - │ │ ├── AddColumnToIndex {"ColumnID":1,"IndexID":6,"Kind":1,"TableID":104} - │ │ ├── SetJobStateOnDescriptor {"DescriptorID":104} - │ │ └── UpdateSchemaChangerJob {"RunningStatus":"PostCommitPhase ..."} - │ ├── Stage 9 of 15 in PostCommitPhase - │ │ ├── 2 elements transitioning toward TRANSIENT_ABSENT - │ │ │ ├── DELETE_ONLY → WRITE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 6, ConstraintID: 5, SourceIndexID: 3 (t_pkey+)} - │ │ │ └── ABSENT → PUBLIC IndexData:{DescID: 104 (t), IndexID: 6} - │ │ └── 3 Mutation operations - │ │ ├── MakeDeleteOnlyIndexWriteOnly {"IndexID":6,"TableID":104} - │ │ ├── SetJobStateOnDescriptor {"DescriptorID":104} - │ │ └── UpdateSchemaChangerJob {"RunningStatus":"PostCommitPhase ..."} - │ ├── Stage 10 of 15 in PostCommitPhase - │ │ ├── 1 element transitioning toward PUBLIC - │ │ │ └── BACKFILL_ONLY → BACKFILLED SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx+), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey+), RecreateSourceIndexID: 0} - │ │ └── 1 Backfill operation - │ │ └── BackfillIndex {"IndexID":5,"SourceIndexID":3,"TableID":104} - │ ├── Stage 11 of 15 in PostCommitPhase - │ │ ├── 1 element transitioning toward PUBLIC - │ │ │ └── BACKFILLED → DELETE_ONLY SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx+), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey+), RecreateSourceIndexID: 0} - │ │ └── 3 Mutation operations - │ │ ├── MakeBackfillingIndexDeleteOnly {"IndexID":5,"TableID":104} - │ │ ├── SetJobStateOnDescriptor {"DescriptorID":104} - │ │ └── UpdateSchemaChangerJob {"RunningStatus":"PostCommitPhase ..."} - │ ├── Stage 12 of 15 in PostCommitPhase - │ │ ├── 1 element transitioning toward PUBLIC - │ │ │ └── DELETE_ONLY → MERGE_ONLY SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx+), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey+), RecreateSourceIndexID: 0} - │ │ └── 3 Mutation operations - │ │ ├── MakeBackfilledIndexMerging {"IndexID":5,"TableID":104} - │ │ ├── SetJobStateOnDescriptor {"DescriptorID":104} - │ │ └── UpdateSchemaChangerJob {"RunningStatus":"PostCommitPhase ..."} - │ ├── Stage 13 of 15 in PostCommitPhase - │ │ ├── 1 element transitioning toward PUBLIC - │ │ │ └── MERGE_ONLY → MERGED SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx+), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey+), RecreateSourceIndexID: 0} - │ │ └── 1 Backfill operation - │ │ └── MergeIndex {"BackfilledIndexID":5,"TableID":104,"TemporaryIndexID":6} - │ ├── Stage 14 of 15 in PostCommitPhase - │ │ ├── 1 element transitioning toward PUBLIC - │ │ │ └── MERGED → WRITE_ONLY SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx+), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey+), RecreateSourceIndexID: 0} - │ │ ├── 1 element transitioning toward TRANSIENT_ABSENT - │ │ │ └── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 6, ConstraintID: 5, SourceIndexID: 3 (t_pkey+)} - │ │ └── 4 Mutation operations - │ │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":6,"TableID":104} - │ │ ├── MakeMergedIndexWriteOnly {"IndexID":5,"TableID":104} - │ │ ├── SetJobStateOnDescriptor {"DescriptorID":104} - │ │ └── UpdateSchemaChangerJob {"RunningStatus":"PostCommitPhase ..."} - │ └── Stage 15 of 15 in PostCommitPhase + │ └── Stage 7 of 7 in PostCommitPhase │ ├── 1 element transitioning toward PUBLIC - │ │ └── WRITE_ONLY → VALIDATED SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx+), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey+), RecreateSourceIndexID: 0} + │ │ └── WRITE_ONLY → VALIDATED PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey+), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey-)} │ └── 1 Validation operation - │ └── ValidateIndex {"IndexID":5,"TableID":104} + │ └── ValidateIndex {"IndexID":3,"TableID":104} └── PostCommitNonRevertiblePhase - ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 1 element transitioning toward PUBLIC - │ │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx+), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey+), RecreateSourceIndexID: 0} - │ ├── 6 elements transitioning toward TRANSIENT_ABSENT + ├── Stage 1 of 10 in PostCommitNonRevertiblePhase + │ ├── 3 elements transitioning toward TRANSIENT_ABSENT │ │ ├── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ │ ├── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey-)} - │ │ ├── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 6, ConstraintID: 5, SourceIndexID: 3 (t_pkey+)} - │ │ ├── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 6} - │ │ └── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 6} - │ ├── 11 elements transitioning toward ABSENT - │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} + │ │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey-)} + │ ├── 6 elements transitioning toward ABSENT │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 1 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 2 (j-), IndexID: 1 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 1 (t_pkey-)} - │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-), IndexID: 2 (t_expr_k_idx-)} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 2 (t_expr_k_idx-)} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 2 (t_expr_k_idx-)} │ │ ├── VALIDATED → DELETE_ONLY SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-), RecreateSourceIndexID: 0} │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "t_expr_k_idx", IndexID: 2 (t_expr_k_idx-)} - │ └── 21 Mutation operations - │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":104} + │ └── 11 Mutation operations │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":4,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":5,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":6,"Kind":1,"TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":1,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} - │ ├── MakeIndexAbsent {"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":1,"Kind":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":1,"Kind":2,"Ordinal":1,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":4,"IndexID":2,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":2,"Ordinal":1,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"Kind":1,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - └── Stage 2 of 2 in PostCommitNonRevertiblePhase - ├── 2 elements transitioning toward TRANSIENT_ABSENT - │ ├── PUBLIC → TRANSIENT_ABSENT IndexData:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ └── PUBLIC → TRANSIENT_ABSENT IndexData:{DescID: 104 (t), IndexID: 6} - ├── 8 elements transitioning toward ABSENT - │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104 (t), ColumnID: 2 (j-)} - │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104 (t), ColumnFamilyID: 0 (primary), ColumnID: 2 (j-)} - │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-)} - │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104 (t), ColumnFamilyID: 0 (primary), ColumnID: 4 (crdb_internal_idx_expr-)} - │ ├── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} - │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 1 (t_pkey-)} - │ ├── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-), RecreateSourceIndexID: 0} - │ └── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-)} - └── 10 Mutation operations - ├── MakeIndexAbsent {"IndexID":1,"TableID":104} + ├── Stage 2 of 10 in PostCommitNonRevertiblePhase + │ ├── 7 elements transitioning toward PUBLIC + │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey+), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey-)} + │ │ ├── ABSENT → PUBLIC IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 3 (t_pkey+)} + │ │ ├── ABSENT → BACKFILL_ONLY SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx+), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey+), RecreateSourceIndexID: 0} + │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 5 (idx+)} + │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 5 (idx+)} + │ │ ├── ABSENT → PUBLIC IndexData:{DescID: 104 (t), IndexID: 5 (idx+)} + │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104 (t), Name: "idx", IndexID: 5 (idx+)} + │ ├── 3 elements transitioning toward TRANSIENT_ABSENT + │ │ ├── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 6, ConstraintID: 5, SourceIndexID: 3 (t_pkey+)} + │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 6} + │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 6} + │ ├── 7 elements transitioning toward ABSENT + │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} + │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j-)} + │ │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-)} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104 (t), ColumnFamilyID: 0 (primary), ColumnID: 4 (crdb_internal_idx_expr-)} + │ │ ├── PUBLIC → VALIDATED PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} + │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 1 (t_pkey-)} + │ │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-), RecreateSourceIndexID: 0} + │ └── 19 Mutation operations + │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":1,"TableID":104} + │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":104} + │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} + │ ├── SetIndexName {"IndexID":3,"Name":"t_pkey","TableID":104} + │ ├── MakePublicColumnWriteOnly {"ColumnID":2,"TableID":104} + │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":104} + │ ├── MakeDeleteOnlyColumnAbsent {"ColumnID":4,"TableID":104} + │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":3,"TableID":104} + │ ├── MakeAbsentIndexBackfilling {"IsSecondaryIndex":true} + │ ├── MaybeAddSplitForIndex {"IndexID":5,"TableID":104} + │ ├── AddColumnToIndex {"ColumnID":3,"IndexID":5,"TableID":104} + │ ├── AddColumnToIndex {"ColumnID":1,"IndexID":5,"Kind":1,"TableID":104} + │ ├── SetIndexName {"IndexID":5,"Name":"idx","TableID":104} + │ ├── MakeAbsentTempIndexDeleteOnly {"IsSecondaryIndex":true} + │ ├── MaybeAddSplitForIndex {"IndexID":6,"TableID":104} + │ ├── AddColumnToIndex {"ColumnID":3,"IndexID":6,"TableID":104} + │ ├── AddColumnToIndex {"ColumnID":1,"IndexID":6,"Kind":1,"TableID":104} + │ ├── SetJobStateOnDescriptor {"DescriptorID":104} + │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} + ├── Stage 3 of 10 in PostCommitNonRevertiblePhase + │ ├── 2 elements transitioning toward TRANSIENT_ABSENT + │ │ ├── DELETE_ONLY → WRITE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 6, ConstraintID: 5, SourceIndexID: 3 (t_pkey+)} + │ │ └── ABSENT → PUBLIC IndexData:{DescID: 104 (t), IndexID: 6} + │ ├── 5 elements transitioning toward ABSENT + │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} + │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 1 (t_pkey-)} + │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 2 (j-), IndexID: 1 (t_pkey-)} + │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 1 (t_pkey-)} + │ │ └── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} + │ └── 8 Mutation operations + │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":104} + │ ├── MakeDeleteOnlyIndexWriteOnly {"IndexID":6,"TableID":104} + │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":1,"TableID":104} + │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":1,"TableID":104} + │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":1,"Kind":2,"TableID":104} + │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":1,"Kind":2,"Ordinal":1,"TableID":104} + │ ├── SetJobStateOnDescriptor {"DescriptorID":104} + │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} + ├── Stage 4 of 10 in PostCommitNonRevertiblePhase + │ ├── 1 element transitioning toward PUBLIC + │ │ └── BACKFILL_ONLY → BACKFILLED SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx+), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey+), RecreateSourceIndexID: 0} + │ └── 1 Backfill operation + │ └── BackfillIndex {"IndexID":5,"SourceIndexID":3,"TableID":104} + ├── Stage 5 of 10 in PostCommitNonRevertiblePhase + │ ├── 1 element transitioning toward PUBLIC + │ │ └── BACKFILLED → DELETE_ONLY SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx+), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey+), RecreateSourceIndexID: 0} + │ ├── 3 elements transitioning toward ABSENT + │ │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104 (t), ColumnID: 2 (j-)} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104 (t), ColumnFamilyID: 0 (primary), ColumnID: 2 (j-)} + │ │ └── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} + │ └── 5 Mutation operations + │ ├── MakeIndexAbsent {"IndexID":1,"TableID":104} + │ ├── MakeBackfillingIndexDeleteOnly {"IndexID":5,"TableID":104} + │ ├── MakeDeleteOnlyColumnAbsent {"ColumnID":2,"TableID":104} + │ ├── SetJobStateOnDescriptor {"DescriptorID":104} + │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} + ├── Stage 6 of 10 in PostCommitNonRevertiblePhase + │ ├── 1 element transitioning toward PUBLIC + │ │ └── DELETE_ONLY → MERGE_ONLY SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx+), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey+), RecreateSourceIndexID: 0} + │ └── 3 Mutation operations + │ ├── MakeBackfilledIndexMerging {"IndexID":5,"TableID":104} + │ ├── SetJobStateOnDescriptor {"DescriptorID":104} + │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} + ├── Stage 7 of 10 in PostCommitNonRevertiblePhase + │ ├── 1 element transitioning toward PUBLIC + │ │ └── MERGE_ONLY → MERGED SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx+), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey+), RecreateSourceIndexID: 0} + │ └── 1 Backfill operation + │ └── MergeIndex {"BackfilledIndexID":5,"TableID":104,"TemporaryIndexID":6} + ├── Stage 8 of 10 in PostCommitNonRevertiblePhase + │ ├── 1 element transitioning toward PUBLIC + │ │ └── MERGED → WRITE_ONLY SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx+), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey+), RecreateSourceIndexID: 0} + │ ├── 3 elements transitioning toward TRANSIENT_ABSENT + │ │ ├── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 6, ConstraintID: 5, SourceIndexID: 3 (t_pkey+)} + │ │ ├── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 6} + │ │ └── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 6} + │ └── 6 Mutation operations + │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":6,"TableID":104} + │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":6,"TableID":104} + │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":6,"Kind":1,"TableID":104} + │ ├── MakeMergedIndexWriteOnly {"IndexID":5,"TableID":104} + │ ├── SetJobStateOnDescriptor {"DescriptorID":104} + │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} + ├── Stage 9 of 10 in PostCommitNonRevertiblePhase + │ ├── 1 element transitioning toward PUBLIC + │ │ └── WRITE_ONLY → VALIDATED SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx+), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey+), RecreateSourceIndexID: 0} + │ └── 1 Validation operation + │ └── ValidateIndex {"IndexID":5,"TableID":104} + └── Stage 10 of 10 in PostCommitNonRevertiblePhase + ├── 1 element transitioning toward PUBLIC + │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 5 (idx+), ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3 (t_pkey+), RecreateSourceIndexID: 0} + ├── 3 elements transitioning toward TRANSIENT_ABSENT + │ ├── PUBLIC → TRANSIENT_ABSENT IndexData:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder)} + │ ├── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 6, ConstraintID: 5, SourceIndexID: 3 (t_pkey+)} + │ └── PUBLIC → TRANSIENT_ABSENT IndexData:{DescID: 104 (t), IndexID: 6} + ├── 2 elements transitioning toward ABSENT + │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 1 (t_pkey-)} + │ └── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-)} + └── 9 Mutation operations ├── CreateGCJobForIndex {"IndexID":1,"TableID":104} - ├── MakeIndexAbsent {"IndexID":2,"TableID":104} ├── CreateGCJobForIndex {"IndexID":2,"TableID":104} ├── CreateGCJobForIndex {"IndexID":4,"TableID":104} + ├── MakeValidatedSecondaryIndexPublic {"IndexID":5,"TableID":104} + ├── RefreshStats {"TableID":104} + ├── MakeIndexAbsent {"IndexID":6,"TableID":104} ├── CreateGCJobForIndex {"IndexID":6,"TableID":104} - ├── MakeDeleteOnlyColumnAbsent {"ColumnID":2,"TableID":104} - ├── MakeDeleteOnlyColumnAbsent {"ColumnID":4,"TableID":104} ├── RemoveJobStateFromDescriptor {"DescriptorID":104} └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"all stages compl..."} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__statement_2_of_2.explain_shape b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__statement_2_of_2.explain_shape index ed4e839cbe4f..b07fa6a683f9 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__statement_2_of_2.explain_shape +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements/drop_column_create_index_separate_statements__statement_2_of_2.explain_shape @@ -14,7 +14,7 @@ Schema change plan for CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.‹publi │ └── from crdb_internal_index_4_name_placeholder into t_pkey+ ├── execute 1 system table mutations transaction ├── validate UNIQUE constraint backed by index t_pkey+ in relation t - ├── execute 2 system table mutations transactions + ├── execute 3 system table mutations transactions ├── backfill using primary index t_pkey+ in relation t │ └── into idx+ (k: i) ├── execute 2 system table mutations transactions @@ -22,4 +22,4 @@ Schema change plan for CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.‹publi │ └── from t@[6] into idx+ ├── execute 1 system table mutations transaction ├── validate UNIQUE constraint backed by index idx+ in relation t - └── execute 2 system table mutations transactions + └── execute 1 system table mutations transaction diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements.definition b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements.definition index c17f36466d8c..6024b4eee688 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements.definition +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements.definition @@ -8,11 +8,15 @@ setup CREATE TABLE t (i INT PRIMARY KEY, j INT, k INT DEFAULT 32 ON UPDATE 42, INDEX((j+1), k)); ---- - +# At this point, column j is still public as the computed column +# and the secondary index is cleaned up first. +# k has moved to the a non-public phase and so we +# start getting the "column does not exist" errors +# for k stage-exec phase=PostCommitPhase stage=: INSERT INTO t (i, j, k) VALUES($stageKey, $stageKey, $stageKey); ---- -pq: column "j" does not exist +pq: column "k" does not exist stage-exec phase=PostCommitPhase stage=: INSERT INTO t (i) VALUES($stageKey); @@ -21,27 +25,40 @@ INSERT INTO t (i) VALUES($stageKey); stage-exec phase=PostCommitPhase stage=: SELECT j+1, k FROM t ---- -pq: column "j" does not exist +pq: column "k" does not exist stage-exec phase=PostCommitPhase stage=: SELECT count(i) FROM t ---- $successfulStageCount -stage-exec phase=PostCommitNonRevertiblePhase stage=: -INSERT INTO t (i, j, k) VALUES($stageKey, $stageKey, $stageKey); +stage-exec phase=PostCommitNonRevertiblePhase stage=1:2 +SELECT j+1, k FROM t ---- -pq: column "j" does not exist +pq: column "k" does not exist -stage-exec phase=PostCommitNonRevertiblePhase stage=: -INSERT INTO t (i) VALUES($stageKey); +stage-exec phase=PostCommitNonRevertiblePhase stage=1:2 +INSERT INTO t (i, j, k) VALUES($stageKey, $stageKey+1, $stageKey); ---- +pq: column "k" does not exist -stage-exec phase=PostCommitNonRevertiblePhase stage=: +# At this point, the computed column and index have been dropped, +# and j has moved to a WRITE_ONLY stage. Now, we start seeing +# the "column j not found" errors +stage-exec phase=PostCommitNonRevertiblePhase stage=3: SELECT j+1, k FROM t ---- pq: column "j" does not exist +stage-exec phase=PostCommitNonRevertiblePhase stage=3: +INSERT INTO t (i, j, k) VALUES($stageKey, $stageKey, $stageKey); +---- +pq: column "j" does not exist + +stage-exec phase=PostCommitNonRevertiblePhase stage=: +INSERT INTO t (i) VALUES($stageKey); +---- + stage-exec phase=PostCommitNonRevertiblePhase stage=: SELECT count(i) FROM t ---- diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements.side_effects b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements.side_effects index 55bc2dcfb5f2..26b0245fa7f3 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements.side_effects +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements.side_effects @@ -21,20 +21,8 @@ write *eventpb.AlterTable to event log: tag: ALTER TABLE user: root tableName: defaultdb.public.t -## StatementPhase stage 1 of 1 with 11 MutationType ops +## StatementPhase stage 1 of 1 with 9 MutationType ops upsert descriptor #104 - ... - oid: 20 - width: 64 - - - id: 2 - - name: j - - nullable: true - - type: - - family: IntFamily - - oid: 20 - - width: 64 - - defaultExpr: 32:::INT8 - id: 3 ... oid: 20 width: 64 @@ -51,12 +39,6 @@ upsert descriptor #104 createAsOfTime: wallTime: "1640995200000000000" ... - columnNames: - - i - - - j - + - crdb_internal_column_2_name_placeholder - - k - name: primary formatVersion: 3 id: 104 - indexes: @@ -83,17 +65,6 @@ upsert descriptor #104 + indexes: [] modificationTime: {} + mutations: - + - column: - + id: 2 - + name: crdb_internal_column_2_name_placeholder - + nullable: true - + type: - + family: IntFamily - + oid: 20 - + width: 64 - + direction: DROP - + mutationId: 1 - + state: WRITE_ONLY + - direction: DROP + index: + createdAtNanos: "1640995200000000000" @@ -172,7 +143,7 @@ upsert descriptor #104 + mutationId: 1 + state: DELETE_ONLY + - column: - + computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 + + computeExpr: j + 1:::INT8 + id: 4 + inaccessible: true + name: crdb_internal_column_4_name_placeholder @@ -194,13 +165,6 @@ upsert descriptor #104 + nextIndexId: 5 nextMutationId: 1 parentId: 100 - ... - - 3 - storeColumnNames: - - - j - + - crdb_internal_column_2_name_placeholder - - k - unique: true ... time: {} unexposedParentSchemaId: 101 @@ -235,7 +199,7 @@ upsert descriptor #104 wallTime: "1640995200000000000" ... - i - - crdb_internal_column_2_name_placeholder + - j - - k + - crdb_internal_column_3_name_placeholder name: primary @@ -285,7 +249,7 @@ upsert descriptor #104 nextColumnId: 5 ... storeColumnNames: - - crdb_internal_column_2_name_placeholder + - j - - k + - crdb_internal_column_3_name_placeholder unique: true @@ -300,18 +264,11 @@ upsert descriptor #104 ## PreCommitPhase stage 1 of 2 with 1 MutationType op undo all catalog changes within txn #1 persist all catalog changes to storage -## PreCommitPhase stage 2 of 2 with 15 MutationType ops +## PreCommitPhase stage 2 of 2 with 13 MutationType ops upsert descriptor #104 ... oid: 20 width: 64 - - - id: 2 - - name: j - - nullable: true - - type: - - family: IntFamily - - oid: 20 - - width: 64 - - defaultExpr: 32:::INT8 - id: 3 - name: k @@ -341,7 +298,6 @@ upsert descriptor #104 + nameMapping: + columns: + "1": i - + "2": crdb_internal_column_2_name_placeholder + "4": crdb_internal_column_4_name_placeholder + "4294967294": tableoid + "4294967295": crdb_internal_mvcc_timestamp @@ -368,11 +324,9 @@ upsert descriptor #104 families: - columnIds: ... - columnNames: - i - - - j + - j - - k - + - crdb_internal_column_2_name_placeholder + - crdb_internal_column_3_name_placeholder name: primary formatVersion: 3 @@ -401,17 +355,6 @@ upsert descriptor #104 + indexes: [] modificationTime: {} + mutations: - + - column: - + id: 2 - + name: crdb_internal_column_2_name_placeholder - + nullable: true - + type: - + family: IntFamily - + oid: 20 - + width: 64 - + direction: DROP - + mutationId: 1 - + state: WRITE_ONLY + - direction: DROP + index: + createdAtNanos: "1640995200000000000" @@ -497,7 +440,7 @@ upsert descriptor #104 + mutationId: 1 + state: WRITE_ONLY + - column: - + computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 + + computeExpr: j + 1:::INT8 + id: 4 + inaccessible: true + name: crdb_internal_column_4_name_placeholder @@ -520,11 +463,9 @@ upsert descriptor #104 nextMutationId: 1 parentId: 100 ... - - 3 storeColumnNames: - - - j + - j - - k - + - crdb_internal_column_2_name_placeholder + - crdb_internal_column_3_name_placeholder unique: true version: 4 @@ -636,7 +577,7 @@ begin transaction #9 validate forward indexes [3] in table #104 commit transaction #9 begin transaction #10 -## PostCommitNonRevertiblePhase stage 1 of 3 with 16 MutationType ops +## PostCommitNonRevertiblePhase stage 1 of 4 with 11 MutationType ops upsert descriptor #104 ... statementTag: ALTER TABLE @@ -644,13 +585,6 @@ upsert descriptor #104 - revertible: true targetRanks: targets: - ... - direction: DROP - mutationId: 1 - - state: WRITE_ONLY - + state: DELETE_ONLY - - direction: DROP - index: ... keySuffixColumnIds: - 1 @@ -661,29 +595,12 @@ upsert descriptor #104 version: 3 mutationId: 1 - state: WRITE_ONLY - - - direction: ADD - - index: - - constraintId: 2 - - createdExplicitly: true - - encodingType: 1 - - foreignKey: {} - - geoConfig: {} - - id: 3 - - interleave: {} - - keyColumnDirections: - - - ASC - - keyColumnIds: - - - 1 - - keyColumnNames: - - - i - - name: crdb_internal_index_3_name_placeholder - - partitioning: {} - - sharded: {} - - storeColumnNames: [] - - unique: true - - version: 4 - - mutationId: 1 - - state: WRITE_ONLY + + state: DELETE_ONLY + - direction: ADD + index: + ... + mutationId: 1 + state: WRITE_ONLY - - direction: DROP - index: - constraintId: 3 @@ -707,89 +624,57 @@ upsert descriptor #104 - useDeletePreservingEncoding: true - version: 4 - mutationId: 1 - state: DELETE_ONLY + - state: DELETE_ONLY - column: + defaultExpr: 32:::INT8 ... direction: DROP mutationId: 1 - state: WRITE_ONLY + state: DELETE_ONLY - column: - computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 + computeExpr: j + 1:::INT8 ... direction: DROP mutationId: 1 + - state: WRITE_ONLY + state: DELETE_ONLY - + - direction: DROP - + index: - + constraintId: 1 - + createdAtNanos: "1640995200000000000" - + encodingType: 1 - + foreignKey: {} - + geoConfig: {} - + id: 1 - + interleave: {} - + keyColumnDirections: - + - ASC - + keyColumnIds: - + - 1 - + keyColumnNames: - + - i - + name: crdb_internal_index_1_name_placeholder - + partitioning: {} - + sharded: {} - + storeColumnIds: - + - 2 - + - 3 - + storeColumnNames: - + - crdb_internal_column_2_name_placeholder - + - crdb_internal_column_3_name_placeholder - + unique: true - + version: 4 - + mutationId: 1 - state: WRITE_ONLY name: t - ... - parentId: 100 - primaryIndex: - - constraintId: 1 - - createdAtNanos: "1640995200000000000" - + constraintId: 2 - + createdExplicitly: true - encodingType: 1 - foreignKey: {} - geoConfig: {} - - id: 1 - + id: 3 - interleave: {} - keyColumnDirections: - ... - partitioning: {} - sharded: {} - - storeColumnIds: - - - 2 - - - 3 - - storeColumnNames: - - - crdb_internal_column_2_name_placeholder - - - crdb_internal_column_3_name_placeholder - + storeColumnNames: [] - unique: true - version: 4 + nextColumnId: 5 ... time: {} unexposedParentSchemaId: 101 - version: "6" + version: "7" persist all catalog changes to storage -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 3 with 6 MutationType ops pending" +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 4 with 8 MutationType ops pending" set schema change job #1 to non-cancellable commit transaction #10 begin transaction #11 -## PostCommitNonRevertiblePhase stage 2 of 3 with 8 MutationType ops +## PostCommitNonRevertiblePhase stage 2 of 4 with 10 MutationType ops upsert descriptor #104 ... - mutationId: 1 - state: DELETE_ONLY + oid: 20 + width: 64 + - - id: 2 + - name: j + - nullable: true + - type: + - family: IntFamily + - oid: 20 + - width: 64 + createAsOfTime: + wallTime: "1640995200000000000" + ... + columnNames: + - i + - - j + + - crdb_internal_column_2_name_placeholder + - crdb_internal_column_3_name_placeholder + name: primary + ... + modificationTime: {} + mutations: - - direction: DROP - index: - createdAtNanos: "1640995200000000000" @@ -812,15 +697,67 @@ upsert descriptor #104 - partitioning: {} - sharded: {} - version: 3 - - mutationId: 1 - - state: DELETE_ONLY + + - column: + + defaultExpr: 32:::INT8 + + id: 3 + + name: crdb_internal_column_3_name_placeholder + + nullable: true + + onUpdateExpr: 42:::INT8 + + type: + + family: IntFamily + + oid: 20 + + width: 64 + + direction: DROP + mutationId: 1 + state: DELETE_ONLY + - - direction: ADD + + - direction: DROP + index: + - constraintId: 2 + - createdExplicitly: true + + constraintId: 1 + + createdAtNanos: "1640995200000000000" + encodingType: 1 + foreignKey: {} + geoConfig: {} + - id: 3 + + id: 1 + interleave: {} + keyColumnDirections: + ... + keyColumnNames: + - i + - name: crdb_internal_index_3_name_placeholder + + name: crdb_internal_index_1_name_placeholder + partitioning: {} + sharded: {} + - storeColumnNames: [] + + storeColumnIds: + + - 2 + + - 3 + + storeColumnNames: + + - crdb_internal_column_2_name_placeholder + + - crdb_internal_column_3_name_placeholder + unique: true + version: 4 + ... + state: WRITE_ONLY - column: - defaultExpr: 32:::INT8 + - defaultExpr: 32:::INT8 + - id: 3 + - name: crdb_internal_column_3_name_placeholder + + id: 2 + + name: crdb_internal_column_2_name_placeholder + nullable: true + - onUpdateExpr: 42:::INT8 + type: + family: IntFamily ... + direction: DROP mutationId: 1 - state: DELETE_ONLY + - state: DELETE_ONLY - - column: - - computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 + - computeExpr: j + 1:::INT8 - id: 4 - inaccessible: true - name: crdb_internal_column_4_name_placeholder @@ -833,25 +770,70 @@ upsert descriptor #104 - direction: DROP - mutationId: 1 - state: DELETE_ONLY - - direction: DROP - index: + + state: WRITE_ONLY + name: t + nextColumnId: 5 + ... + parentId: 100 + primaryIndex: + - constraintId: 1 + - createdAtNanos: "1640995200000000000" + + constraintId: 2 + + createdExplicitly: true + encodingType: 1 + foreignKey: {} + geoConfig: {} + - id: 1 + + id: 3 + interleave: {} + keyColumnDirections: + ... + partitioning: {} + sharded: {} + - storeColumnIds: + - - 2 + - - 3 + - storeColumnNames: + - - j + - - crdb_internal_column_3_name_placeholder + + storeColumnNames: [] + unique: true + version: 4 + ... + time: {} + unexposedParentSchemaId: 101 + - version: "7" + + version: "8" +persist all catalog changes to storage +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 4 with 5 MutationType ops pending" +commit transaction #11 +begin transaction #12 +## PostCommitNonRevertiblePhase stage 3 of 4 with 7 MutationType ops +upsert descriptor #104 ... version: 4 mutationId: 1 - state: WRITE_ONLY + + state: DELETE_ONLY + - column: + id: 2 + ... + direction: DROP + mutationId: 1 + - state: WRITE_ONLY + state: DELETE_ONLY name: t nextColumnId: 5 ... time: {} unexposedParentSchemaId: 101 - - version: "7" - + version: "8" + - version: "8" + + version: "9" persist all catalog changes to storage -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 3 with 8 MutationType ops pending" -commit transaction #11 -begin transaction #12 -## PostCommitNonRevertiblePhase stage 3 of 3 with 10 MutationType ops +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 4 of 4 with 8 MutationType ops pending" +commit transaction #12 +begin transaction #13 +## PostCommitNonRevertiblePhase stage 4 of 4 with 10 MutationType ops upsert descriptor #104 ... createAsOfTime: @@ -864,7 +846,6 @@ upsert descriptor #104 - nameMapping: - columns: - "1": i - - "2": crdb_internal_column_2_name_placeholder - "4": crdb_internal_column_4_name_placeholder - "4294967294": tableoid - "4294967295": crdb_internal_mvcc_timestamp @@ -903,17 +884,6 @@ upsert descriptor #104 modificationTime: {} - mutations: - - column: - - id: 2 - - name: crdb_internal_column_2_name_placeholder - - nullable: true - - type: - - family: IntFamily - - oid: 20 - - width: 64 - - direction: DROP - - mutationId: 1 - - state: DELETE_ONLY - - - column: - defaultExpr: 32:::INT8 - id: 3 - name: crdb_internal_column_3_name_placeholder @@ -954,14 +924,25 @@ upsert descriptor #104 - version: 4 - mutationId: 1 - state: DELETE_ONLY + - - column: + - id: 2 + - name: crdb_internal_column_2_name_placeholder + - nullable: true + - type: + - family: IntFamily + - oid: 20 + - width: 64 + - direction: DROP + - mutationId: 1 + - state: DELETE_ONLY + mutations: [] name: t nextColumnId: 5 ... time: {} unexposedParentSchemaId: 101 - - version: "8" - + version: "9" + - version: "9" + + version: "10" persist all catalog changes to storage create job #2 (non-cancelable: true): "GC for ALTER TABLE defaultdb.public.t DROP COLUMN j CASCADE" descriptor IDs: [104] @@ -971,6 +952,6 @@ updated schema change job #1 descriptor IDs to [] write *eventpb.FinishSchemaChange to event log: sc: descriptorId: 104 -commit transaction #12 +commit transaction #13 notified job registry to adopt jobs: [2] # end PostCommitPhase diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_1_of_7.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_1_of_7.explain index 3a5f079f3ed3..99e33d569fd0 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_1_of_7.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_1_of_7.explain @@ -9,15 +9,13 @@ EXPLAIN (DDL) rollback at post-commit stage 1 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹k› CASCADE; following ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase └── Stage 1 of 1 in PostCommitNonRevertiblePhase - ├── 9 elements transitioning toward PUBLIC + ├── 7 elements transitioning toward PUBLIC │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 3 (k+)} │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "k", ColumnID: 3 (k+)} - │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr+)} │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx+), RecreateSourceIndexID: 0} │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k+), IndexID: 3 (t_pkey-)} │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k+), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr+)} ├── 5 elements transitioning toward ABSENT │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} @@ -25,24 +23,21 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ ├── BACKFILL_ONLY → ABSENT PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} │ └── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} - └── 20 Mutation operations + └── 17 Mutation operations ├── SetColumnName {"ColumnID":3,"Name":"k","TableID":104} ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} ├── RefreshStats {"TableID":104} ├── AddColumnToIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} ├── AddColumnToIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} - ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} ├── MakeIndexAbsent {"IndexID":4,"TableID":104} - ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - ├── RefreshStats {"TableID":104} - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - ├── MakeIndexAbsent {"IndexID":3,"TableID":104} ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} ├── RefreshStats {"TableID":104} ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} ├── RefreshStats {"TableID":104} + ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} + ├── MakeIndexAbsent {"IndexID":3,"TableID":104} ├── CreateGCJobForIndex {"IndexID":3,"TableID":104} ├── RemoveJobStateFromDescriptor {"DescriptorID":104} └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"all stages compl..."} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_2_of_7.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_2_of_7.explain index 372f729cf0ba..522a394a61d6 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_2_of_7.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_2_of_7.explain @@ -9,39 +9,34 @@ EXPLAIN (DDL) rollback at post-commit stage 2 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹k› CASCADE; following ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 9 elements transitioning toward PUBLIC + │ ├── 7 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 3 (k+)} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "k", ColumnID: 3 (k+)} - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr+)} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx+), RecreateSourceIndexID: 0} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k+), IndexID: 3 (t_pkey-)} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k+), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr+)} │ ├── 4 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ │ ├── BACKFILL_ONLY → ABSENT PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} - │ └── 19 Mutation operations + │ └── 16 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"k","TableID":104} │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── AddColumnToIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} │ ├── AddColumnToIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} + │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} + │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} + │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_3_of_7.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_3_of_7.explain index 9feb0ea52b2b..8536a24cfca6 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_3_of_7.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_3_of_7.explain @@ -9,39 +9,34 @@ EXPLAIN (DDL) rollback at post-commit stage 3 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹k› CASCADE; following ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 9 elements transitioning toward PUBLIC + │ ├── 7 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 3 (k+)} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "k", ColumnID: 3 (k+)} - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr+)} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx+), RecreateSourceIndexID: 0} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k+), IndexID: 3 (t_pkey-)} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k+), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr+)} │ ├── 4 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ │ ├── BACKFILL_ONLY → ABSENT PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} - │ └── 19 Mutation operations + │ └── 16 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"k","TableID":104} │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── AddColumnToIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} │ ├── AddColumnToIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} + │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} + │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} + │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_4_of_7.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_4_of_7.explain index 3f25f9dbe19f..6f5e6ec38c8c 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_4_of_7.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_4_of_7.explain @@ -9,39 +9,34 @@ EXPLAIN (DDL) rollback at post-commit stage 4 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹k› CASCADE; following ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 9 elements transitioning toward PUBLIC + │ ├── 7 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 3 (k+)} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "k", ColumnID: 3 (k+)} - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr+)} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx+), RecreateSourceIndexID: 0} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k+), IndexID: 3 (t_pkey-)} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k+), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr+)} │ ├── 4 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ │ ├── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} - │ └── 19 Mutation operations + │ └── 16 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"k","TableID":104} │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── AddColumnToIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} │ ├── AddColumnToIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} + │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_5_of_7.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_5_of_7.explain index 05061949115f..9d450e104583 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_5_of_7.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_5_of_7.explain @@ -9,38 +9,33 @@ EXPLAIN (DDL) rollback at post-commit stage 5 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹k› CASCADE; following ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 9 elements transitioning toward PUBLIC + │ ├── 7 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 3 (k+)} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "k", ColumnID: 3 (k+)} - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr+)} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx+), RecreateSourceIndexID: 0} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k+), IndexID: 3 (t_pkey-)} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k+), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr+)} │ ├── 4 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ │ ├── MERGE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} - │ └── 19 Mutation operations + │ └── 16 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"k","TableID":104} │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── AddColumnToIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} │ ├── AddColumnToIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} + │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} + │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_6_of_7.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_6_of_7.explain index 2a60b54627e2..949211c0ca47 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_6_of_7.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_6_of_7.explain @@ -9,38 +9,33 @@ EXPLAIN (DDL) rollback at post-commit stage 6 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹k› CASCADE; following ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 9 elements transitioning toward PUBLIC + │ ├── 7 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 3 (k+)} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "k", ColumnID: 3 (k+)} - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr+)} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx+), RecreateSourceIndexID: 0} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k+), IndexID: 3 (t_pkey-)} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k+), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr+)} │ ├── 4 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ │ ├── MERGE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} - │ └── 19 Mutation operations + │ └── 16 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"k","TableID":104} │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── AddColumnToIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} │ ├── AddColumnToIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} + │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} + │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_7_of_7.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_7_of_7.explain index 1696226cf1dd..2610d2ffc1c4 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_7_of_7.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__rollback_7_of_7.explain @@ -9,39 +9,34 @@ EXPLAIN (DDL) rollback at post-commit stage 7 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹k› CASCADE; following ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 9 elements transitioning toward PUBLIC + │ ├── 7 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 3 (k+)} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "k", ColumnID: 3 (k+)} - │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j+)} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr+)} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx+), RecreateSourceIndexID: 0} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k+), IndexID: 3 (t_pkey-)} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k+), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j+)} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr+)} │ ├── 4 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 3 (t_pkey-)} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ │ ├── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey-), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey+)} │ │ └── TRANSIENT_DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey+)} - │ └── 19 Mutation operations + │ └── 16 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"k","TableID":104} │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── AddColumnToIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} │ ├── AddColumnToIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} + │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} + │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} + │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__statement_1_of_2.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__statement_1_of_2.explain index aade09762b3a..a996d150b669 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__statement_1_of_2.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__statement_1_of_2.explain @@ -16,15 +16,11 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4, ConstraintID: 3, SourceIndexID: 1 (t_pkey-)} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4} │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4} - │ ├── 5 elements transitioning toward ABSENT - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j-)} + │ ├── 3 elements transitioning toward ABSENT │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-)} │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr-)} │ │ └── PUBLIC → VALIDATED SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-), RecreateSourceIndexID: 0} - │ └── 11 Mutation operations - │ ├── MakePublicColumnWriteOnly {"ColumnID":2,"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":104} + │ └── 9 Mutation operations │ ├── MakePublicSecondaryIndexWriteOnly {"IndexID":2,"TableID":104} │ ├── MakeAbsentIndexBackfilling {"Index":{"ConstraintID":2,"IndexID":3,"IsUnique":true,"SourceIndexID":1,"TableID":104,"TemporaryIndexID":4}} │ ├── AddColumnToIndex {"ColumnID":1,"IndexID":3,"TableID":104} @@ -45,9 +41,7 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4, ConstraintID: 3, SourceIndexID: 1 (t_pkey-)} │ │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4} │ │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4} - │ │ ├── 5 elements transitioning toward ABSENT - │ │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j-)} - │ │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j-)} + │ │ ├── 3 elements transitioning toward ABSENT │ │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-)} │ │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr-)} │ │ │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-), RecreateSourceIndexID: 0} @@ -63,15 +57,11 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4, ConstraintID: 3, SourceIndexID: 1 (t_pkey-)} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4} │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4} - │ ├── 5 elements transitioning toward ABSENT - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j-)} + │ ├── 3 elements transitioning toward ABSENT │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-)} │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr-)} │ │ └── PUBLIC → VALIDATED SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-), RecreateSourceIndexID: 0} - │ └── 15 Mutation operations - │ ├── MakePublicColumnWriteOnly {"ColumnID":2,"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":104} + │ └── 13 Mutation operations │ ├── MakePublicSecondaryIndexWriteOnly {"IndexID":2,"TableID":104} │ ├── MakeAbsentIndexBackfilling {"Index":{"ConstraintID":2,"IndexID":3,"IsUnique":true,"SourceIndexID":1,"TableID":104,"TemporaryIndexID":4}} │ ├── MaybeAddSplitForIndex {"IndexID":3,"TableID":104} @@ -134,60 +124,69 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ └── 1 Validation operation │ └── ValidateIndex {"IndexID":3,"TableID":104} └── PostCommitNonRevertiblePhase - ├── Stage 1 of 3 in PostCommitNonRevertiblePhase - │ ├── 2 elements transitioning toward PUBLIC - │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey+), ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1 (t_pkey-)} - │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 3 (t_pkey+)} + ├── Stage 1 of 4 in PostCommitNonRevertiblePhase │ ├── 3 elements transitioning toward TRANSIENT_ABSENT │ │ ├── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4, ConstraintID: 3, SourceIndexID: 1 (t_pkey-)} │ │ ├── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4} │ │ └── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 4} - │ ├── 9 elements transitioning toward ABSENT - │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} + │ ├── 6 elements transitioning toward ABSENT │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-)} - │ │ ├── PUBLIC → VALIDATED PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} - │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 1 (t_pkey-)} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-), IndexID: 2 (t_expr_k_idx-)} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 2 (t_expr_k_idx-)} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 2 (t_expr_k_idx-)} │ │ ├── VALIDATED → DELETE_ONLY SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-), RecreateSourceIndexID: 0} │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "t_expr_k_idx", IndexID: 2 (t_expr_k_idx-)} - │ └── 16 Mutation operations - │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":104} + │ └── 11 Mutation operations │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":4,"TableID":104} - │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":1,"TableID":104} - │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":104} - │ ├── SetIndexName {"IndexID":3,"Name":"t_pkey","TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} - │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":3,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":4,"IndexID":2,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":2,"Ordinal":1,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"Kind":1,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - ├── Stage 2 of 3 in PostCommitNonRevertiblePhase + ├── Stage 2 of 4 in PostCommitNonRevertiblePhase + │ ├── 2 elements transitioning toward PUBLIC + │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey+), ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1 (t_pkey-)} + │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 3 (t_pkey+)} │ ├── 7 elements transitioning toward ABSENT - │ │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-)} - │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104 (t), ColumnFamilyID: 0 (primary), ColumnID: 4 (crdb_internal_idx_expr-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 1 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 2 (j-), IndexID: 1 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 1 (t_pkey-)} - │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} - │ │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-), RecreateSourceIndexID: 0} - │ └── 8 Mutation operations + │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} + │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j-)} + │ │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-)} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104 (t), ColumnFamilyID: 0 (primary), ColumnID: 4 (crdb_internal_idx_expr-)} + │ │ ├── PUBLIC → VALIDATED PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} + │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 1 (t_pkey-)} + │ │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-), RecreateSourceIndexID: 0} + │ └── 10 Mutation operations + │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":1,"TableID":104} + │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} + │ ├── SetIndexName {"IndexID":3,"Name":"t_pkey","TableID":104} + │ ├── MakePublicColumnWriteOnly {"ColumnID":2,"TableID":104} + │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":104} │ ├── MakeDeleteOnlyColumnAbsent {"ColumnID":4,"TableID":104} + │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":3,"TableID":104} + │ ├── SetJobStateOnDescriptor {"DescriptorID":104} + │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} + ├── Stage 3 of 4 in PostCommitNonRevertiblePhase + │ ├── 5 elements transitioning toward ABSENT + │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} + │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 1 (t_pkey-)} + │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 2 (j-), IndexID: 1 (t_pkey-)} + │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k), IndexID: 1 (t_pkey-)} + │ │ └── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} + │ └── 7 Mutation operations + │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":1,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":1,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":1,"Kind":2,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":1,"Kind":2,"Ordinal":1,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - └── Stage 3 of 3 in PostCommitNonRevertiblePhase + └── Stage 4 of 4 in PostCommitNonRevertiblePhase ├── 1 element transitioning toward TRANSIENT_ABSENT │ └── PUBLIC → TRANSIENT_ABSENT IndexData:{DescID: 104 (t), IndexID: 4} ├── 5 elements transitioning toward ABSENT diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__statement_1_of_2.explain_shape b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__statement_1_of_2.explain_shape index e0a6f01bba74..34a455203831 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__statement_1_of_2.explain_shape +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__statement_1_of_2.explain_shape @@ -13,4 +13,4 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ └── from t@[4] into t_pkey+ ├── execute 1 system table mutations transaction ├── validate UNIQUE constraint backed by index t_pkey+ in relation t - └── execute 3 system table mutations transactions + └── execute 4 system table mutations transactions diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__statement_2_of_2.explain b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__statement_2_of_2.explain index 56487a905bfd..473dc8c320a1 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__statement_2_of_2.explain +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__statement_2_of_2.explain @@ -25,14 +25,12 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── 2 elements transitioning toward TRANSIENT_ABSENT │ │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ │ │ └── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey-)} - │ │ ├── 8 elements transitioning toward ABSENT + │ │ ├── 6 elements transitioning toward ABSENT │ │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 3 (k-)} │ │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "k", ColumnID: 3 (k-)} - │ │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 2 (j-)} │ │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-)} │ │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-), RecreateSourceIndexID: 0} │ │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k-), IndexID: 4 (crdb_internal_index_4_name_placeholder)} - │ │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j-)} │ │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr-)} │ │ └── 1 Mutation operation │ │ └── UndoAllInTxnImmediateMutationOpSideEffects @@ -44,18 +42,14 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── 2 elements transitioning toward TRANSIENT_ABSENT │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ │ └── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey-)} - │ ├── 7 elements transitioning toward ABSENT + │ ├── 5 elements transitioning toward ABSENT │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104 (t), ColumnID: 3 (k-)} │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104 (t), Name: "k", ColumnID: 3 (k-)} - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-)} │ │ ├── PUBLIC → VALIDATED SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-), RecreateSourceIndexID: 0} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j-)} │ │ └── PUBLIC → ABSENT ColumnName:{DescID: 104 (t), Name: "crdb_internal_idx_expr", ColumnID: 4 (crdb_internal_idx_expr-)} - │ └── 15 Mutation operations - │ ├── MakePublicColumnWriteOnly {"ColumnID":2,"TableID":104} + │ └── 13 Mutation operations │ ├── MakePublicSecondaryIndexWriteOnly {"IndexID":2,"TableID":104} - │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":104} │ ├── MakeAbsentIndexBackfilling {"Index":{"ConstraintID":2,"IndexID":3,"IsUnique":true,"SourceIndexID":1,"TableID":104,"TemporaryIndexID":4}} │ ├── MaybeAddSplitForIndex {"IndexID":3,"TableID":104} │ ├── MakeAbsentTempIndexDeleteOnly {"Index":{"ConstraintID":3,"IndexID":4,"IsUnique":true,"SourceIndexID":1,"TableID":104}} @@ -117,69 +111,78 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ └── 1 Validation operation │ └── ValidateIndex {"IndexID":3,"TableID":104} └── PostCommitNonRevertiblePhase - ├── Stage 1 of 3 in PostCommitNonRevertiblePhase - │ ├── 2 elements transitioning toward PUBLIC - │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey+), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey-)} - │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 3 (t_pkey+)} + ├── Stage 1 of 4 in PostCommitNonRevertiblePhase │ ├── 2 elements transitioning toward TRANSIENT_ABSENT │ │ ├── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 4 (crdb_internal_index_4_name_placeholder)} │ │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder), ConstraintID: 3, SourceIndexID: 1 (t_pkey-)} - │ ├── 10 elements transitioning toward ABSENT + │ ├── 7 elements transitioning toward ABSENT │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104 (t), ColumnID: 3 (k-)} - │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-)} - │ │ ├── PUBLIC → VALIDATED PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} - │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 1 (t_pkey-)} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-), IndexID: 2 (t_expr_k_idx-)} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k-), IndexID: 2 (t_expr_k_idx-)} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 2 (t_expr_k_idx-)} │ │ ├── VALIDATED → DELETE_ONLY SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-), RecreateSourceIndexID: 0} │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "t_expr_k_idx", IndexID: 2 (t_expr_k_idx-)} - │ └── 16 Mutation operations + │ └── 11 Mutation operations │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":3,"TableID":104} - │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":104} │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":4,"TableID":104} - │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":1,"TableID":104} - │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── SetIndexName {"IndexID":3,"Name":"t_pkey","TableID":104} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} - │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":3,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":4,"IndexID":2,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":2,"Ordinal":1,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"Kind":1,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - ├── Stage 2 of 3 in PostCommitNonRevertiblePhase + ├── Stage 2 of 4 in PostCommitNonRevertiblePhase + │ ├── 2 elements transitioning toward PUBLIC + │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104 (t), IndexID: 3 (t_pkey+), ConstraintID: 2, TemporaryIndexID: 4 (crdb_internal_index_4_name_placeholder), SourceIndexID: 1 (t_pkey-)} + │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 3 (t_pkey+)} │ ├── 7 elements transitioning toward ABSENT - │ │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-)} - │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104 (t), ColumnFamilyID: 0 (primary), ColumnID: 4 (crdb_internal_idx_expr-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 1 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 2 (j-), IndexID: 1 (t_pkey-)} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k-), IndexID: 1 (t_pkey-)} - │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} - │ │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-), RecreateSourceIndexID: 0} - │ └── 8 Mutation operations + │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} + │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104 (t), Name: "j", ColumnID: 2 (j-)} + │ │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104 (t), ColumnID: 4 (crdb_internal_idx_expr-)} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104 (t), ColumnFamilyID: 0 (primary), ColumnID: 4 (crdb_internal_idx_expr-)} + │ │ ├── PUBLIC → VALIDATED PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} + │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104 (t), Name: "t_pkey", IndexID: 1 (t_pkey-)} + │ │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-), RecreateSourceIndexID: 0} + │ └── 10 Mutation operations + │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":1,"TableID":104} + │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} + │ ├── SetIndexName {"IndexID":3,"Name":"t_pkey","TableID":104} + │ ├── MakePublicColumnWriteOnly {"ColumnID":2,"TableID":104} + │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":104} │ ├── MakeDeleteOnlyColumnAbsent {"ColumnID":4,"TableID":104} + │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":3,"TableID":104} + │ ├── SetJobStateOnDescriptor {"DescriptorID":104} + │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} + ├── Stage 3 of 4 in PostCommitNonRevertiblePhase + │ ├── 5 elements transitioning toward ABSENT + │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104 (t), ColumnID: 2 (j-)} + │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 1 (i), IndexID: 1 (t_pkey-)} + │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 2 (j-), IndexID: 1 (t_pkey-)} + │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104 (t), ColumnID: 3 (k-), IndexID: 1 (t_pkey-)} + │ │ └── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} + │ └── 7 Mutation operations + │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":1,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":1,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":1,"Kind":2,"TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":1,"Kind":2,"Ordinal":1,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} - └── Stage 3 of 3 in PostCommitNonRevertiblePhase + └── Stage 4 of 4 in PostCommitNonRevertiblePhase ├── 1 element transitioning toward TRANSIENT_ABSENT │ └── PUBLIC → TRANSIENT_ABSENT IndexData:{DescID: 104 (t), IndexID: 4 (crdb_internal_index_4_name_placeholder)} ├── 9 elements transitioning toward ABSENT + │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104 (t), ColumnID: 2 (j-)} + │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104 (t), ColumnFamilyID: 0 (primary), ColumnID: 2 (j-)} │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104 (t), ColumnID: 3 (k-)} │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104 (t), ColumnFamilyID: 0 (primary), ColumnID: 3 (k-)} │ ├── PUBLIC → ABSENT ColumnDefaultExpression:{DescID: 104 (t), ColumnID: 3 (k-), Expr: 32:::INT8} │ ├── PUBLIC → ABSENT ColumnOnUpdateExpression:{DescID: 104 (t), ColumnID: 3 (k-)} - │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104 (t), ColumnID: 2 (j-)} - │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104 (t), ColumnFamilyID: 0 (primary), ColumnID: 2 (j-)} │ ├── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104 (t), IndexID: 1 (t_pkey-), ConstraintID: 1} │ ├── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 1 (t_pkey-)} │ └── PUBLIC → ABSENT IndexData:{DescID: 104 (t), IndexID: 2 (t_expr_k_idx-)} diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__statement_2_of_2.explain_shape b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__statement_2_of_2.explain_shape index df514cc3b7e7..d5776306b6b6 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__statement_2_of_2.explain_shape +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements/drop_multiple_columns_separate_statements__statement_2_of_2.explain_shape @@ -14,4 +14,4 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ └── from crdb_internal_index_4_name_placeholder into t_pkey+ ├── execute 1 system table mutations transaction ├── validate UNIQUE constraint backed by index t_pkey+ in relation t - └── execute 3 system table mutations transactions + └── execute 4 system table mutations transactions