diff --git a/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_1_of_7 b/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_1_of_7 index 37238dbd85c1..632fd6ae84b1 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_1_of_7 +++ b/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_1_of_7 @@ -22,13 +22,7 @@ Schema change plan for rolling back CREATE INDEX ‹id1› ON ‹defaultdb›.pu │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} │ └── PUBLIC → ABSENT IndexPartitioning:{DescID: 104, IndexID: 3} - └── 13 Mutation operations - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"Ordinal":1,"TableID":104} - ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":104} - ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"Ordinal":1,"TableID":104} - ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":2,"Kind":2,"TableID":104} + └── 7 Mutation operations ├── LogEvent {"TargetStatus":1} ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} ├── MakeIndexAbsent {"IndexID":2,"TableID":104} diff --git a/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_2_of_7 b/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_2_of_7 index 86ad782a81bf..149019011c38 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_2_of_7 +++ b/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_2_of_7 @@ -22,14 +22,8 @@ Schema change plan for rolling back CREATE INDEX ‹id1› ON ‹defaultdb›.pu │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexPartitioning:{DescID: 104, IndexID: 3} - │ └── 12 Mutation operations + │ └── 6 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"Ordinal":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"Ordinal":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":2,"Kind":2,"TableID":104} │ ├── LogEvent {"TargetStatus":1} │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} diff --git a/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_3_of_7 b/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_3_of_7 index 48e264957c54..28284da5d68e 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_3_of_7 +++ b/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_3_of_7 @@ -22,14 +22,8 @@ Schema change plan for rolling back CREATE INDEX ‹id1› ON ‹defaultdb›.pu │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexPartitioning:{DescID: 104, IndexID: 3} - │ └── 12 Mutation operations + │ └── 6 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"Ordinal":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"Ordinal":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":2,"Kind":2,"TableID":104} │ ├── LogEvent {"TargetStatus":1} │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} diff --git a/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_4_of_7 b/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_4_of_7 index 25ebc6bdab6f..309808a4d3e1 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_4_of_7 +++ b/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_4_of_7 @@ -22,14 +22,8 @@ Schema change plan for rolling back CREATE INDEX ‹id1› ON ‹defaultdb›.pu │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexPartitioning:{DescID: 104, IndexID: 3} - │ └── 12 Mutation operations - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"Ordinal":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":2,"Kind":2,"TableID":104} + │ └── 6 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"Ordinal":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} │ ├── LogEvent {"TargetStatus":1} │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} diff --git a/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_5_of_7 b/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_5_of_7 index 2c1b78455a76..28221e63ee10 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_5_of_7 +++ b/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_5_of_7 @@ -22,15 +22,9 @@ Schema change plan for rolling back CREATE INDEX ‹id1› ON ‹defaultdb›.pu │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexPartitioning:{DescID: 104, IndexID: 3} - │ └── 10 Mutation operations + │ └── 4 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"Ordinal":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"Ordinal":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":2,"Kind":2,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase diff --git a/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_6_of_7 b/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_6_of_7 index 02db20c03d68..d7cbc34c509e 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_6_of_7 +++ b/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_6_of_7 @@ -22,15 +22,9 @@ Schema change plan for rolling back CREATE INDEX ‹id1› ON ‹defaultdb›.pu │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexPartitioning:{DescID: 104, IndexID: 3} - │ └── 10 Mutation operations + │ └── 4 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"Ordinal":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"Ordinal":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":2,"Kind":2,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase diff --git a/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_7_of_7 b/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_7_of_7 index 22a1f729f673..cbf8450f56a7 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_7_of_7 +++ b/pkg/ccl/schemachangerccl/testdata/explain/create_index.rollback_7_of_7 @@ -22,15 +22,9 @@ Schema change plan for rolling back CREATE INDEX ‹id1› ON ‹defaultdb›.pu │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexPartitioning:{DescID: 104, IndexID: 3} - │ └── 10 Mutation operations + │ └── 4 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"Ordinal":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"Ordinal":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":2,"Kind":2,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase diff --git a/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index b/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index index 6783764029dd..701a66548ac8 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index +++ b/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index @@ -19,52 +19,52 @@ EXPLAIN (ddl, verbose) CREATE INDEX id1 │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" +│ │ │ rule: "index existence precedes index dependents" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" +│ │ │ rule: "index existence precedes index dependents" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" +│ │ │ rule: "index existence precedes index dependents" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ ABSENT → BACKFILL_ONLY │ │ │ │ │ ├── • IndexPartitioning:{DescID: 104, IndexID: 2} -│ │ │ ABSENT → PUBLIC +│ │ │ │ ABSENT → PUBLIC +│ │ │ │ +│ │ │ └── • Precedence dependency from BACKFILL_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} +│ │ │ rule: "index existence precedes index dependents" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 0, SourceIndexID: 1} -│ │ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ │ rule: "index-column added to index after temp index exists" +│ │ │ rule: "temp index existence precedes index dependents" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 0, SourceIndexID: 1} -│ │ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ │ rule: "index-column added to index after temp index exists" +│ │ │ rule: "temp index existence precedes index dependents" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 0, SourceIndexID: 1} -│ │ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ │ rule: "index-column added to index after temp index exists" +│ │ │ rule: "temp index existence precedes index dependents" │ │ │ │ │ └── • IndexPartitioning:{DescID: 104, IndexID: 3} │ │ │ ABSENT → PUBLIC │ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 0, SourceIndexID: 1} -│ │ rule: "temp index exists before columns, partitioning, and partial" +│ │ rule: "temp index existence precedes index dependents" │ │ │ ├── • 1 element transitioning toward TRANSIENT_ABSENT │ │ │ @@ -187,16 +187,7 @@ EXPLAIN (ddl, verbose) CREATE INDEX id1 │ │ ├── • 1 element transitioning toward TRANSIENT_ABSENT │ │ │ │ │ │ │ └── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 0, SourceIndexID: 1} -│ │ │ │ DELETE_ONLY → WRITE_ONLY -│ │ │ │ -│ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} -│ │ │ │ rule: "index-column added to index before temp index receives writes" -│ │ │ │ -│ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} -│ │ │ │ rule: "index-column added to index before temp index receives writes" -│ │ │ │ -│ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} -│ │ │ rule: "index-column added to index before temp index receives writes" +│ │ │ DELETE_ONLY → WRITE_ONLY │ │ │ │ │ └── • 3 Mutation operations │ │ │ @@ -333,14 +324,27 @@ EXPLAIN (ddl, verbose) CREATE INDEX id1 │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: id1, IndexID: 2} - │ │ │ rule: "index named right before index becomes public" + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: id1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ rule: "index named right before index becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexPartitioning:{DescID: 104, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: id1, IndexID: 2} │ │ │ ABSENT → PUBLIC │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "index existence precedes index name and comment" + │ │ rule: "index existence precedes index dependents" │ │ │ ├── • 1 element transitioning toward TRANSIENT_ABSENT │ │ │ diff --git a/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_1_of_7 b/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_1_of_7 index e88db0a0ba87..2844e535fb07 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_1_of_7 +++ b/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_1_of_7 @@ -19,34 +19,31 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} │ │ │ PUBLIC → ABSENT │ │ │ - │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} │ │ │ PUBLIC → ABSENT │ │ │ - │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} │ │ │ PUBLIC → ABSENT │ │ │ - │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ BACKFILL_ONLY → ABSENT │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: id1, IndexID: 2} @@ -74,52 +71,27 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ │ rule: "dependents removed before index" │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ └── • IndexPartitioning:{DescID: 104, IndexID: 3} │ PUBLIC → ABSENT │ - └── • 13 Mutation operations - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 1 - │ IndexID: 3 - │ TableID: 104 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 2 - │ IndexID: 3 - │ Ordinal: 1 - │ TableID: 104 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 3 - │ IndexID: 3 - │ Kind: 2 - │ TableID: 104 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 1 - │ IndexID: 2 - │ TableID: 104 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 2 - │ IndexID: 2 - │ Ordinal: 1 - │ TableID: 104 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 3 - │ IndexID: 2 - │ Kind: 2 - │ TableID: 104 + └── • 7 Mutation operations │ ├── • LogEvent │ Element: diff --git a/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_2_of_7 b/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_2_of_7 index f4936990fb13..bf1e5f398cbf 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_2_of_7 +++ b/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_2_of_7 @@ -19,34 +19,31 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ │ BACKFILL_ONLY → ABSENT │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: id1, IndexID: 2} @@ -62,57 +59,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexPartitioning:{DescID: 104, IndexID: 3} │ │ PUBLIC → ABSENT │ │ - │ └── • 12 Mutation operations + │ └── • 6 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ Ordinal: 1 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ Ordinal: 1 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • LogEvent │ │ Element: │ │ SecondaryIndex: diff --git a/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_3_of_7 b/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_3_of_7 index 8196b16a1fcb..acd0d09c0a35 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_3_of_7 +++ b/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_3_of_7 @@ -19,34 +19,31 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ │ BACKFILL_ONLY → ABSENT │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: id1, IndexID: 2} @@ -62,57 +59,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexPartitioning:{DescID: 104, IndexID: 3} │ │ PUBLIC → ABSENT │ │ - │ └── • 12 Mutation operations + │ └── • 6 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ Ordinal: 1 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ Ordinal: 1 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • LogEvent │ │ Element: │ │ SecondaryIndex: diff --git a/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_4_of_7 b/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_4_of_7 index 2d994bb7bcbc..b603debb4505 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_4_of_7 +++ b/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_4_of_7 @@ -19,34 +19,31 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ │ DELETE_ONLY → ABSENT │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: id1, IndexID: 2} @@ -62,57 +59,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexPartitioning:{DescID: 104, IndexID: 3} │ │ PUBLIC → ABSENT │ │ - │ └── • 12 Mutation operations - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ Ordinal: 1 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 104 + │ └── • 6 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ Ordinal: 1 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • LogEvent │ │ Element: │ │ SecondaryIndex: diff --git a/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_5_of_7 b/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_5_of_7 index fc6d120adda0..09293f3f4d99 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_5_of_7 +++ b/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_5_of_7 @@ -19,20 +19,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ MERGE_ONLY → DELETE_ONLY @@ -44,61 +44,36 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexPartitioning:{DescID: 104, IndexID: 3} │ │ PUBLIC → ABSENT │ │ - │ └── • 10 Mutation operations + │ └── • 4 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ Ordinal: 1 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ Ordinal: 1 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ @@ -115,15 +90,12 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ │ DELETE_ONLY → ABSENT │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: id1, IndexID: 2} diff --git a/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_6_of_7 b/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_6_of_7 index 7f7a7b39a201..36888496a5ee 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_6_of_7 +++ b/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_6_of_7 @@ -19,20 +19,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ MERGE_ONLY → DELETE_ONLY @@ -44,61 +44,36 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexPartitioning:{DescID: 104, IndexID: 3} │ │ PUBLIC → ABSENT │ │ - │ └── • 10 Mutation operations + │ └── • 4 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ Ordinal: 1 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ Ordinal: 1 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ @@ -115,15 +90,12 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ │ DELETE_ONLY → ABSENT │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: id1, IndexID: 2} diff --git a/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_7_of_7 b/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_7_of_7 index 0f82d4544241..b9b58944e79c 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_7_of_7 +++ b/pkg/ccl/schemachangerccl/testdata/explain_verbose/create_index.rollback_7_of_7 @@ -19,20 +19,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY @@ -44,18 +44,27 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexPartitioning:{DescID: 104, IndexID: 3} │ │ PUBLIC → ABSENT │ │ - │ └── • 10 Mutation operations + │ └── • 4 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 2 @@ -65,40 +74,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ Ordinal: 1 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ Ordinal: 1 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ @@ -115,15 +90,12 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ │ DELETE_ONLY → ABSENT │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: id1, IndexID: 2} diff --git a/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_database_multiregion_primary_region b/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_database_multiregion_primary_region index 47680cec306c..53bfdcd28f21 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_database_multiregion_primary_region +++ b/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_database_multiregion_primary_region @@ -463,7 +463,7 @@ EXPLAIN (ddl, verbose) DROP DATABASE multi_region_test_db CASCADE; │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 1} - │ │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip column dependents removal ops on relation drop" @@ -475,7 +475,7 @@ EXPLAIN (ddl, verbose) DROP DATABASE multi_region_test_db CASCADE; │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 1} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • Column:{DescID: 108, ColumnID: 4294967295} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -490,7 +490,7 @@ EXPLAIN (ddl, verbose) DROP DATABASE multi_region_test_db CASCADE; │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967295} - │ │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip column dependents removal ops on relation drop" @@ -502,7 +502,7 @@ EXPLAIN (ddl, verbose) DROP DATABASE multi_region_test_db CASCADE; │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967295} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • Column:{DescID: 108, ColumnID: 4294967294} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -517,7 +517,7 @@ EXPLAIN (ddl, verbose) DROP DATABASE multi_region_test_db CASCADE; │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967294} - │ │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip column dependents removal ops on relation drop" @@ -529,7 +529,7 @@ EXPLAIN (ddl, verbose) DROP DATABASE multi_region_test_db CASCADE; │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967294} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • IndexColumn:{DescID: 108, ColumnID: 1, IndexID: 1} │ │ │ │ PUBLIC → ABSENT @@ -537,11 +537,15 @@ EXPLAIN (ddl, verbose) DROP DATABASE multi_region_test_db CASCADE; │ │ │ ├── • SameStagePrecedence dependency from DROPPED Table:{DescID: 108} │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 1} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} - │ │ │ │ rule: "index no longer public before dependents removed" + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip index dependents removal ops on relation drop" + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} │ │ │ │ VALIDATED → DELETE_ONLY @@ -559,7 +563,7 @@ EXPLAIN (ddl, verbose) DROP DATABASE multi_region_test_db CASCADE; │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index dependents removal ops on relation drop" @@ -678,7 +682,10 @@ EXPLAIN (ddl, verbose) DROP DATABASE multi_region_test_db CASCADE; │ │ ├── • Precedence dependency from ABSENT ColumnName:{DescID: 108, Name: a, ColumnID: 1} │ │ │ rule: "dependents removed before column" │ │ │ - │ │ └── • Precedence dependency from ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 1} + │ │ ├── • Precedence dependency from ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 1} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 108, ColumnID: 1, IndexID: 1} │ │ rule: "dependents removed before column" │ │ │ ├── • Column:{DescID: 108, ColumnID: 4294967295} diff --git a/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_table_multiregion b/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_table_multiregion index 90d1c77bbe08..bb3167762916 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_table_multiregion +++ b/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_table_multiregion @@ -163,7 +163,7 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 1} - │ │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip column dependents removal ops on relation drop" @@ -175,7 +175,7 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 1} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • Column:{DescID: 108, ColumnID: 2} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -190,7 +190,7 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 2} - │ │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip column dependents removal ops on relation drop" @@ -202,7 +202,7 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 2} - │ │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from ABSENT ColumnDefaultExpression:{DescID: 108, ColumnID: 2} │ │ │ rule: "column type dependents removed right before column type" @@ -210,8 +210,11 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ ├── • ColumnDefaultExpression:{DescID: 108, ColumnID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from DROPPED Table:{DescID: 108} - │ │ │ rule: "descriptor drop right before dependent element removal" + │ │ │ ├── • SameStagePrecedence dependency from DROPPED Table:{DescID: 108} + │ │ │ │ rule: "descriptor drop right before dependent element removal" + │ │ │ │ + │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 2} + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • Column:{DescID: 108, ColumnID: 4294967295} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -226,7 +229,7 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967295} - │ │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip column dependents removal ops on relation drop" @@ -238,7 +241,7 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967295} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • Column:{DescID: 108, ColumnID: 4294967294} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -253,7 +256,7 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967294} - │ │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip column dependents removal ops on relation drop" @@ -265,7 +268,7 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967294} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • IndexColumn:{DescID: 108, ColumnID: 2, IndexID: 1} │ │ │ │ PUBLIC → ABSENT @@ -273,11 +276,15 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ ├── • SameStagePrecedence dependency from DROPPED Table:{DescID: 108} │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 2} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} - │ │ │ │ rule: "index no longer public before dependents removed" + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip index dependents removal ops on relation drop" + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 108, ColumnID: 1, IndexID: 1} │ │ │ │ PUBLIC → ABSENT @@ -285,11 +292,15 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ ├── • SameStagePrecedence dependency from DROPPED Table:{DescID: 108} │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 1} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} - │ │ │ │ rule: "index no longer public before dependents removed" + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip index dependents removal ops on relation drop" + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} │ │ │ │ VALIDATED → DELETE_ONLY @@ -307,7 +318,7 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} - │ │ │ │ rule: "index no longer public before dependents removed" + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip index dependents removal ops on relation drop" @@ -319,7 +330,7 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index dependents removal ops on relation drop" @@ -389,7 +400,10 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ ├── • Precedence dependency from ABSENT ColumnName:{DescID: 108, Name: k, ColumnID: 1} │ │ │ rule: "dependents removed before column" │ │ │ - │ │ └── • Precedence dependency from ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 1} + │ │ ├── • Precedence dependency from ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 1} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 108, ColumnID: 1, IndexID: 1} │ │ rule: "dependents removed before column" │ │ │ ├── • Column:{DescID: 108, ColumnID: 2} @@ -401,7 +415,13 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ ├── • Precedence dependency from ABSENT ColumnName:{DescID: 108, Name: crdb_region, ColumnID: 2} │ │ │ rule: "dependents removed before column" │ │ │ - │ │ └── • Precedence dependency from ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 2} + │ │ ├── • Precedence dependency from ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT ColumnDefaultExpression:{DescID: 108, ColumnID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 108, ColumnID: 2, IndexID: 1} │ │ rule: "dependents removed before column" │ │ │ ├── • Column:{DescID: 108, ColumnID: 4294967295} diff --git a/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_table_multiregion_primary_region b/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_table_multiregion_primary_region index fcb16bde64d8..b4fb0300d297 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_table_multiregion_primary_region +++ b/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_table_multiregion_primary_region @@ -153,7 +153,7 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 1} - │ │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip column dependents removal ops on relation drop" @@ -165,7 +165,7 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 1} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • Column:{DescID: 108, ColumnID: 4294967295} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -180,7 +180,7 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967295} - │ │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip column dependents removal ops on relation drop" @@ -192,7 +192,7 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967295} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • Column:{DescID: 108, ColumnID: 4294967294} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -207,7 +207,7 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967294} - │ │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip column dependents removal ops on relation drop" @@ -219,7 +219,7 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967294} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • IndexColumn:{DescID: 108, ColumnID: 1, IndexID: 1} │ │ │ │ PUBLIC → ABSENT @@ -227,11 +227,15 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ ├── • SameStagePrecedence dependency from DROPPED Table:{DescID: 108} │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 108, ColumnID: 1} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} - │ │ │ │ rule: "index no longer public before dependents removed" + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip index dependents removal ops on relation drop" + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} │ │ │ │ VALIDATED → DELETE_ONLY @@ -249,7 +253,7 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index dependents removal ops on relation drop" @@ -301,7 +305,10 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ ├── • Precedence dependency from ABSENT ColumnName:{DescID: 108, Name: a, ColumnID: 1} │ │ │ rule: "dependents removed before column" │ │ │ - │ │ └── • Precedence dependency from ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 1} + │ │ ├── • Precedence dependency from ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 1} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 108, ColumnID: 1, IndexID: 1} │ │ rule: "dependents removed before column" │ │ │ ├── • Column:{DescID: 108, ColumnID: 4294967295} diff --git a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table_add_column.go b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table_add_column.go index 7122beabc0f2..266ef796f228 100644 --- a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table_add_column.go +++ b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table_add_column.go @@ -359,7 +359,7 @@ func addColumn(b BuildCtx, spec addColumnSpec, n tree.NodeFormatter) (backing *s out.apply(b.Drop) in, temp := makeSwapPrimaryIndexSpec(b, out, inColumns) in.apply(b.Add) - temp.setTargets(b) + temp.apply(b.AddTransient) return in.idx } diff --git a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table_alter_primary_key.go b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table_alter_primary_key.go index 0073a3b50add..f71ae3631dd7 100644 --- a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table_alter_primary_key.go +++ b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table_alter_primary_key.go @@ -106,7 +106,7 @@ func alterTableAlterPrimaryKey( in, tempIn := makeSwapPrimaryIndexSpec(b, out, inColumns) in.idx.Sharding = sharding in.apply(b.Add) - tempIn.setTargets(b) + tempIn.apply(b.AddTransient) newPrimaryIndexElem = in.idx // Construct and add elements for a unique secondary index created on diff --git a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table_drop_column.go b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table_drop_column.go index e74ca9f77f6e..1fd1d3179114 100644 --- a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table_drop_column.go +++ b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table_drop_column.go @@ -379,7 +379,7 @@ func handleDropColumnCreateNewPrimaryIndex( in, temp := makeSwapPrimaryIndexSpec(b, out, inColumns) out.apply(b.Drop) in.apply(b.Add) - temp.setTargets(b) + temp.apply(b.AddTransient) return in.idx } @@ -401,9 +401,12 @@ func handleDropColumnFreshlyAddedPrimaryIndex( if tempIndex == nil { panic(errors.AssertionFailedf("failed to find temp index %d", freshlyAdded.TemporaryIndexID)) } - scpb.ForEachIndexColumn(b.QueryByID(freshlyAdded.TableID).Filter(publicTargetFilter), func( - _ scpb.Status, _ scpb.TargetStatus, e *scpb.IndexColumn, + scpb.ForEachIndexColumn(b.QueryByID(freshlyAdded.TableID), func( + _ scpb.Status, targetStatus scpb.TargetStatus, e *scpb.IndexColumn, ) { + if targetStatus == scpb.ToAbsent { + return + } if e.Kind != scpb.IndexColumn_STORED { return } diff --git a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/helpers.go b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/helpers.go index 93c787fccc9d..ac04c9e4db45 100644 --- a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/helpers.go +++ b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/helpers.go @@ -326,6 +326,10 @@ func absentTargetFilter(_ scpb.Status, target scpb.TargetStatus, _ scpb.Element) return target == scpb.ToAbsent } +func notAbsentTargetFilter(_ scpb.Status, target scpb.TargetStatus, _ scpb.Element) bool { + return target != scpb.ToAbsent +} + func statusAbsentOrBackfillOnlyFilter( status scpb.Status, _ scpb.TargetStatus, _ scpb.Element, ) bool { @@ -462,15 +466,15 @@ type tempIndexSpec struct { columns []*scpb.IndexColumn } -// setTargets makes it possible to conveniently set adding or transient build -// targets for all the elements in the tempIndexSpec. -func (s tempIndexSpec) setTargets(b BuildCtx) { - b.AddTransient(s.idx) +// apply makes it possible to conveniently define build targets for all +// the elements in the tempIndexSpec. +func (s tempIndexSpec) apply(fn func(e scpb.Element)) { + fn(s.idx) if s.partitioning != nil { - b.Add(s.partitioning) + fn(s.partitioning) } for _, ic := range s.columns { - b.Add(ic) + fn(ic) } } @@ -497,7 +501,7 @@ func makeSwapPrimaryIndexSpec( var inID, tempID catid.IndexID var inConstraintID, tempConstraintID catid.ConstraintID { - _, _, tbl := scpb.FindTable(b.QueryByID(out.idx.TableID).Filter(publicTargetFilter)) + _, _, tbl := scpb.FindTable(b.QueryByID(out.idx.TableID).Filter(notAbsentTargetFilter)) inID = b.NextTableIndexID(tbl) inConstraintID = b.NextTableConstraintID(tbl.TableID) tempID = inID + 1 diff --git a/pkg/sql/schemachanger/scbuild/testdata/alter_table_add_column b/pkg/sql/schemachanger/scbuild/testdata/alter_table_add_column index 372736754358..aeee5d1d00bf 100644 --- a/pkg/sql/schemachanger/scbuild/testdata/alter_table_add_column +++ b/pkg/sql/schemachanger/scbuild/testdata/alter_table_add_column @@ -41,9 +41,9 @@ ALTER TABLE defaultdb.foo ADD COLUMN j INT NOT NULL DEFAULT 123 {columnId: 2, indexId: 2, kind: STORED, tableId: 104} - [[TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], ABSENT] {constraintId: 3, indexId: 3, isUnique: true, sourceIndexId: 1, tableId: 104} -- [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, PUBLIC], ABSENT] +- [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] {columnId: 1, indexId: 3, tableId: 104} -- [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, PUBLIC], ABSENT] +- [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] {columnId: 2, indexId: 3, kind: STORED, tableId: 104} build @@ -74,9 +74,9 @@ ALTER TABLE defaultdb.foo ADD COLUMN k INT DEFAULT 456; {columnId: 2, indexId: 2, kind: STORED, tableId: 104} - [[TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], ABSENT] {constraintId: 3, indexId: 3, isUnique: true, sourceIndexId: 1, tableId: 104} -- [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, PUBLIC], ABSENT] +- [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] {columnId: 1, indexId: 3, tableId: 104} -- [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, PUBLIC], ABSENT] +- [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] {columnId: 2, indexId: 3, kind: STORED, tableId: 104} - [[Column:{DescID: 104, ColumnID: 3}, PUBLIC], ABSENT] {columnId: 3, pgAttributeNum: 3, tableId: 104} @@ -116,9 +116,9 @@ ALTER TABLE defaultdb.foo ADD COLUMN a INT AS (i+1) STORED {columnId: 2, indexId: 2, kind: STORED, tableId: 104} - [[TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], ABSENT] {constraintId: 3, indexId: 3, isUnique: true, sourceIndexId: 1, tableId: 104} -- [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, PUBLIC], ABSENT] +- [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] {columnId: 1, indexId: 3, tableId: 104} -- [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, PUBLIC], ABSENT] +- [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] {columnId: 2, indexId: 3, kind: STORED, tableId: 104} setup @@ -171,9 +171,9 @@ ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (j) {columnId: 1, indexId: 2, kind: STORED, tableId: 106} - [[TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], ABSENT] {constraintId: 3, indexId: 3, isUnique: true, sourceIndexId: 1, tableId: 106} -- [[IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3}, PUBLIC], ABSENT] +- [[IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] {columnId: 2, indexId: 3, tableId: 106} -- [[IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3}, PUBLIC], ABSENT] +- [[IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] {columnId: 1, indexId: 3, kind: STORED, tableId: 106} - [[SecondaryIndex:{DescID: 106, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1}, PUBLIC], ABSENT] {constraintId: 4, indexId: 4, isUnique: true, sourceIndexId: 1, tableId: 106, temporaryIndexId: 5} diff --git a/pkg/sql/schemachanger/scbuild/testdata/alter_table_alter_primary_key b/pkg/sql/schemachanger/scbuild/testdata/alter_table_alter_primary_key index 9ae31ca844b0..fa55fdbaebf5 100644 --- a/pkg/sql/schemachanger/scbuild/testdata/alter_table_alter_primary_key +++ b/pkg/sql/schemachanger/scbuild/testdata/alter_table_alter_primary_key @@ -24,9 +24,9 @@ ALTER TABLE defaultdb.foo ALTER PRIMARY KEY USING COLUMNS (j) {columnId: 1, indexId: 2, kind: STORED, tableId: 104} - [[TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], ABSENT] {constraintId: 3, indexId: 3, isUnique: true, sourceIndexId: 1, tableId: 104} -- [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, PUBLIC], ABSENT] +- [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] {columnId: 2, indexId: 3, tableId: 104} -- [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, PUBLIC], ABSENT] +- [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] {columnId: 1, indexId: 3, kind: STORED, tableId: 104} - [[SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1}, PUBLIC], ABSENT] {constraintId: 4, indexId: 4, isUnique: true, sourceIndexId: 1, tableId: 104, temporaryIndexId: 5} @@ -64,9 +64,9 @@ ALTER TABLE defaultdb.bar ALTER PRIMARY KEY USING COLUMNS (i) {columnId: 2, indexId: 2, kind: STORED, tableId: 105} - [[TemporaryIndex:{DescID: 105, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], ABSENT] {constraintId: 3, indexId: 3, isUnique: true, sourceIndexId: 1, tableId: 105} -- [[IndexColumn:{DescID: 105, ColumnID: 1, IndexID: 3}, PUBLIC], ABSENT] +- [[IndexColumn:{DescID: 105, ColumnID: 1, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] {columnId: 1, indexId: 3, tableId: 105} -- [[IndexColumn:{DescID: 105, ColumnID: 2, IndexID: 3}, PUBLIC], ABSENT] +- [[IndexColumn:{DescID: 105, ColumnID: 2, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] {columnId: 2, indexId: 3, kind: STORED, tableId: 105} - [[SecondaryIndex:{DescID: 105, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1}, PUBLIC], ABSENT] {constraintId: 4, indexId: 4, isUnique: true, sourceIndexId: 1, tableId: 105, temporaryIndexId: 5} diff --git a/pkg/sql/schemachanger/scbuild/testdata/alter_table_drop_column b/pkg/sql/schemachanger/scbuild/testdata/alter_table_drop_column index 641c5271a4da..b1546fbb792c 100644 --- a/pkg/sql/schemachanger/scbuild/testdata/alter_table_drop_column +++ b/pkg/sql/schemachanger/scbuild/testdata/alter_table_drop_column @@ -63,11 +63,11 @@ ALTER TABLE defaultdb.t DROP COLUMN j {columnId: 4, indexId: 4, kind: STORED, ordinalInKind: 1, tableId: 104} - [[TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], ABSENT] {constraintId: 3, indexId: 5, isUnique: true, sourceIndexId: 1, tableId: 104} -- [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5}, PUBLIC], ABSENT] +- [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5}, TRANSIENT_ABSENT], ABSENT] {columnId: 1, indexId: 5, tableId: 104} -- [[IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 5}, PUBLIC], ABSENT] +- [[IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 5}, TRANSIENT_ABSENT], ABSENT] {columnId: 3, indexId: 5, kind: STORED, tableId: 104} -- [[IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 5}, PUBLIC], ABSENT] +- [[IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 5}, TRANSIENT_ABSENT], ABSENT] {columnId: 4, indexId: 5, kind: STORED, ordinalInKind: 1, tableId: 104} build @@ -113,11 +113,11 @@ ALTER TABLE defaultdb.t DROP COLUMN k {columnId: 4, indexId: 4, kind: STORED, ordinalInKind: 1, tableId: 104} - [[TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], ABSENT] {constraintId: 3, indexId: 5, isUnique: true, sourceIndexId: 1, tableId: 104} -- [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5}, PUBLIC], ABSENT] +- [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5}, TRANSIENT_ABSENT], ABSENT] {columnId: 1, indexId: 5, tableId: 104} -- [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5}, PUBLIC], ABSENT] +- [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5}, TRANSIENT_ABSENT], ABSENT] {columnId: 2, indexId: 5, kind: STORED, tableId: 104} -- [[IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 5}, PUBLIC], ABSENT] +- [[IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 5}, TRANSIENT_ABSENT], ABSENT] {columnId: 4, indexId: 5, kind: STORED, ordinalInKind: 1, tableId: 104} build @@ -169,9 +169,9 @@ ALTER TABLE defaultdb.t DROP COLUMN l {columnId: 3, indexId: 4, kind: STORED, ordinalInKind: 1, tableId: 104} - [[TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], ABSENT] {constraintId: 3, indexId: 5, isUnique: true, sourceIndexId: 1, tableId: 104} -- [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5}, PUBLIC], ABSENT] +- [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5}, TRANSIENT_ABSENT], ABSENT] {columnId: 1, indexId: 5, tableId: 104} -- [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5}, PUBLIC], ABSENT] +- [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5}, TRANSIENT_ABSENT], ABSENT] {columnId: 2, indexId: 5, kind: STORED, tableId: 104} -- [[IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 5}, PUBLIC], ABSENT] +- [[IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 5}, TRANSIENT_ABSENT], ABSENT] {columnId: 3, indexId: 5, kind: STORED, ordinalInKind: 1, tableId: 104} diff --git a/pkg/sql/schemachanger/scexec/executor_external_test.go b/pkg/sql/schemachanger/scexec/executor_external_test.go index b1745d30ff37..10d8475d5388 100644 --- a/pkg/sql/schemachanger/scexec/executor_external_test.go +++ b/pkg/sql/schemachanger/scexec/executor_external_test.go @@ -285,21 +285,10 @@ func TestSchemaChanger(t *testing.T) { targets := []scpb.Target{ scpb.MakeTarget( scpb.ToPublic, - &scpb.IndexColumn{ - TableID: fooTable.GetID(), - IndexID: 1, - ColumnID: 2, - OrdinalInKind: 0, - Kind: scpb.IndexColumn_STORED, - }, - metadata, - ), - scpb.MakeTarget( - scpb.ToPublic, - &scpb.ColumnName{ - TableID: fooTable.GetID(), - ColumnID: 2, - Name: "j", + &scpb.Column{ + TableID: fooTable.GetID(), + ColumnID: 2, + PgAttributeNum: 2, }, metadata, ), @@ -315,10 +304,21 @@ func TestSchemaChanger(t *testing.T) { ), scpb.MakeTarget( scpb.ToPublic, - &scpb.Column{ - TableID: fooTable.GetID(), - ColumnID: 2, - PgAttributeNum: 2, + &scpb.ColumnName{ + TableID: fooTable.GetID(), + ColumnID: 2, + Name: "j", + }, + metadata, + ), + scpb.MakeTarget( + scpb.ToPublic, + &scpb.IndexColumn{ + TableID: fooTable.GetID(), + IndexID: 1, + ColumnID: 2, + OrdinalInKind: 0, + Kind: scpb.IndexColumn_STORED, }, metadata, ), diff --git a/pkg/sql/schemachanger/scexec/scmutationexec/index.go b/pkg/sql/schemachanger/scexec/scmutationexec/index.go index 11d023f32f25..4167c53dd13f 100644 --- a/pkg/sql/schemachanger/scexec/scmutationexec/index.go +++ b/pkg/sql/schemachanger/scexec/scmutationexec/index.go @@ -424,12 +424,6 @@ func (m *visitor) RemoveColumnFromIndex(ctx context.Context, op scop.RemoveColum if err != nil { return err } - // As a special case, avoid removing any columns from dropped indexes. - // The index is going to be removed, so it doesn't matter if it references - // dropped columns. - if index.Dropped() { - return nil - } column, err := tbl.FindColumnWithID(op.ColumnID) if err != nil { return err diff --git a/pkg/sql/schemachanger/scpb/scpb.proto b/pkg/sql/schemachanger/scpb/scpb.proto index c2db7a4df5f2..50a369c6da7d 100644 --- a/pkg/sql/schemachanger/scpb/scpb.proto +++ b/pkg/sql/schemachanger/scpb/scpb.proto @@ -53,6 +53,12 @@ enum Status { // Intermediate states on the transient index dropping path TRANSIENT_DELETE_ONLY = 13; TRANSIENT_WRITE_ONLY = 14; + TRANSIENT_BACKFILL_ONLY = 16; + TRANSIENT_BACKFILLED = 17; + TRANSIENT_MERGE_ONLY = 18; + TRANSIENT_MERGED = 19; + TRANSIENT_VALIDATED = 20; + TRANSIENT_PUBLIC = 21; } // TargetMetadata refers to the metadata for individual elements, where diff --git a/pkg/sql/schemachanger/scpb/transient.go b/pkg/sql/schemachanger/scpb/transient.go index f47fda482a66..a5104266813d 100644 --- a/pkg/sql/schemachanger/scpb/transient.go +++ b/pkg/sql/schemachanger/scpb/transient.go @@ -19,7 +19,13 @@ func GetTransientEquivalent(s Status) (Status, bool) { } var transientEquivalent = map[Status]Status{ - Status_DELETE_ONLY: Status_TRANSIENT_DELETE_ONLY, - Status_WRITE_ONLY: Status_TRANSIENT_WRITE_ONLY, - Status_ABSENT: Status_TRANSIENT_ABSENT, + Status_DELETE_ONLY: Status_TRANSIENT_DELETE_ONLY, + Status_WRITE_ONLY: Status_TRANSIENT_WRITE_ONLY, + Status_ABSENT: Status_TRANSIENT_ABSENT, + Status_PUBLIC: Status_TRANSIENT_PUBLIC, + Status_BACKFILL_ONLY: Status_TRANSIENT_BACKFILL_ONLY, + Status_BACKFILLED: Status_TRANSIENT_BACKFILLED, + Status_MERGE_ONLY: Status_TRANSIENT_MERGE_ONLY, + Status_MERGED: Status_TRANSIENT_MERGED, + Status_VALIDATED: Status_TRANSIENT_VALIDATED, } diff --git a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_index_column.go b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_index_column.go index 0ae827350eaf..286ad6525726 100644 --- a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_index_column.go +++ b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_index_column.go @@ -30,6 +30,7 @@ func init() { } })), ), + toTransientAbsentLikePublic(), toAbsent( scpb.Status_PUBLIC, to(scpb.Status_ABSENT, diff --git a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_index_name.go b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_index_name.go index 01326f3c95af..fcb5496f50f5 100644 --- a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_index_name.go +++ b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_index_name.go @@ -31,6 +31,7 @@ func init() { }), ), ), + toTransientAbsentLikePublic(), toAbsent( scpb.Status_PUBLIC, to(scpb.Status_ABSENT, diff --git a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_index_partitioning.go b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_index_partitioning.go index bea597fbe76b..8b2439f5b228 100644 --- a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_index_partitioning.go +++ b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_index_partitioning.go @@ -38,6 +38,7 @@ func init() { }), ), ), + toTransientAbsentLikePublic(), toAbsent( scpb.Status_PUBLIC, to(scpb.Status_ABSENT), diff --git a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_primary_index.go b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_primary_index.go index 7cb9cd39cbf9..855d506c6d19 100644 --- a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_primary_index.go +++ b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_primary_index.go @@ -93,6 +93,7 @@ func init() { }), ), ), + toTransientAbsentLikePublic(), toAbsent( scpb.Status_PUBLIC, to(scpb.Status_VALIDATED, diff --git a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_secondary_index_partial.go b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_secondary_index_partial.go index 4435993cfae2..097d86deb3c1 100644 --- a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_secondary_index_partial.go +++ b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_secondary_index_partial.go @@ -38,6 +38,7 @@ func init() { }), ), ), + toTransientAbsentLikePublic(), toAbsent( scpb.Status_PUBLIC, to(scpb.Status_ABSENT, diff --git a/pkg/sql/schemachanger/scplan/internal/opgen/register.go b/pkg/sql/schemachanger/scplan/internal/opgen/register.go index 57785754d734..e86909da2b30 100644 --- a/pkg/sql/schemachanger/scplan/internal/opgen/register.go +++ b/pkg/sql/schemachanger/scplan/internal/opgen/register.go @@ -41,6 +41,10 @@ func toTransientAbsent(initalStatus scpb.Status, specs ...transitionSpec) target return asTargetSpec(scpb.Status_TRANSIENT_ABSENT, initalStatus, specs...) } +func toTransientAbsentLikePublic() targetSpec { + return asTargetSpec(scpb.Status_TRANSIENT_ABSENT, scpb.Status_ABSENT) +} + func asTargetSpec(to, from scpb.Status, specs ...transitionSpec) targetSpec { return targetSpec{from: from, to: to, transitionSpecs: specs} } @@ -53,22 +57,63 @@ func (r *registry) register(e scpb.Element, targetSpecs ...targetSpec) { panic(errors.NewAssertionErrorWithWrappedErrf(err, "element %T", e)) } } - - onErrPanic(expandTransientAbsentSpec(targetSpecs)) - targets, err := buildTargets(e, targetSpecs) + fullTargetSpecs, err := populateAndValidateSpecs(targetSpecs) + onErrPanic(err) + targets, err := buildTargets(e, fullTargetSpecs) onErrPanic(err) onErrPanic(validateTargets(targets)) r.targets = append(r.targets, targets...) } -// Expand the definition of the TRANSIENT_ABSENT targetSpec according to -// the transitions in the ABSENT targetSpec if they exist. -func expandTransientAbsentSpec(targetSpecs []targetSpec) error { - toAbsent, transient, err := findToAbsentAndTransient(targetSpecs) - if err != nil || transient == nil { - return err +func populateAndValidateSpecs(targetSpecs []targetSpec) ([]targetSpec, error) { + var absentSpec, publicSpec, transientSpec *targetSpec + for i := range targetSpecs { + s := &targetSpecs[i] + var p **targetSpec + switch s.to { + case scpb.Status_ABSENT: + p = &absentSpec + case scpb.Status_PUBLIC: + p = &publicSpec + case scpb.Status_TRANSIENT_ABSENT: + p = &transientSpec + default: + return nil, errors.Errorf("unsupported target %s", s.to) + } + if *p != nil { + return nil, errors.Errorf("duplicate %s spec", s.to) + } + if s.to != scpb.Status_ABSENT && s.from != scpb.Status_ABSENT { + return nil, errors.Errorf("expected %s spec to start in ABSENT, not %s", s.to, s.from) + } + *p = s + } + if absentSpec == nil { + return nil, errors.Errorf("ABSENT spec is missing but required") + } + if transientSpec != nil { + if publicSpec != nil && len(transientSpec.transitionSpecs) == 0 { + // Here we want the transient spec to be a copy of the public spec. + transientSpec.transitionSpecs = append(transientSpec.transitionSpecs, publicSpec.transitionSpecs...) + } + if err := populateTransientAbsent(absentSpec, transientSpec); err != nil { + return nil, err + } + } + specs := make([]targetSpec, 1, 3) + specs[0] = *absentSpec + if publicSpec != nil { + specs = append(specs, *publicSpec) + } + if transientSpec != nil { + specs = append(specs, *transientSpec) + } + for _, s := range specs { + if len(s.transitionSpecs) == 0 { + return nil, errors.Errorf("no transition specs found for %s spec", s.to) + } } - return populateTransientAbsent(toAbsent, transient) + return specs, nil } // populateTransientAbsent takes the targetSpecs to ABSENT and TRANSIENT_ABSENT @@ -78,14 +123,14 @@ func expandTransientAbsentSpec(targetSpecs []targetSpec) error { // with the status of the latter sequence containing the TRANSIENT_ prefix. // // Note that this function directly mutates the passed targetSpecs. -func populateTransientAbsent(toAbsent, transient *targetSpec) error { +func populateTransientAbsent(absentSpec, transientSpec *targetSpec) error { // Begin by finding the position in the ABSENT transition specs which match // the end of the existing TRANSIENT_ABSENT spec. - tts := transient.transitionSpecs - ats := toAbsent.transitionSpecs + ats := absentSpec.transitionSpecs + tts := transientSpec.transitionSpecs var startIdx int - if initial := tts[len(tts)-1].to; toAbsent.from != initial { + if initial := tts[len(tts)-1].to; absentSpec.from != initial { startIdx = findTransitionTo(ats, initial) + 1 if startIdx == 0 { return errors.AssertionFailedf( @@ -105,70 +150,33 @@ func populateTransientAbsent(toAbsent, transient *targetSpec) error { for i := startIdx; i < len(ats); i++ { next := ats[i] atsWithEquiv = append(atsWithEquiv, next) - - // NOTE: If the toAbsent transitions have any equiv definitions - // we'll fail to find them because we won't find a transient equivalent. - // For now, this is fine, but we may later need to decide to skip them or - // add them in some other way. - nextTo, ok := scpb.GetTransientEquivalent(next.to) - if !ok { - return errors.AssertionFailedf( - "failed to find transient equivalent for %v", next.to, - ) + if next.to == scpb.Status_UNKNOWN { + nextFrom, ok := scpb.GetTransientEquivalent(next.from) + if !ok { + return errors.AssertionFailedf( + "failed to find transient equivalent for 'from' %s", next.from, + ) + } + next.from = nextFrom + atsWithEquiv = append(atsWithEquiv, equiv(next.from)) + } else { + nextTo, ok := scpb.GetTransientEquivalent(next.to) + if !ok { + return errors.AssertionFailedf( + "failed to find transient equivalent for 'to' %s", next.to, + ) + } + next.to = nextTo + atsWithEquiv = append(atsWithEquiv, equiv(next.to)) } - next.to = nextTo tts = append(tts, next) - atsWithEquiv = append(atsWithEquiv, equiv(next.to)) } - transient.transitionSpecs = tts - toAbsent.transitionSpecs = atsWithEquiv + transientSpec.transitionSpecs = tts + absentSpec.transitionSpecs = atsWithEquiv return nil } -// findToAbsentAndTransient searches the slice of targetSpec for the two -// targets to ABSENT and TRANSIENT_ABSENT. An error is returned if either -// such target is defined more than once of if TRANSIENT_ABSENT is defined -// but ABSENT is not. If TRANSIENT_ABSENT is not defined, neither targetSpec -// will be returned; it is not an error for just ABSENT to be defined or -// for neither to be defined. -func findToAbsentAndTransient(specs []targetSpec) (toAbsent, transient *targetSpec, err error) { - findTargetSpec := func(to scpb.Status) (*targetSpec, error) { - i := findTargetSpecTo(specs, to) - if i == -1 { - return nil, nil - } - if also := findTargetSpecTo(specs[i+1:], to); also != -1 { - return nil, errors.Errorf("duplicate spec to %v", to) - } - return &specs[i], nil - } - if transient, err = findTargetSpec( - scpb.Status_TRANSIENT_ABSENT, - ); err != nil || transient == nil { - return nil, nil, err - } - if toAbsent, err = findTargetSpec(scpb.Status_ABSENT); err != nil { - return nil, nil, err - } - if toAbsent == nil { - return nil, nil, errors.AssertionFailedf( - "cannot have %v target without a %v target", - scpb.Status_TRANSIENT_ABSENT, scpb.Status_ABSENT, - ) - } - return toAbsent, transient, nil -} - -func findTargetSpecTo(haystack []targetSpec, needle scpb.Status) int { - for i, spec := range haystack { - if spec.to == needle { - return i - } - } - return -1 -} - func findTransitionTo(haystack []transitionSpec, needle scpb.Status) int { for i, transition := range haystack { if transition.from == needle { @@ -191,25 +199,29 @@ func buildTargets(e scpb.Element, targetSpecs []targetSpec) ([]target, error) { func validateTargets(targets []target) error { allStatuses := map[scpb.Status]bool{} - targetStatuses := make([]map[scpb.Status]bool, len(targets)) + absentStatuses := map[scpb.Status]bool{} + nonAbsentStatuses := map[scpb.Status]bool{} for i, tgt := range targets { - m := map[scpb.Status]bool{} + var m map[scpb.Status]bool + if i == 0 { + m = absentStatuses + } else { + m = nonAbsentStatuses + } for _, t := range tgt.transitions { m[t.from] = true allStatuses[t.from] = true m[t.to] = true allStatuses[t.to] = true } - targetStatuses[i] = m } - for i, tgt := range targets { - m := targetStatuses[i] - for s := range allStatuses { - if !m[s] { - return errors.Errorf("target %s: status %s is missing here but is featured in other targets", - tgt.status.String(), s.String()) - } + for s := range allStatuses { + if !absentStatuses[s] { + return errors.Errorf("status %s is featured in non-ABSENT targets but not in the ABSENT target", s) + } + if !nonAbsentStatuses[s] { + return errors.Errorf("status %s is featured in ABSENT target but not in any non-ABSENT targets", s) } } return nil diff --git a/pkg/sql/schemachanger/scplan/internal/rules/BUILD.bazel b/pkg/sql/schemachanger/scplan/internal/rules/BUILD.bazel index ba3c99c60b40..99eb03874764 100644 --- a/pkg/sql/schemachanger/scplan/internal/rules/BUILD.bazel +++ b/pkg/sql/schemachanger/scplan/internal/rules/BUILD.bazel @@ -4,12 +4,17 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "rules", srcs = [ - "dep_column.go", - "dep_drop.go", - "dep_index.go", - "dep_index_and_column.go", + "dep_add_column.go", + "dep_add_index.go", + "dep_add_index_and_column.go", + "dep_drop_column.go", + "dep_drop_index.go", + "dep_drop_index_and_column.go", + "dep_drop_object.go", + "dep_swap_index.go", "helpers.go", "op_drop.go", + "op_index_and_column.go", "registry.go", ], importpath = "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scplan/internal/rules", diff --git a/pkg/sql/schemachanger/scplan/internal/rules/dep_add_column.go b/pkg/sql/schemachanger/scplan/internal/rules/dep_add_column.go new file mode 100644 index 000000000000..a24cdc5f12a7 --- /dev/null +++ b/pkg/sql/schemachanger/scplan/internal/rules/dep_add_column.go @@ -0,0 +1,110 @@ +// Copyright 2022 The Cockroach Authors. +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package rules + +import ( + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/rel" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scpb" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scplan/internal/scgraph" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/screl" +) + +// These rules ensure that column-dependent elements, like a column's name, its +// DEFAULT expression, etc. appear once the column reaches a suitable state. +func init() { + + registerDepRule( + "column existence precedes column dependents", + scgraph.Precedence, + "column", "dependent", + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.Type((*scpb.Column)(nil)), + to.typeFilter(isColumnDependent), + joinOnColumnID(from, to, "table-id", "col-id"), + statusesToPublicOrTransient(from, scpb.Status_DELETE_ONLY, to, scpb.Status_PUBLIC), + } + }, + ) + + registerDepRule( + "column dependents exist before column becomes public", + scgraph.Precedence, + "dependent", "column", + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.typeFilter(isColumnDependent), + to.Type((*scpb.Column)(nil)), + joinOnColumnID(from, to, "table-id", "col-id"), + statusesToPublicOrTransient(from, scpb.Status_PUBLIC, to, scpb.Status_PUBLIC), + } + }, + ) +} + +// Special cases of the above. +func init() { + registerDepRule( + "column name and type set right after column existence", + scgraph.SameStagePrecedence, + "column", "column-name-or-type", + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.Type((*scpb.Column)(nil)), + to.Type( + (*scpb.ColumnName)(nil), + (*scpb.ColumnType)(nil), + ), + statusesToPublicOrTransient(from, scpb.Status_DELETE_ONLY, to, scpb.Status_PUBLIC), + joinOnColumnID(from, to, "table-id", "col-id"), + } + }, + ) + + registerDepRule( + "DEFAULT or ON UPDATE existence precedes writes to column", + scgraph.Precedence, + "expr", "column", + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.Type( + (*scpb.ColumnDefaultExpression)(nil), + (*scpb.ColumnOnUpdateExpression)(nil), + ), + to.Type((*scpb.Column)(nil)), + joinOnColumnID(from, to, "table-id", "col-id"), + statusesToPublicOrTransient(from, scpb.Status_PUBLIC, to, scpb.Status_WRITE_ONLY), + } + }, + ) +} + +// This rule ensures that columns depend on each other in increasing order. +func init() { + registerDepRule( + "ensure columns are in increasing order", + scgraph.SameStagePrecedence, + "later-column", "earlier-column", + func(from, to nodeVars) rel.Clauses { + status := rel.Var("status") + return rel.Clauses{ + from.Type((*scpb.Column)(nil)), + to.Type((*scpb.Column)(nil)), + joinOnDescID(from, to, "table-id"), + toPublicOrTransient(from, to), + status.In(scpb.Status_WRITE_ONLY, scpb.Status_PUBLIC), + status.Entities(screl.CurrentStatus, from.node, to.node), + filterElements("SmallerColumnIDFirst", from, to, func(from, to *scpb.Column) bool { + return from.ColumnID < to.ColumnID + }), + } + }) +} diff --git a/pkg/sql/schemachanger/scplan/internal/rules/dep_add_index.go b/pkg/sql/schemachanger/scplan/internal/rules/dep_add_index.go new file mode 100644 index 000000000000..93f651350831 --- /dev/null +++ b/pkg/sql/schemachanger/scplan/internal/rules/dep_add_index.go @@ -0,0 +1,159 @@ +// Copyright 2022 The Cockroach Authors. +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package rules + +import ( + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/rel" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scpb" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scplan/internal/scgraph" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/screl" +) + +// These rules ensure that index-dependent elements, like an index's name, its +// partitioning, etc. appear once the index reaches a suitable state. +func init() { + + registerDepRule( + "index existence precedes index dependents", + scgraph.Precedence, + "index", "dependent", + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.Type( + (*scpb.PrimaryIndex)(nil), + (*scpb.SecondaryIndex)(nil), + ), + to.typeFilter(isIndexDependent), + joinOnIndexID(from, to, "table-id", "index-id"), + statusesToPublicOrTransient(from, scpb.Status_BACKFILL_ONLY, to, scpb.Status_PUBLIC), + } + }, + ) + + registerDepRule( + "temp index existence precedes index dependents", + scgraph.Precedence, + "index", "dependent", + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.Type((*scpb.TemporaryIndex)(nil)), + to.typeFilter(isIndexDependent), + joinOnIndexID(from, to, "table-id", "index-id"), + statusesToPublicOrTransient(from, scpb.Status_DELETE_ONLY, to, scpb.Status_PUBLIC), + } + }, + ) + + registerDepRule( + "index dependents exist before index becomes public", + scgraph.Precedence, + "dependent", "index", + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.typeFilter(isIndexDependent), + to.typeFilter(isIndex), + joinOnIndexID(from, to, "table-id", "index-id"), + statusesToPublicOrTransient(from, scpb.Status_PUBLIC, to, scpb.Status_PUBLIC), + } + }, + ) +} + +// Special cases of the above. +func init() { + + registerDepRule( + "index named right before index becomes public", + scgraph.SameStagePrecedence, + "index-name", "index", + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.Type((*scpb.IndexName)(nil)), + to.Type( + (*scpb.PrimaryIndex)(nil), + (*scpb.SecondaryIndex)(nil), + ), + joinOnIndexID(from, to, "table-id", "index-id"), + statusesToPublicOrTransient(from, scpb.Status_PUBLIC, to, scpb.Status_PUBLIC), + } + }, + ) +} + +// This rule ensures that before an offline-backfilled index can begin +// backfilling, the corresponding temporary index exists in WRITE_ONLY. +func init() { + + registerDepRule( + "temp index is WRITE_ONLY before backfill", + scgraph.Precedence, + "temp", "index", + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.Type((*scpb.TemporaryIndex)(nil)), + to.Type((*scpb.PrimaryIndex)(nil), (*scpb.SecondaryIndex)(nil)), + joinOnDescID(from, to, "table-id"), + joinOn( + from, screl.IndexID, + to, screl.TemporaryIndexID, + "temp-index-id", + ), + from.targetStatus(scpb.Transient), + to.targetStatus(scpb.ToPublic, scpb.Transient), + from.currentStatus(scpb.Status_WRITE_ONLY), + to.currentStatus(scpb.Status_BACKFILLED), + } + }, + ) +} + +// We want to say that all columns which are part of a secondary index need +// to be in a primary index which is validated +// To do that, we want to find a secondary index which has a source which +// is a primary index which is itself new. +func init() { + + registerDepRule( + "primary index with new columns should exist before secondary indexes", + scgraph.Precedence, + "primary-index", "secondary-index", + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.Type((*scpb.PrimaryIndex)(nil)), + to.Type((*scpb.SecondaryIndex)(nil)), + joinOnDescID(from, to, "table-id"), + joinOn( + from, screl.IndexID, + to, screl.SourceIndexID, + "primary-index-id", + ), + statusesToPublicOrTransient(from, scpb.Status_PUBLIC, to, scpb.Status_BACKFILL_ONLY), + } + }) + + registerDepRule( + "primary index with new columns should exist before temp indexes", + scgraph.Precedence, + "primary-index", "temp-index", + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.Type((*scpb.PrimaryIndex)(nil)), + to.Type((*scpb.TemporaryIndex)(nil)), + joinOnDescID(from, to, "table-id"), + joinOn( + from, screl.IndexID, + to, screl.SourceIndexID, + "primary-index-id", + ), + statusesToPublicOrTransient(from, scpb.Status_PUBLIC, to, scpb.Status_DELETE_ONLY), + } + }) +} diff --git a/pkg/sql/schemachanger/scplan/internal/rules/dep_add_index_and_column.go b/pkg/sql/schemachanger/scplan/internal/rules/dep_add_index_and_column.go new file mode 100644 index 000000000000..f38e3aaf7666 --- /dev/null +++ b/pkg/sql/schemachanger/scplan/internal/rules/dep_add_index_and_column.go @@ -0,0 +1,124 @@ +// Copyright 2022 The Cockroach Authors. +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package rules + +import ( + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/rel" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scpb" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scplan/internal/scgraph" +) + +// These rules ensure that columns and indexes containing these columns +// appear into existence in the correct order. +func init() { + + // We need to make sure that no columns are added to the index after it + // receives any data due to a backfill. + registerDepRule("index-column added to index before index is backfilled", + scgraph.Precedence, + "index-column", "index", + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.Type((*scpb.IndexColumn)(nil)), + to.Type((*scpb.PrimaryIndex)(nil), (*scpb.SecondaryIndex)(nil)), + joinOnIndexID(from, to, "table-id", "index-id"), + statusesToPublicOrTransient(from, scpb.Status_PUBLIC, to, scpb.Status_BACKFILLED), + } + }) + + // We need to make sure that no columns are added to the temp index after it + // receives any writes. + registerDepRule("index-column added to index before temp index receives writes", + scgraph.Precedence, + "index-column", "index", + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.Type((*scpb.IndexColumn)(nil)), + to.Type((*scpb.TemporaryIndex)(nil)), + joinOnIndexID(from, to, "table-id", "index-id"), + statusesTransient(from, scpb.Status_PUBLIC, to, scpb.Status_WRITE_ONLY), + } + }) + + registerDepRule( + "column existence precedes index existence", + scgraph.Precedence, + "column", "index", + func(from, to nodeVars) rel.Clauses { + ic := mkNodeVars("index-column") + relationID, columnID := rel.Var("table-id"), rel.Var("column-id") + return rel.Clauses{ + from.Type((*scpb.Column)(nil)), + to.Type((*scpb.PrimaryIndex)(nil), (*scpb.SecondaryIndex)(nil)), + joinOnColumnID(from, ic, relationID, columnID), + columnInIndex(ic, to, relationID, columnID, "index-id"), + statusesToPublicOrTransient(from, scpb.Status_DELETE_ONLY, to, scpb.Status_BACKFILL_ONLY), + } + }, + ) + + registerDepRule( + "column existence precedes temp index existence", + scgraph.Precedence, + "column", "index", + func(from, to nodeVars) rel.Clauses { + ic := mkNodeVars("index-column") + relationID, columnID := rel.Var("table-id"), rel.Var("column-id") + return rel.Clauses{ + from.Type((*scpb.Column)(nil)), + to.Type((*scpb.TemporaryIndex)(nil)), + joinOnColumnID(ic, from, relationID, columnID), + columnInIndex(ic, to, relationID, columnID, "index-id"), + statusesToPublicOrTransient(from, scpb.Status_DELETE_ONLY, to, scpb.Status_DELETE_ONLY), + } + }, + ) + + // We need to ensure that the temporary index has all the relevant writes + // to any columns it contains. We ensure elsewhere that any index which + // will later be merged with the temporary index is not backfilled until + // that temporary index is receiving writes. This rule ensures that those + // write operations contain data for all columns. + registerDepRule( + "column is WRITE_ONLY before temporary index is WRITE_ONLY", + scgraph.Precedence, + "column", "index", + func(from, to nodeVars) rel.Clauses { + ic := mkNodeVars("index-column") + relationID, columnID := rel.Var("table-id"), rel.Var("column-id") + return rel.Clauses{ + from.el.Type((*scpb.Column)(nil)), + to.el.Type((*scpb.TemporaryIndex)(nil)), + joinOnColumnID(ic, from, relationID, columnID), + columnInIndex(ic, to, relationID, columnID, "index-id"), + statusesToPublicOrTransient(from, scpb.Status_WRITE_ONLY, to, scpb.Status_WRITE_ONLY), + } + }, + ) + + registerDepRule( + "swapped primary index public before column", + scgraph.Precedence, + "index", "column", + func(from, to nodeVars) rel.Clauses { + ic := mkNodeVars("index-column") + relationID, columnID := rel.Var("table-id"), rel.Var("column-id") + return rel.Clauses{ + from.Type((*scpb.PrimaryIndex)(nil)), + to.Type((*scpb.Column)(nil)), + columnInPrimaryIndexSwap(ic, from, relationID, columnID, "index-id"), + joinOnColumnID(ic, to, relationID, columnID), + statusesToPublicOrTransient(from, scpb.Status_PUBLIC, to, scpb.Status_PUBLIC), + } + }, + ) + +} diff --git a/pkg/sql/schemachanger/scplan/internal/rules/dep_column.go b/pkg/sql/schemachanger/scplan/internal/rules/dep_column.go deleted file mode 100644 index 1dacaad58900..000000000000 --- a/pkg/sql/schemachanger/scplan/internal/rules/dep_column.go +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright 2022 The Cockroach Authors. -// -// Use of this software is governed by the Business Source License -// included in the file licenses/BSL.txt. -// -// As of the Change Date specified in that file, in accordance with -// the Business Source License, use of this software will be governed -// by the Apache License, Version 2.0, included in the file -// licenses/APL.txt. - -package rules - -import ( - "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/rel" - "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scpb" - "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scplan/internal/scgraph" - "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/screl" -) - -// These rules ensure that column-dependent elements, like a column's name, its -// DEFAULT expression, etc. appear once the column reaches a suitable state. -// Vice-versa for column removal. -func init() { - registerDepRule( - "column name set right after column existence", - scgraph.SameStagePrecedence, - "column", "column-name", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.Column)(nil)), - to.Type((*scpb.ColumnName)(nil)), - statusesToPublic(from, scpb.Status_DELETE_ONLY, to, scpb.Status_PUBLIC), - joinOnColumnID(from, to, "table-id", "col-id"), - } - }, - ) - registerDepRule( - "column existence precedes column dependents", - scgraph.Precedence, - "column", "dependent", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.Column)(nil)), - to.Type( - (*scpb.ColumnName)(nil), - (*scpb.ColumnDefaultExpression)(nil), - (*scpb.ColumnOnUpdateExpression)(nil), - (*scpb.ColumnComment)(nil), - (*scpb.IndexColumn)(nil), - ), - joinOnColumnID(from, to, "table-id", "col-id"), - statusesToPublic(from, scpb.Status_DELETE_ONLY, to, scpb.Status_PUBLIC), - } - }, - ) - - registerDepRule( - "DEFAULT or ON UPDATE existence precedes writes to column", - scgraph.Precedence, - "expr", "column", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type( - (*scpb.ColumnDefaultExpression)(nil), - (*scpb.ColumnOnUpdateExpression)(nil), - ), - to.Type((*scpb.Column)(nil)), - joinOnColumnID(from, to, "table-id", "col-id"), - statusesToPublic(from, scpb.Status_PUBLIC, to, scpb.Status_WRITE_ONLY), - } - }, - ) - - // TODO(ajwerner): Understand this rule and why it needs to exist. - registerDepRule( - "column named before column type becomes public", - scgraph.Precedence, - "column-name", "column-type", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.ColumnName)(nil)), - to.Type((*scpb.ColumnType)(nil)), - joinOnColumnID(from, to, "table-id", "col-id"), - statusesToPublic(from, scpb.Status_PUBLIC, to, scpb.Status_PUBLIC), - } - }, - ) - - // The comment is all that is remaining column dependents now that the name - // and the DEFAULT and ON UPDATE expressions have already been dealt with. - registerDepRule( - "column comment exists before column becomes public", - scgraph.Precedence, - "column-comment", "column", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.ColumnComment)(nil)), - to.Type((*scpb.Column)(nil)), - joinOnColumnID(from, to, "table-id", "col-id"), - statusesToPublic(from, scpb.Status_PUBLIC, to, scpb.Status_PUBLIC), - } - }, - ) - - registerDepRule( - "column dependents removed after column no longer public", - scgraph.Precedence, - "column", "dependent", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.Column)(nil)), - to.Type( - (*scpb.ColumnType)(nil), - (*scpb.ColumnName)(nil), - (*scpb.ColumnComment)(nil), - ), - joinOnColumnID(from, to, "table-id", "col-id"), - statusesToAbsent(from, scpb.Status_WRITE_ONLY, to, scpb.Status_ABSENT), - } - }, - ) - - registerDepRule( - "column type dependents removed right before column type", - scgraph.SameStagePrecedence, - "dependent", "column-type", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type( - (*scpb.SequenceOwner)(nil), - (*scpb.ColumnDefaultExpression)(nil), - (*scpb.ColumnOnUpdateExpression)(nil), - ), - to.Type((*scpb.ColumnType)(nil)), - joinOnColumnID(from, to, "table-id", "col-id"), - statusesToAbsent(from, scpb.Status_ABSENT, to, scpb.Status_ABSENT), - } - }, - ) - - registerDepRule( - "dependents removed before column", - scgraph.Precedence, - "dependent", "column", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type( - (*scpb.ColumnName)(nil), - (*scpb.ColumnType)(nil), - (*scpb.ColumnComment)(nil), - ), - to.Type((*scpb.Column)(nil)), - joinOnColumnID(from, to, "table-id", "col-id"), - statusesToAbsent(from, scpb.Status_ABSENT, to, scpb.Status_ABSENT), - } - }, - ) -} - -// This rule ensures that columns depend on each other in increasing order. -func init() { - registerDepRule( - "ensure columns are in increasing order", - scgraph.SameStagePrecedence, - "later-column", "earlier-column", - func(from, to nodeVars) rel.Clauses { - status := rel.Var("status") - return rel.Clauses{ - from.Type((*scpb.Column)(nil)), - to.Type((*scpb.Column)(nil)), - joinOnDescID(from, to, "table-id"), - toPublic(from, to), - status.In(scpb.Status_WRITE_ONLY, scpb.Status_PUBLIC), - status.Entities(screl.CurrentStatus, from.node, to.node), - filterElements("SmallerColumnIDFirst", from, to, func(from, to *scpb.Column) bool { - return from.ColumnID < to.ColumnID - }), - } - }) -} diff --git a/pkg/sql/schemachanger/scplan/internal/rules/dep_drop_column.go b/pkg/sql/schemachanger/scplan/internal/rules/dep_drop_column.go new file mode 100644 index 000000000000..79d967f51ee8 --- /dev/null +++ b/pkg/sql/schemachanger/scplan/internal/rules/dep_drop_column.go @@ -0,0 +1,105 @@ +// Copyright 2022 The Cockroach Authors. +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package rules + +import ( + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/rel" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scpb" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scplan/internal/scgraph" +) + +// These rules ensure that column-dependent elements, like a column's name, its +// DEFAULT expression, etc. disappear once the column reaches a suitable state. +func init() { + + registerDepRuleForDrop( + "column no longer public before dependents", + scgraph.Precedence, + "column", "dependent", + scpb.Status_WRITE_ONLY, scpb.Status_ABSENT, + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.Type((*scpb.Column)(nil)), + to.typeFilter(isColumnDependent), + joinOnColumnID(from, to, "table-id", "col-id"), + } + }, + ) + + registerDepRuleForDrop( + "dependents removed before column", + scgraph.Precedence, + "dependent", "column", + scpb.Status_ABSENT, scpb.Status_ABSENT, + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.typeFilter(isColumnDependent), + to.Type((*scpb.Column)(nil)), + joinOnColumnID(from, to, "table-id", "col-id"), + } + }, + ) +} + +// Special cases of the above. +func init() { + + registerDepRule( + "column type dependents removed right before column type", + scgraph.SameStagePrecedence, + "dependent", "column-type", + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.typeFilter(isColumnTypeDependent), + to.Type((*scpb.ColumnType)(nil)), + joinOnColumnID(from, to, "table-id", "col-id"), + statusesToAbsent(from, scpb.Status_ABSENT, to, scpb.Status_ABSENT), + } + }, + ) + + // Special cases for removal of column types, which hold references to other + // descriptors. + // + // When the whole table is dropped, we can (and in fact, should) remove these + // right away in-txn. However, when only the column is dropped but the table + // remains, we need to wait until the column is DELETE_ONLY, which happens + // post-commit because of the need to uphold the 2-version invariant. + // + // We distinguish the two cases using a flag in ColumnType which is set iff + // the parent relation is dropped. This is a dirty hack, ideally we should be + // able to express the _absence_ of a target element as a query clause. + // + // Note that DEFAULT and ON UPDATE expressions are column-dependent elements + // which also hold references to other descriptors. The rule prior to this one + // ensures that they transition to ABSENT before scpb.ColumnType does. + // + // TODO(postamar): express this rule in a saner way + registerDepRule( + "column type removed right before column when not dropping relation", + scgraph.SameStagePrecedence, + "column-type", "column", + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.Type((*scpb.ColumnType)(nil)), + to.Type((*scpb.Column)(nil)), + joinOnColumnID(from, to, "table-id", "col-id"), + statusesToAbsent(from, scpb.Status_ABSENT, to, scpb.Status_ABSENT), + rel.Filter("relationIsNotBeingDropped", from.el)( + func(ct *scpb.ColumnType) bool { + return !ct.IsRelationBeingDropped + }, + ), + } + }, + ) + +} diff --git a/pkg/sql/schemachanger/scplan/internal/rules/dep_drop_index.go b/pkg/sql/schemachanger/scplan/internal/rules/dep_drop_index.go new file mode 100644 index 000000000000..ead68e167975 --- /dev/null +++ b/pkg/sql/schemachanger/scplan/internal/rules/dep_drop_index.go @@ -0,0 +1,112 @@ +// Copyright 2022 The Cockroach Authors. +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package rules + +import ( + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/rel" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scpb" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scplan/internal/scgraph" +) + +// These rules ensure that index-dependent elements, like an index's name, its +// partitioning, etc. disappear once the index reaches a suitable state. +func init() { + + registerDepRuleForDrop( + "index no longer public before dependents", + scgraph.Precedence, + "index", "dependent", + scpb.Status_VALIDATED, scpb.Status_ABSENT, + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.typeFilter(isIndex), + to.typeFilter(isIndexDependent), + joinOnIndexID(from, to, "table-id", "index-id"), + } + }, + ) + registerDepRuleForDrop( + "dependents removed before index", + scgraph.Precedence, + "dependent", "index", + scpb.Status_ABSENT, scpb.Status_ABSENT, + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.typeFilter(isIndexDependent), + to.typeFilter(isIndex), + joinOnIndexID(from, to, "table-id", "index-id"), + } + }, + ) +} + +// Special cases of the above. +func init() { + + // If we're going to be removing columns from an index, we know that + // it'll be because we're dropping the index. If we're dropping the + // index and not the descriptor, we need to make sure that we only + // do it once the index is definitely being dropped. The reason for + // this is roundabout: dropping a column from an index which is itself + // being dropped is treated as a no-op by the op rules. + // + // TODO(ajwerner): This rule really feels like it ought to be a + // same stage precedence sort of rule where we remove the columns from the + // index when we remove the index, but for some reason, that overconstrains + // the graph when dropping the table. Because of that, we allow the column + // to be removed from the index in DELETE_ONLY, and we no-op the removal. + registerDepRuleForDrop( + "remove columns from index right before removing index", + scgraph.Precedence, + "index", "index-column", + scpb.Status_DELETE_ONLY, scpb.Status_ABSENT, + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.Type((*scpb.IndexColumn)(nil)), + to.typeFilter(isIndex), + joinOnIndexID(from, to, "table-id", "index-id"), + } + }, + ) + + // Special case for removal of partial predicates, which hold references to + // other descriptors. + // + // When the whole table is dropped, we can (and in fact, should) remove these + // right away in-txn. However, when only the index is dropped but the table + // remains, we need to wait until the index is DELETE_ONLY, which happens + // post-commit because of the need to uphold the 2-version invariant. + // + // We distinguish the two cases using a flag in SecondaryIndexPartial which is + // set iff the parent relation is dropped. This is a dirty hack, ideally we + // should be able to express the _absence_ of a target element as a query + // clause. + // + // TODO(postamar): express this rule in a saner way + registerDepRuleForDrop( + "partial predicate removed right before secondary index when not dropping relation", + scgraph.SameStagePrecedence, + "partial-predicate", "index", + scpb.Status_ABSENT, scpb.Status_ABSENT, + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.Type((*scpb.SecondaryIndexPartial)(nil)), + to.Type((*scpb.SecondaryIndex)(nil)), + joinOnIndexID(from, to, "table-id", "index-id"), + rel.Filter("relationIsNotBeingDropped", from.el)( + func(ip *scpb.SecondaryIndexPartial) bool { + return !ip.IsRelationBeingDropped + }, + ), + } + }, + ) +} diff --git a/pkg/sql/schemachanger/scplan/internal/rules/dep_drop_index_and_column.go b/pkg/sql/schemachanger/scplan/internal/rules/dep_drop_index_and_column.go new file mode 100644 index 000000000000..17767c21f35a --- /dev/null +++ b/pkg/sql/schemachanger/scplan/internal/rules/dep_drop_index_and_column.go @@ -0,0 +1,75 @@ +// Copyright 2022 The Cockroach Authors. +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package rules + +import ( + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/rel" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scpb" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scplan/internal/scgraph" +) + +// These rules ensure that columns and indexes containing these columns +// disappear from existence in the correct order. +func init() { + + // Without this rule, we might have an index which exists and contains + // a column which does not exist. This would lead to panics inside the + // optimizer and an invalid table descriptor. + registerDepRuleForDrop("indexes containing column reach absent before column", + scgraph.Precedence, + "index", "column", + scpb.Status_ABSENT, scpb.Status_ABSENT, + func(from, to nodeVars) rel.Clauses { + ic, ct := mkNodeVars("index-column"), mkNodeVars("column-type") + relationID, columnID := rel.Var("table-id"), rel.Var("column-id") + return rel.Clauses{ + from.Type((*scpb.PrimaryIndex)(nil), (*scpb.SecondaryIndex)(nil)), + to.Type((*scpb.Column)(nil)), + ct.Type((*scpb.ColumnType)(nil)), + columnInIndex(ic, from, relationID, columnID, "index-id"), + joinOnColumnID(ic, to, relationID, columnID), + joinOnColumnID(ic, ct, relationID, columnID), + rel.Filter("relationIsNotBeingDropped", ct.el)( + func(ct *scpb.ColumnType) bool { + return !ct.IsRelationBeingDropped + }, + ), + } + }) + + registerDepRule("secondary indexes containing column as key reach write-only before column", + scgraph.Precedence, + "index", "column", + func(from, to nodeVars) rel.Clauses { + ic, ct := mkNodeVars("index-column"), mkNodeVars("column-type") + relationID, columnID := rel.Var("table-id"), rel.Var("column-id") + return rel.Clauses{ + from.Type((*scpb.SecondaryIndex)(nil)), + to.Type((*scpb.Column)(nil)), + columnInIndex(ic, from, relationID, columnID, "index-id"), + joinOnColumnID(ic, to, relationID, columnID), + statusesToAbsent(from, scpb.Status_VALIDATED, to, scpb.Status_WRITE_ONLY), + ct.Type((*scpb.ColumnType)(nil)), + joinOnColumnID(ic, ct, relationID, columnID), + rel.Filter("relationIsNotBeingDropped", ct.el)( + func(ct *scpb.ColumnType) bool { + return !ct.IsRelationBeingDropped + }, + ), + rel.Filter("isIndexKeyColumnKey", ic.el)( + func(ic *scpb.IndexColumn) bool { + return ic.Kind == scpb.IndexColumn_KEY + }, + ), + } + }) + +} diff --git a/pkg/sql/schemachanger/scplan/internal/rules/dep_drop.go b/pkg/sql/schemachanger/scplan/internal/rules/dep_drop_object.go similarity index 100% rename from pkg/sql/schemachanger/scplan/internal/rules/dep_drop.go rename to pkg/sql/schemachanger/scplan/internal/rules/dep_drop_object.go diff --git a/pkg/sql/schemachanger/scplan/internal/rules/dep_index.go b/pkg/sql/schemachanger/scplan/internal/rules/dep_index.go deleted file mode 100644 index 37bef778a08f..000000000000 --- a/pkg/sql/schemachanger/scplan/internal/rules/dep_index.go +++ /dev/null @@ -1,311 +0,0 @@ -// Copyright 2022 The Cockroach Authors. -// -// Use of this software is governed by the Business Source License -// included in the file licenses/BSL.txt. -// -// As of the Change Date specified in that file, in accordance with -// the Business Source License, use of this software will be governed -// by the Apache License, Version 2.0, included in the file -// licenses/APL.txt. - -package rules - -import ( - "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/rel" - "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scpb" - "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scplan/internal/scgraph" - "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/screl" -) - -// This rule ensures that a new primary index becomes public right after the -// old primary index starts getting removed, effectively swapping one for the -// other. This rule also applies when the schema change gets reverted. -func init() { - registerDepRule( - "primary index swap", - scgraph.SameStagePrecedence, - "old-index", "new-index", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.PrimaryIndex)(nil)), - to.Type((*scpb.PrimaryIndex)(nil)), - joinOnDescID(from, to, "table-id"), - from.targetStatus(scpb.ToAbsent), - to.targetStatus(scpb.ToPublic), - from.currentStatus(scpb.Status_VALIDATED), - to.currentStatus(scpb.Status_PUBLIC), - filterElements("primaryIndexesDependency", from, to, func(i1, i2 *scpb.PrimaryIndex) bool { - return i1.SourceIndexID == i2.IndexID || i1.IndexID == i2.SourceIndexID - }), - } - }, - ) -} - -// These rules ensure that index-dependent elements, like an index's name, its -// partitioning, etc. appear once the index reaches a suitable state. -// Vice-versa for index removal. -func init() { - registerDepRule( - "index existence precedes index name and comment", - scgraph.Precedence, - "index", "index-dependent", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type( - (*scpb.PrimaryIndex)(nil), - (*scpb.SecondaryIndex)(nil), - ), - to.Type( - (*scpb.IndexName)(nil), - (*scpb.IndexComment)(nil), - ), - joinOnIndexID(from, to, "table-id", "index-id"), - statusesToPublic(from, scpb.Status_BACKFILL_ONLY, to, scpb.Status_PUBLIC), - } - }) - - // This rule pairs with the rule which ensures that columns are added to - // the index before it receives writes. - registerDepRule( - "temp index exists before columns, partitioning, and partial", - scgraph.Precedence, - "temp-index", "index-partitioning", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.TemporaryIndex)(nil)), - to.Type( - (*scpb.IndexColumn)(nil), - (*scpb.IndexPartitioning)(nil), - (*scpb.SecondaryIndexPartial)(nil), - ), - joinOnIndexID(from, to, "table-id", "index-id"), - from.targetStatus(scpb.Transient), - to.targetStatus(scpb.ToPublic), - from.currentStatus(scpb.Status_DELETE_ONLY), - to.currentStatus(scpb.Status_PUBLIC), - } - }) - - // Once the index is public, its comment should be visible. - registerDepRule( - "comment existence precedes index becoming public", - scgraph.Precedence, - "child", "index", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type( - (*scpb.IndexComment)(nil), - ), - to.Type( - (*scpb.PrimaryIndex)(nil), - (*scpb.SecondaryIndex)(nil), - ), - joinOnIndexID(from, to, "table-id", "index-id"), - statusesToPublic(from, scpb.Status_PUBLIC, to, scpb.Status_PUBLIC), - } - }, - ) - registerDepRule( - "index named right before index becomes public", - scgraph.SameStagePrecedence, - "index-name", "index", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.IndexName)(nil)), - to.Type( - (*scpb.PrimaryIndex)(nil), - (*scpb.SecondaryIndex)(nil), - ), - statusesToPublic(from, scpb.Status_PUBLIC, to, scpb.Status_PUBLIC), - joinOnIndexID(from, to, "table-id", "index-id"), - } - }, - ) - - // If we're going to be removing columns from an index, we know that - // it'll be because we're dropping the index. If we're dropping the - // index and not the descriptor, we need to make sure that we only - // do it once the index is definitely being dropped. The reason for - // this is roundabout: dropping a column from an index which is itself - // being dropped is treated as a no-op by the execution layer. - // - // TODO(ajwerner): This pair of rules really feels like it ought to be a - // same stage precedence sort of rule where we remove the columns from the - // index when we remove the index, but for some reason, that overconstrains - // the graph when dropping the table. Because of that, we allow the column - // to be removed from the index in DELETE_ONLY, and we no-op the removal. - registerDepRule( - "secondary index columns removed before removing the index", - scgraph.Precedence, - "index-column", "index", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.IndexColumn)(nil)), - to.Type((*scpb.SecondaryIndex)(nil)), - joinOnIndexID(from, to, "table-id", "index-id"), - statusesToAbsent(from, scpb.Status_ABSENT, to, scpb.Status_ABSENT), - } - }, - ) - registerDepRule( - "secondary index in DELETE_ONLY before removing columns", - scgraph.Precedence, - "index", "index-column", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.SecondaryIndex)(nil)), - to.Type((*scpb.IndexColumn)(nil)), - joinOnIndexID(from, to, "table-id", "index-id"), - statusesToAbsent(from, scpb.Status_DELETE_ONLY, to, scpb.Status_ABSENT), - } - }, - ) - registerDepRule( - "temp index columns removed before removing the index", - scgraph.Precedence, - "index-column", "index", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.IndexColumn)(nil)), - to.Type((*scpb.TemporaryIndex)(nil)), - joinOnIndexID(from, to, "table-id", "index-id"), - statusesToAbsent(from, scpb.Status_ABSENT, to, scpb.Status_TRANSIENT_ABSENT), - } - }, - ) - registerDepRule( - "temp index in DELETE_ONLY before removing columns", - scgraph.Precedence, - "index", "index-column", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.TemporaryIndex)(nil)), - to.Type((*scpb.IndexColumn)(nil)), - joinOnIndexID(from, to, "table-id", "index-id"), - statusesToAbsent(from, scpb.Status_TRANSIENT_DELETE_ONLY, to, scpb.Status_ABSENT), - } - }, - ) - - // This rule is suspect. We absolutely cannot remove the partial predicate - // until the index is not longer being written to. I think the same goes - // for the columns. The partitioning is less clear. I think the name could - // go earlier. - registerDepRule( - "index no longer public before dependents removed", - scgraph.Precedence, - "index", "child", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.typeFilter(isIndex), - to.typeFilter(isIndexDependent), - joinOnIndexID(from, to, "table-id", "index-id"), - statusesToAbsent(from, scpb.Status_VALIDATED, to, scpb.Status_ABSENT), - } - }, - ) - - registerDepRule( - "dependents removed before index", - scgraph.Precedence, - "dependent", "index", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.typeFilter(isIndexDependent), - to.typeFilter(isIndex), - joinOnIndexID(from, to, "table-id", "index-id"), - statusesToAbsent(from, scpb.Status_ABSENT, to, scpb.Status_ABSENT), - } - }, - ) -} - -// These rules ensure that before an offline-backfilled index can begin -// backfilling, the corresponding temporary index exists in WRITE_ONLY. -func init() { - registerDepRule( - "temp index is WRITE_ONLY before backfill", - scgraph.Precedence, - "temp", "index", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.TemporaryIndex)(nil)), - to.Type((*scpb.PrimaryIndex)(nil), (*scpb.SecondaryIndex)(nil)), - joinOnDescID(from, to, "table-id"), - joinOn( - from, screl.IndexID, - to, screl.TemporaryIndexID, - "temp-index-id", - ), - from.targetStatus(scpb.Transient), - to.targetStatus(scpb.ToPublic), - from.currentStatus(scpb.Status_WRITE_ONLY), - to.currentStatus(scpb.Status_BACKFILLED), - } - }, - ) -} - -// We want to say that all columns which are part of a secondary index need -// to be in a primary index which is validated -// To do that, we want to find a secondary index which has a source which -// is a primary index which is itself new. Then we want to find -func init() { - registerDepRule( - "primary index with new columns should exist before secondary indexes", - scgraph.Precedence, - "primary-index", "second-index", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.PrimaryIndex)(nil)), - to.Type((*scpb.SecondaryIndex)(nil)), - joinOnDescID(from, to, "table-id"), - joinOn( - from, screl.IndexID, - to, screl.SourceIndexID, - "primary-index-id", - ), - statusesToPublic(from, scpb.Status_PUBLIC, to, scpb.Status_BACKFILL_ONLY), - } - }) - registerDepRule( - "primary index with new columns should exist before temp indexes", - scgraph.Precedence, - "primary-index", "second-index", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.PrimaryIndex)(nil)), - to.Type((*scpb.TemporaryIndex)(nil)), - joinOnDescID(from, to, "table-id"), - joinOn(from, screl.IndexID, to, screl.SourceIndexID, "primary-index-id"), - from.targetStatus(scpb.ToPublic), - to.targetStatus(scpb.Transient), - from.currentStatus(scpb.Status_PUBLIC), - to.currentStatus(scpb.Status_DELETE_ONLY), - } - }) -} - -// This is a pair of somewhat brute-force hack to ensure that we only create -// a single GC job for all the indexes of a table being dropped by a -// transaction. -func init() { - - registerDepRule("temp indexes reach absent at the same time as other indexes", - scgraph.SameStagePrecedence, - "index-a", "index-b", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.TemporaryIndex)(nil)), - to.Type((*scpb.PrimaryIndex)(nil), (*scpb.SecondaryIndex)(nil)), - joinOnDescID(from, to, "desc-id"), - from.targetStatus(scpb.Transient), - to.targetStatus(scpb.ToAbsent), - from.currentStatus(scpb.Status_TRANSIENT_ABSENT), - to.currentStatus(scpb.Status_ABSENT), - } - }) - // TODO(postamar): reimplement rule - // "indexes reach absent at the same time as other indexes" -} diff --git a/pkg/sql/schemachanger/scplan/internal/rules/dep_index_and_column.go b/pkg/sql/schemachanger/scplan/internal/rules/dep_index_and_column.go deleted file mode 100644 index 656c570f6825..000000000000 --- a/pkg/sql/schemachanger/scplan/internal/rules/dep_index_and_column.go +++ /dev/null @@ -1,274 +0,0 @@ -// Copyright 2022 The Cockroach Authors. -// -// Use of this software is governed by the Business Source License -// included in the file licenses/BSL.txt. -// -// As of the Change Date specified in that file, in accordance with -// the Business Source License, use of this software will be governed -// by the Apache License, Version 2.0, included in the file -// licenses/APL.txt. - -package rules - -import ( - "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/rel" - "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scpb" - "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scplan/internal/scgraph" -) - -// Special cases for removal of column types and index partial predicates, -// which hold references to other descriptors. -// -// When the whole table is dropped, we can (and in fact, should) remove these -// right away in-txn. However, when only the column (or the index) is -// dropped but the table remains, we need to wait until the column is -// DELETE_ONLY, which happens post-commit because of the need to uphold the -// 2-version invariant. -// -// We distinguish the two cases using a flag in ColumnType and -// SecondaryIndexPartial which is set iff the parent relation is dropped. This -// is a dirty hack, ideally we should be able to express the _absence_ of a -// target as a query clause. -// -// Note that DEFAULT and ON UPDATE expressions are column-dependent elements -// which also hold references to other descriptors. The rule prior to this one -// ensures that they transition to ABSENT before scpb.ColumnType does. -// -// TODO(postamar): express this rule in a saner way -func init() { - - registerDepRule( - "column type removed right before column when not dropping relation", - scgraph.SameStagePrecedence, - "column-type", "column", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.ColumnType)(nil)), - to.Type((*scpb.Column)(nil)), - joinOnColumnID(from, to, "table-id", "col-id"), - statusesToAbsent(from, scpb.Status_ABSENT, to, scpb.Status_ABSENT), - rel.Filter("RelationIsNotBeingDropped", from.el)( - func(ct *scpb.ColumnType) bool { - return !ct.IsRelationBeingDropped - }, - ), - } - }, - ) - - // Without this rule, we might have an index which exists and contains - // a column which does not exist. This would lead to panics inside the - // optimizer and an invalid table descriptor. - registerDepRule("indexes containing columns reach absent before column", - scgraph.Precedence, - "index", "column", - func(from, to nodeVars) rel.Clauses { - ic, ct := mkNodeVars("index-column"), mkNodeVars("column-type") - relationID, columnID := rel.Var("table-id"), rel.Var("column-id") - return rel.Clauses{ - from.Type((*scpb.PrimaryIndex)(nil), (*scpb.SecondaryIndex)(nil)), - to.Type((*scpb.Column)(nil)), - ct.Type((*scpb.ColumnType)(nil)), - columnInIndex(ic, from, relationID, columnID, "index-id"), - joinOnColumnID(ic, to, relationID, columnID), - joinOnColumnID(ic, ct, relationID, columnID), - statusesToAbsent(from, scpb.Status_ABSENT, to, scpb.Status_ABSENT), - rel.Filter("RelationIsNotBeingDropped", ct.el)( - func(ct *scpb.ColumnType) bool { - return !ct.IsRelationBeingDropped - }), - } - }) - - registerDepRule( - "partial predicate removed right before secondary index when not dropping relation", - scgraph.SameStagePrecedence, - "partial-predicate", "index", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.SecondaryIndexPartial)(nil)), - to.Type((*scpb.SecondaryIndex)(nil)), - joinOnIndexID(from, to, "table-id", "index-id"), - statusesToAbsent(from, scpb.Status_ABSENT, to, scpb.Status_ABSENT), - rel.Filter("RelationIsNotBeingDropped", from.el)( - func(ip *scpb.SecondaryIndexPartial) bool { - return !ip.IsRelationBeingDropped - }, - ), - } - }, - ) -} - -// These rules ensure that columns and indexes containing these columns -// appear into existence in the correct order. -func init() { - - registerDepRule( - "adding column depends on primary index", - scgraph.Precedence, - "index", "column", - func(from, to nodeVars) rel.Clauses { - ic := mkNodeVars("index-column") - relationID, columnID := rel.Var("table-id"), rel.Var("column-id") - return rel.Clauses{ - from.Type((*scpb.PrimaryIndex)(nil)), - to.Type((*scpb.Column)(nil)), - columnInPrimaryIndexSwap(ic, from, relationID, columnID, "index-id"), - joinOnColumnID(ic, to, relationID, columnID), - statusesToPublic(from, scpb.Status_PUBLIC, to, scpb.Status_PUBLIC), - } - }, - ) - - registerDepRule( - "primary index should be cleaned up before newly added column when reverting", - scgraph.Precedence, - "index", "column", - func(from, to nodeVars) rel.Clauses { - ic := mkNodeVars("index-column") - relationID, columnID := rel.Var("table-id"), rel.Var("column-id") - return rel.Clauses{ - from.Type((*scpb.PrimaryIndex)(nil)), - to.Type((*scpb.Column)(nil)), - columnInPrimaryIndexSwap(ic, from, relationID, columnID, "index-id"), - joinOnColumnID(ic, to, relationID, columnID), - statusesToAbsent(from, scpb.Status_WRITE_ONLY, to, scpb.Status_WRITE_ONLY), - } - }) - registerDepRule( - "column existence precedes index existence", - scgraph.Precedence, - "column", "index", - func(from, to nodeVars) rel.Clauses { - ic := mkNodeVars("index-column") - relationID, columnID := rel.Var("table-id"), rel.Var("column-id") - return rel.Clauses{ - from.Type((*scpb.Column)(nil)), - to.Type((*scpb.PrimaryIndex)(nil), (*scpb.SecondaryIndex)(nil)), - joinOnColumnID(from, ic, relationID, columnID), - columnInIndex(ic, to, relationID, columnID, "index-id"), - statusesToPublic(from, scpb.Status_DELETE_ONLY, to, scpb.Status_BACKFILL_ONLY), - } - }, - ) - - // We need to make sure that we don't add a temporary index to a table - // until the column has been added to the table. - registerDepRule( - "column existence precedes temporary index existence", - scgraph.Precedence, - "column", "temp-index", - func(from, to nodeVars) rel.Clauses { - ic := mkNodeVars("index-column") - relationID, columnID := rel.Var("table-id"), rel.Var("column-id") - return rel.Clauses{ - from.Type((*scpb.Column)(nil)), - to.Type((*scpb.TemporaryIndex)(nil)), - columnInIndex(ic, to, relationID, columnID, "temp-index-id"), - joinOnColumnID(ic, from, relationID, columnID), - from.targetStatus(scpb.ToPublic), - to.targetStatus(scpb.Transient), - from.currentStatus(scpb.Status_DELETE_ONLY), - to.currentStatus(scpb.Status_DELETE_ONLY), - } - }, - ) - - // We want to ensure that column names are not dropped until the column is - // no longer in use in any dropping indexes. - registerDepRule( - "column name and type to public after all index column to public", - scgraph.Precedence, - "column-name-or-type", "index-column", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.ColumnName)(nil), (*scpb.ColumnType)(nil)), - to.Type((*scpb.IndexColumn)(nil)), - joinOnColumnID(from, to, "table-id", "column-id"), - statusesToPublic(from, scpb.Status_PUBLIC, to, scpb.Status_PUBLIC), - } - }, - ) - - registerDepRule("index-column added to index after index exists", - scgraph.Precedence, - "index", "index-column", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.PrimaryIndex)(nil), (*scpb.SecondaryIndex)(nil)), - to.Type((*scpb.IndexColumn)(nil)), - joinOnIndexID(from, to, "table-id", "index-id"), - statusesToPublic(from, scpb.Status_BACKFILL_ONLY, to, scpb.Status_PUBLIC), - } - }) - // We need to make sure that no columns are added to the index after it - // receives any data due to a backfill. - registerDepRule("index-column added to index before index is backfilled", - scgraph.Precedence, - "index-column", "index", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.IndexColumn)(nil)), - to.Type((*scpb.PrimaryIndex)(nil), (*scpb.SecondaryIndex)(nil)), - joinOnIndexID(from, to, "table-id", "index-id"), - statusesToPublic(from, scpb.Status_PUBLIC, to, scpb.Status_BACKFILLED), - } - }) - registerDepRule("index-column added to index after temp index exists", - scgraph.Precedence, - "index", "index-column", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.TemporaryIndex)(nil)), - to.Type((*scpb.IndexColumn)(nil)), - joinOnIndexID(from, to, "table-id", "index-id"), - from.targetStatus(scpb.Transient), - to.targetStatus(scpb.ToPublic), - from.currentStatus(scpb.Status_DELETE_ONLY), - to.currentStatus(scpb.Status_PUBLIC), - } - }) - // We need to make sure that no columns are added to the temp index after it - // receives any writes. - registerDepRule("index-column added to index before temp index receives writes", - scgraph.Precedence, - "index-column", "index", - func(from, to nodeVars) rel.Clauses { - return rel.Clauses{ - from.Type((*scpb.IndexColumn)(nil)), - to.Type((*scpb.TemporaryIndex)(nil)), - joinOnIndexID(from, to, "table-id", "index-id"), - from.targetStatus(scpb.ToPublic), - to.targetStatus(scpb.Transient), - from.currentStatus(scpb.Status_PUBLIC), - to.currentStatus(scpb.Status_WRITE_ONLY), - } - }) - - // We need to ensure that the temporary index has all the relevant writes - // to any columns it contains. We ensure elsewhere that any index which - // will later be merged with the temporary index is not backfilled until - // that temporary index is receiving writes. This rule ensures that those - // write operations contain data for all columns. - registerDepRule( - "column is WRITE_ONLY before temporary index is WRITE_ONLY", - scgraph.Precedence, - "column", "index", - func(from, to nodeVars) rel.Clauses { - ic := mkNodeVars("index-column") - relationID, columnID := rel.Var("table-id"), rel.Var("column-id") - return rel.Clauses{ - from.el.Type((*scpb.Column)(nil)), - to.el.Type((*scpb.TemporaryIndex)(nil)), - joinOnColumnID(ic, from, relationID, columnID), - columnInIndex(ic, to, relationID, columnID, "index-id"), - from.targetStatus(scpb.ToPublic), - to.targetStatus(scpb.Transient), - from.currentStatus(scpb.Status_WRITE_ONLY), - to.currentStatus(scpb.Status_WRITE_ONLY), - } - }, - ) - -} diff --git a/pkg/sql/schemachanger/scplan/internal/rules/dep_swap_index.go b/pkg/sql/schemachanger/scplan/internal/rules/dep_swap_index.go new file mode 100644 index 000000000000..9f5435d3ddde --- /dev/null +++ b/pkg/sql/schemachanger/scplan/internal/rules/dep_swap_index.go @@ -0,0 +1,90 @@ +// Copyright 2022 The Cockroach Authors. +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package rules + +import ( + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/rel" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scpb" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scplan/internal/scgraph" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/screl" +) + +// This rule ensures that a new primary index becomes public right after the +// old primary index starts getting removed, effectively swapping one for the +// other. This rule also applies when the schema change gets reverted. +func init() { + + registerDepRule( + "primary index swap", + scgraph.SameStagePrecedence, + "old-index", "new-index", + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.Type((*scpb.PrimaryIndex)(nil)), + to.Type((*scpb.PrimaryIndex)(nil)), + joinOnDescID(from, to, "table-id"), + joinOn( + from, screl.IndexID, + to, screl.SourceIndexID, + "old-index-id", + ), + from.targetStatus(scpb.ToAbsent), + from.currentStatus(scpb.Status_VALIDATED), + to.targetStatus(scpb.ToPublic, scpb.Transient), + to.currentStatus(scpb.Status_PUBLIC), + } + }, + ) + + registerDepRule( + "primary index swap", + scgraph.SameStagePrecedence, + "old-index", "new-index", + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.Type((*scpb.PrimaryIndex)(nil)), + to.Type((*scpb.PrimaryIndex)(nil)), + joinOnDescID(from, to, "table-id"), + joinOn( + from, screl.IndexID, + to, screl.SourceIndexID, + "old-index-id", + ), + from.targetStatus(scpb.Transient), + from.currentStatus(scpb.Status_TRANSIENT_VALIDATED), + to.targetStatus(scpb.ToPublic, scpb.Transient), + to.currentStatus(scpb.Status_PUBLIC), + } + }, + ) + + registerDepRule( + "primary index swap", + scgraph.SameStagePrecedence, + "new-index", "old-index", + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.Type((*scpb.PrimaryIndex)(nil)), + to.Type((*scpb.PrimaryIndex)(nil)), + joinOnDescID(from, to, "table-id"), + joinOn( + from, screl.SourceIndexID, + to, screl.IndexID, + "old-index-id", + ), + from.targetStatus(scpb.ToAbsent), + from.currentStatus(scpb.Status_VALIDATED), + to.targetStatus(scpb.ToPublic), + to.currentStatus(scpb.Status_PUBLIC), + } + }, + ) +} diff --git a/pkg/sql/schemachanger/scplan/internal/rules/helpers.go b/pkg/sql/schemachanger/scplan/internal/rules/helpers.go index a095750c171b..d36b28b82e5c 100644 --- a/pkg/sql/schemachanger/scplan/internal/rules/helpers.go +++ b/pkg/sql/schemachanger/scplan/internal/rules/helpers.go @@ -16,6 +16,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb" "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/rel" "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scpb" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scplan/internal/scgraph" "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/screl" "github.com/cockroachdb/cockroach/pkg/sql/sem/catid" "github.com/cockroachdb/cockroach/pkg/util/iterutil" @@ -48,15 +49,15 @@ func filterElements(name string, a, b nodeVars, fn interface{}) rel.Clause { return rel.Filter(name, a.el, b.el)(fn) } -func toPublic(from, to nodeVars) rel.Clause { - return toPublicUntyped(from.target, to.target) +func toPublicOrTransient(from, to nodeVars) rel.Clause { + return toPublicOrTransientUntyped(from.target, to.target) } -func statusesToPublic( +func statusesToPublicOrTransient( from nodeVars, fromStatus scpb.Status, to nodeVars, toStatus scpb.Status, ) rel.Clause { return rel.And( - toPublic(from, to), + toPublicOrTransient(from, to), from.currentStatus(fromStatus), to.currentStatus(toStatus), ) @@ -76,6 +77,20 @@ func statusesToAbsent( ) } +func transient(from, to nodeVars) rel.Clause { + return transientUntyped(from.target, to.target) +} + +func statusesTransient( + from nodeVars, fromStatus scpb.Status, to nodeVars, toStatus scpb.Status, +) rel.Clause { + return rel.And( + transient(from, to), + from.currentStatus(fromStatus), + to.currentStatus(toStatus), + ) +} + func joinOnDescID(a, b nodeVars, descriptorIDVar rel.Var) rel.Clause { return joinOnDescIDUntyped(a.el, b.el, descriptorIDVar) } @@ -109,13 +124,13 @@ func columnInPrimaryIndexSwap( } var ( - toPublicUntyped = screl.Schema.Def2( - "toPublic", + toPublicOrTransientUntyped = screl.Schema.Def2( + "toPublicOrTransient", "target1", "target2", func(target1 rel.Var, target2 rel.Var) rel.Clauses { return rel.Clauses{ - target1.AttrEq(screl.TargetStatus, scpb.Status_PUBLIC), - target2.AttrEq(screl.TargetStatus, scpb.Status_PUBLIC), + target1.AttrIn(screl.TargetStatus, scpb.Status_PUBLIC, scpb.Status_TRANSIENT_ABSENT), + target2.AttrIn(screl.TargetStatus, scpb.Status_PUBLIC, scpb.Status_TRANSIENT_ABSENT), } }) @@ -129,6 +144,16 @@ var ( } }) + transientUntyped = screl.Schema.Def2( + "transient", + "target1", "target2", + func(target1 rel.Var, target2 rel.Var) rel.Clauses { + return rel.Clauses{ + target1.AttrEq(screl.TargetStatus, scpb.Status_TRANSIENT_ABSENT), + target2.AttrEq(screl.TargetStatus, scpb.Status_TRANSIENT_ABSENT), + } + }) + joinReferencedDescIDUntyped = screl.Schema.Def3( "joinReferencedDescID", "referrer", "referenced", "id", func( referrer, referenced, id rel.Var, @@ -359,3 +384,58 @@ func isIndexDependent(e scpb.Element) bool { } return false } + +// registerDepRuleForDrop is a convenience function which calls +// registerDepRule with the cross-product of (ToAbsent,Transient)^2 target +// states, which can't easily be composed. +func registerDepRuleForDrop( + ruleName scgraph.RuleName, + kind scgraph.DepEdgeKind, + from, to string, + fromStatus, toStatus scpb.Status, + fn func(from, to nodeVars) rel.Clauses, +) { + + transientFromStatus, okFrom := scpb.GetTransientEquivalent(fromStatus) + if !okFrom { + panic(errors.AssertionFailedf("Invalid 'from' status %s", fromStatus)) + } + transientToStatus, okTo := scpb.GetTransientEquivalent(toStatus) + if !okTo { + panic(errors.AssertionFailedf("Invalid 'from' status %s", toStatus)) + } + + registerDepRule(ruleName, kind, from, to, func(from, to nodeVars) rel.Clauses { + return append( + fn(from, to), + statusesToAbsent(from, fromStatus, to, toStatus), + ) + }) + + registerDepRule(ruleName, kind, from, to, func(from, to nodeVars) rel.Clauses { + return append( + fn(from, to), + statusesTransient(from, transientFromStatus, to, transientToStatus), + ) + }) + + registerDepRule(ruleName, kind, from, to, func(from, to nodeVars) rel.Clauses { + return append( + fn(from, to), + from.targetStatus(scpb.Transient), + from.currentStatus(transientFromStatus), + to.targetStatus(scpb.ToAbsent), + to.currentStatus(toStatus), + ) + }) + + registerDepRule(ruleName, kind, from, to, func(from, to nodeVars) rel.Clauses { + return append( + fn(from, to), + from.targetStatus(scpb.ToAbsent), + from.currentStatus(fromStatus), + to.targetStatus(scpb.Transient), + to.currentStatus(transientToStatus), + ) + }) +} diff --git a/pkg/sql/schemachanger/scplan/internal/rules/op_index_and_column.go b/pkg/sql/schemachanger/scplan/internal/rules/op_index_and_column.go new file mode 100644 index 000000000000..c436d15b447c --- /dev/null +++ b/pkg/sql/schemachanger/scplan/internal/rules/op_index_and_column.go @@ -0,0 +1,40 @@ +// Copyright 2022 The Cockroach Authors. +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package rules + +import ( + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/rel" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scpb" + "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/screl" +) + +// Skill all IndexColumn removal ops for indexes which are also being removed. +func init() { + + ic := mkNodeVars("index-column") + index := mkNodeVars("index") + relationID, indexID := rel.Var("relation-id"), rel.Var("index-id") + + registerOpRule( + "skip index-column removal ops on index removal", + ic.node, + screl.MustQuery( + ic.Type((*scpb.IndexColumn)(nil)), + index.typeFilter(isIndex), + joinOnIndexID(ic, index, relationID, indexID), + ic.joinTargetNode(), + ic.targetStatus(scpb.ToAbsent, scpb.Transient), + ic.currentStatus(scpb.Status_PUBLIC, scpb.Status_TRANSIENT_PUBLIC), + index.joinTarget(), + index.targetStatus(scpb.ToAbsent, scpb.Transient), + ), + ) +} diff --git a/pkg/sql/schemachanger/scplan/internal/rules/registry.go b/pkg/sql/schemachanger/scplan/internal/rules/registry.go index 7eb37bddc353..4010bb579366 100644 --- a/pkg/sql/schemachanger/scplan/internal/rules/registry.go +++ b/pkg/sql/schemachanger/scplan/internal/rules/registry.go @@ -164,8 +164,18 @@ func (v nodeVars) joinTarget() rel.Clause { return screl.JoinTarget(v.el, v.target) } -func (v nodeVars) targetStatus(status scpb.TargetStatus) rel.Clause { - return v.target.AttrEq(screl.TargetStatus, status.Status()) +func (v nodeVars) targetStatus(status ...scpb.TargetStatus) rel.Clause { + if len(status) == 0 { + panic(errors.AssertionFailedf("empty current status values")) + } + if len(status) == 1 { + return v.target.AttrEq(screl.TargetStatus, status[0].Status()) + } + in := make([]interface{}, len(status)) + for i, s := range status { + in[i] = s.Status() + } + return v.target.AttrIn(screl.TargetStatus, in...) } // Type delegates to the element var Type method. diff --git a/pkg/sql/schemachanger/scplan/internal/rules/testdata/deprules b/pkg/sql/schemachanger/scplan/internal/rules/testdata/deprules index df57627190ea..d4907fa9a4c1 100644 --- a/pkg/sql/schemachanger/scplan/internal/rules/testdata/deprules +++ b/pkg/sql/schemachanger/scplan/internal/rules/testdata/deprules @@ -40,9 +40,12 @@ sourceIndexNotSet(index): toAbsent(target1, target2): - $target1[TargetStatus] = ABSENT - $target2[TargetStatus] = ABSENT -toPublic(target1, target2): - - $target1[TargetStatus] = PUBLIC - - $target2[TargetStatus] = PUBLIC +toPublicOrTransient(target1, target2): + - $target1[TargetStatus] IN [PUBLIC, TRANSIENT_ABSENT] + - $target2[TargetStatus] IN [PUBLIC, TRANSIENT_ABSENT] +transient(target1, target2): + - $target1[TargetStatus] = TRANSIENT_ABSENT + - $target2[TargetStatus] = TRANSIENT_ABSENT deprules ---- @@ -54,60 +57,33 @@ deprules - $expr[Type] IN ['*scpb.ColumnDefaultExpression', '*scpb.ColumnOnUpdateExpression'] - $column[Type] = '*scpb.Column' - joinOnColumnID($expr, $column, $table-id, $col-id) - - toPublic($expr-target, $column-target) + - toPublicOrTransient($expr-target, $column-target) - $expr-node[CurrentStatus] = PUBLIC - $column-node[CurrentStatus] = WRITE_ONLY - joinTargetNode($expr, $expr-target, $expr-node) - joinTargetNode($column, $column-target, $column-node) -- name: adding column depends on primary index - from: index-node - kind: Precedence - to: column-node - query: - - $index[Type] = '*scpb.PrimaryIndex' - - $column[Type] = '*scpb.Column' - - columnInPrimaryIndexSwap($index-column, $index, $table-id, $column-id, $index-id) - - joinOnColumnID($index-column, $column, $table-id, $column-id) - - toPublic($index-target, $column-target) - - $index-node[CurrentStatus] = PUBLIC - - $column-node[CurrentStatus] = PUBLIC - - joinTargetNode($index, $index-target, $index-node) - - joinTargetNode($column, $column-target, $column-node) -- name: column comment exists before column becomes public - from: column-comment-node +- name: column dependents exist before column becomes public + from: dependent-node kind: Precedence to: column-node query: - - $column-comment[Type] = '*scpb.ColumnComment' + - $dependent[Type] IN ['*scpb.ColumnName', '*scpb.ColumnType', '*scpb.ColumnDefaultExpression', '*scpb.ColumnOnUpdateExpression', '*scpb.SequenceOwner', '*scpb.ColumnComment', '*scpb.IndexColumn'] - $column[Type] = '*scpb.Column' - - joinOnColumnID($column-comment, $column, $table-id, $col-id) - - toPublic($column-comment-target, $column-target) - - $column-comment-node[CurrentStatus] = PUBLIC + - joinOnColumnID($dependent, $column, $table-id, $col-id) + - toPublicOrTransient($dependent-target, $column-target) + - $dependent-node[CurrentStatus] = PUBLIC - $column-node[CurrentStatus] = PUBLIC - - joinTargetNode($column-comment, $column-comment-target, $column-comment-node) - - joinTargetNode($column, $column-target, $column-node) -- name: column dependents removed after column no longer public - from: column-node - kind: Precedence - to: dependent-node - query: - - $column[Type] = '*scpb.Column' - - $dependent[Type] IN ['*scpb.ColumnType', '*scpb.ColumnName', '*scpb.ColumnComment'] - - joinOnColumnID($column, $dependent, $table-id, $col-id) - - toAbsent($column-target, $dependent-target) - - $column-node[CurrentStatus] = WRITE_ONLY - - $dependent-node[CurrentStatus] = ABSENT - - joinTargetNode($column, $column-target, $column-node) - joinTargetNode($dependent, $dependent-target, $dependent-node) + - joinTargetNode($column, $column-target, $column-node) - name: column existence precedes column dependents from: column-node kind: Precedence to: dependent-node query: - $column[Type] = '*scpb.Column' - - $dependent[Type] IN ['*scpb.ColumnName', '*scpb.ColumnDefaultExpression', '*scpb.ColumnOnUpdateExpression', '*scpb.ColumnComment', '*scpb.IndexColumn'] + - $dependent[Type] IN ['*scpb.ColumnName', '*scpb.ColumnType', '*scpb.ColumnDefaultExpression', '*scpb.ColumnOnUpdateExpression', '*scpb.SequenceOwner', '*scpb.ColumnComment', '*scpb.IndexColumn'] - joinOnColumnID($column, $dependent, $table-id, $col-id) - - toPublic($column-target, $dependent-target) + - toPublicOrTransient($column-target, $dependent-target) - $column-node[CurrentStatus] = DELETE_ONLY - $dependent-node[CurrentStatus] = PUBLIC - joinTargetNode($column, $column-target, $column-node) @@ -121,26 +97,25 @@ deprules - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex'] - joinOnColumnID($column, $index-column, $table-id, $column-id) - columnInIndex($index-column, $index, $table-id, $column-id, $index-id) - - toPublic($column-target, $index-target) + - toPublicOrTransient($column-target, $index-target) - $column-node[CurrentStatus] = DELETE_ONLY - $index-node[CurrentStatus] = BACKFILL_ONLY - joinTargetNode($column, $column-target, $column-node) - joinTargetNode($index, $index-target, $index-node) -- name: column existence precedes temporary index existence +- name: column existence precedes temp index existence from: column-node kind: Precedence - to: temp-index-node + to: index-node query: - $column[Type] = '*scpb.Column' - - $temp-index[Type] = '*scpb.TemporaryIndex' - - columnInIndex($index-column, $temp-index, $table-id, $column-id, $temp-index-id) + - $index[Type] = '*scpb.TemporaryIndex' - joinOnColumnID($index-column, $column, $table-id, $column-id) - - $column-target[TargetStatus] = PUBLIC - - $temp-index-target[TargetStatus] = TRANSIENT_ABSENT + - columnInIndex($index-column, $index, $table-id, $column-id, $index-id) + - toPublicOrTransient($column-target, $index-target) - $column-node[CurrentStatus] = DELETE_ONLY - - $temp-index-node[CurrentStatus] = DELETE_ONLY + - $index-node[CurrentStatus] = DELETE_ONLY - joinTargetNode($column, $column-target, $column-node) - - joinTargetNode($temp-index, $temp-index-target, $temp-index-node) + - joinTargetNode($index, $index-target, $index-node) - name: column is WRITE_ONLY before temporary index is WRITE_ONLY from: column-node kind: Precedence @@ -150,57 +125,84 @@ deprules - $index[Type] = '*scpb.TemporaryIndex' - joinOnColumnID($index-column, $column, $table-id, $column-id) - columnInIndex($index-column, $index, $table-id, $column-id, $index-id) - - $column-target[TargetStatus] = PUBLIC - - $index-target[TargetStatus] = TRANSIENT_ABSENT + - toPublicOrTransient($column-target, $index-target) - $column-node[CurrentStatus] = WRITE_ONLY - $index-node[CurrentStatus] = WRITE_ONLY - joinTargetNode($column, $column-target, $column-node) - joinTargetNode($index, $index-target, $index-node) -- name: column name and type to public after all index column to public - from: column-name-or-type-node - kind: Precedence - to: index-column-node +- name: column name and type set right after column existence + from: column-node + kind: SameStagePrecedence + to: column-name-or-type-node query: + - $column[Type] = '*scpb.Column' - $column-name-or-type[Type] IN ['*scpb.ColumnName', '*scpb.ColumnType'] - - $index-column[Type] = '*scpb.IndexColumn' - - joinOnColumnID($column-name-or-type, $index-column, $table-id, $column-id) - - toPublic($column-name-or-type-target, $index-column-target) + - toPublicOrTransient($column-target, $column-name-or-type-target) + - $column-node[CurrentStatus] = DELETE_ONLY - $column-name-or-type-node[CurrentStatus] = PUBLIC - - $index-column-node[CurrentStatus] = PUBLIC + - joinOnColumnID($column, $column-name-or-type, $table-id, $col-id) + - joinTargetNode($column, $column-target, $column-node) - joinTargetNode($column-name-or-type, $column-name-or-type-target, $column-name-or-type-node) - - joinTargetNode($index-column, $index-column-target, $index-column-node) -- name: column name set right after column existence +- name: column no longer public before dependents from: column-node - kind: SameStagePrecedence - to: column-name-node + kind: Precedence + to: dependent-node query: - $column[Type] = '*scpb.Column' - - $column-name[Type] = '*scpb.ColumnName' - - toPublic($column-target, $column-name-target) - - $column-node[CurrentStatus] = DELETE_ONLY - - $column-name-node[CurrentStatus] = PUBLIC - - joinOnColumnID($column, $column-name, $table-id, $col-id) + - $dependent[Type] IN ['*scpb.ColumnName', '*scpb.ColumnType', '*scpb.ColumnDefaultExpression', '*scpb.ColumnOnUpdateExpression', '*scpb.SequenceOwner', '*scpb.ColumnComment', '*scpb.IndexColumn'] + - joinOnColumnID($column, $dependent, $table-id, $col-id) + - toAbsent($column-target, $dependent-target) + - $column-node[CurrentStatus] = WRITE_ONLY + - $dependent-node[CurrentStatus] = ABSENT - joinTargetNode($column, $column-target, $column-node) - - joinTargetNode($column-name, $column-name-target, $column-name-node) -- name: column named before column type becomes public - from: column-name-node + - joinTargetNode($dependent, $dependent-target, $dependent-node) +- name: column no longer public before dependents + from: column-node kind: Precedence - to: column-type-node + to: dependent-node query: - - $column-name[Type] = '*scpb.ColumnName' - - $column-type[Type] = '*scpb.ColumnType' - - joinOnColumnID($column-name, $column-type, $table-id, $col-id) - - toPublic($column-name-target, $column-type-target) - - $column-name-node[CurrentStatus] = PUBLIC - - $column-type-node[CurrentStatus] = PUBLIC - - joinTargetNode($column-name, $column-name-target, $column-name-node) - - joinTargetNode($column-type, $column-type-target, $column-type-node) + - $column[Type] = '*scpb.Column' + - $dependent[Type] IN ['*scpb.ColumnName', '*scpb.ColumnType', '*scpb.ColumnDefaultExpression', '*scpb.ColumnOnUpdateExpression', '*scpb.SequenceOwner', '*scpb.ColumnComment', '*scpb.IndexColumn'] + - joinOnColumnID($column, $dependent, $table-id, $col-id) + - $column-target[TargetStatus] = ABSENT + - $column-node[CurrentStatus] = WRITE_ONLY + - $dependent-target[TargetStatus] = TRANSIENT_ABSENT + - $dependent-node[CurrentStatus] = TRANSIENT_ABSENT + - joinTargetNode($column, $column-target, $column-node) + - joinTargetNode($dependent, $dependent-target, $dependent-node) +- name: column no longer public before dependents + from: column-node + kind: Precedence + to: dependent-node + query: + - $column[Type] = '*scpb.Column' + - $dependent[Type] IN ['*scpb.ColumnName', '*scpb.ColumnType', '*scpb.ColumnDefaultExpression', '*scpb.ColumnOnUpdateExpression', '*scpb.SequenceOwner', '*scpb.ColumnComment', '*scpb.IndexColumn'] + - joinOnColumnID($column, $dependent, $table-id, $col-id) + - $column-target[TargetStatus] = TRANSIENT_ABSENT + - $column-node[CurrentStatus] = TRANSIENT_WRITE_ONLY + - $dependent-target[TargetStatus] = ABSENT + - $dependent-node[CurrentStatus] = ABSENT + - joinTargetNode($column, $column-target, $column-node) + - joinTargetNode($dependent, $dependent-target, $dependent-node) +- name: column no longer public before dependents + from: column-node + kind: Precedence + to: dependent-node + query: + - $column[Type] = '*scpb.Column' + - $dependent[Type] IN ['*scpb.ColumnName', '*scpb.ColumnType', '*scpb.ColumnDefaultExpression', '*scpb.ColumnOnUpdateExpression', '*scpb.SequenceOwner', '*scpb.ColumnComment', '*scpb.IndexColumn'] + - joinOnColumnID($column, $dependent, $table-id, $col-id) + - transient($column-target, $dependent-target) + - $column-node[CurrentStatus] = TRANSIENT_WRITE_ONLY + - $dependent-node[CurrentStatus] = TRANSIENT_ABSENT + - joinTargetNode($column, $column-target, $column-node) + - joinTargetNode($dependent, $dependent-target, $dependent-node) - name: column type dependents removed right before column type from: dependent-node kind: SameStagePrecedence to: column-type-node query: - - $dependent[Type] IN ['*scpb.SequenceOwner', '*scpb.ColumnDefaultExpression', '*scpb.ColumnOnUpdateExpression'] + - $dependent[Type] IN ['*scpb.ColumnDefaultExpression', '*scpb.ColumnOnUpdateExpression', '*scpb.SequenceOwner'] - $column-type[Type] = '*scpb.ColumnType' - joinOnColumnID($dependent, $column-type, $table-id, $col-id) - toAbsent($dependent-target, $column-type-target) @@ -219,28 +221,43 @@ deprules - toAbsent($column-type-target, $column-target) - $column-type-node[CurrentStatus] = ABSENT - $column-node[CurrentStatus] = ABSENT - - RelationIsNotBeingDropped(*scpb.ColumnType)($column-type) + - relationIsNotBeingDropped(*scpb.ColumnType)($column-type) - joinTargetNode($column-type, $column-type-target, $column-type-node) - joinTargetNode($column, $column-target, $column-node) -- name: comment existence precedes index becoming public - from: child-node +- name: dependents removed before column + from: dependent-node kind: Precedence - to: index-node + to: column-node query: - - $child[Type] = '*scpb.IndexComment' - - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex'] - - joinOnIndexID($child, $index, $table-id, $index-id) - - toPublic($child-target, $index-target) - - $child-node[CurrentStatus] = PUBLIC - - $index-node[CurrentStatus] = PUBLIC - - joinTargetNode($child, $child-target, $child-node) - - joinTargetNode($index, $index-target, $index-node) + - $dependent[Type] IN ['*scpb.ColumnName', '*scpb.ColumnType', '*scpb.ColumnDefaultExpression', '*scpb.ColumnOnUpdateExpression', '*scpb.SequenceOwner', '*scpb.ColumnComment', '*scpb.IndexColumn'] + - $column[Type] = '*scpb.Column' + - joinOnColumnID($dependent, $column, $table-id, $col-id) + - $dependent-target[TargetStatus] = ABSENT + - $dependent-node[CurrentStatus] = ABSENT + - $column-target[TargetStatus] = TRANSIENT_ABSENT + - $column-node[CurrentStatus] = TRANSIENT_ABSENT + - joinTargetNode($dependent, $dependent-target, $dependent-node) + - joinTargetNode($column, $column-target, $column-node) - name: dependents removed before column from: dependent-node kind: Precedence to: column-node query: - - $dependent[Type] IN ['*scpb.ColumnName', '*scpb.ColumnType', '*scpb.ColumnComment'] + - $dependent[Type] IN ['*scpb.ColumnName', '*scpb.ColumnType', '*scpb.ColumnDefaultExpression', '*scpb.ColumnOnUpdateExpression', '*scpb.SequenceOwner', '*scpb.ColumnComment', '*scpb.IndexColumn'] + - $column[Type] = '*scpb.Column' + - joinOnColumnID($dependent, $column, $table-id, $col-id) + - $dependent-target[TargetStatus] = TRANSIENT_ABSENT + - $dependent-node[CurrentStatus] = TRANSIENT_ABSENT + - $column-target[TargetStatus] = ABSENT + - $column-node[CurrentStatus] = ABSENT + - joinTargetNode($dependent, $dependent-target, $dependent-node) + - joinTargetNode($column, $column-target, $column-node) +- name: dependents removed before column + from: dependent-node + kind: Precedence + to: column-node + query: + - $dependent[Type] IN ['*scpb.ColumnName', '*scpb.ColumnType', '*scpb.ColumnDefaultExpression', '*scpb.ColumnOnUpdateExpression', '*scpb.SequenceOwner', '*scpb.ColumnComment', '*scpb.IndexColumn'] - $column[Type] = '*scpb.Column' - joinOnColumnID($dependent, $column, $table-id, $col-id) - toAbsent($dependent-target, $column-target) @@ -248,6 +265,19 @@ deprules - $column-node[CurrentStatus] = ABSENT - joinTargetNode($dependent, $dependent-target, $dependent-node) - joinTargetNode($column, $column-target, $column-node) +- name: dependents removed before column + from: dependent-node + kind: Precedence + to: column-node + query: + - $dependent[Type] IN ['*scpb.ColumnName', '*scpb.ColumnType', '*scpb.ColumnDefaultExpression', '*scpb.ColumnOnUpdateExpression', '*scpb.SequenceOwner', '*scpb.ColumnComment', '*scpb.IndexColumn'] + - $column[Type] = '*scpb.Column' + - joinOnColumnID($dependent, $column, $table-id, $col-id) + - transient($dependent-target, $column-target) + - $dependent-node[CurrentStatus] = TRANSIENT_ABSENT + - $column-node[CurrentStatus] = TRANSIENT_ABSENT + - joinTargetNode($dependent, $dependent-target, $dependent-node) + - joinTargetNode($column, $column-target, $column-node) - name: dependents removed before index from: dependent-node kind: Precedence @@ -261,6 +291,47 @@ deprules - $index-node[CurrentStatus] = ABSENT - joinTargetNode($dependent, $dependent-target, $dependent-node) - joinTargetNode($index, $index-target, $index-node) +- name: dependents removed before index + from: dependent-node + kind: Precedence + to: index-node + query: + - $dependent[Type] IN ['*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.SecondaryIndexPartial', '*scpb.IndexComment', '*scpb.IndexColumn'] + - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] + - joinOnIndexID($dependent, $index, $table-id, $index-id) + - transient($dependent-target, $index-target) + - $dependent-node[CurrentStatus] = TRANSIENT_ABSENT + - $index-node[CurrentStatus] = TRANSIENT_ABSENT + - joinTargetNode($dependent, $dependent-target, $dependent-node) + - joinTargetNode($index, $index-target, $index-node) +- name: dependents removed before index + from: dependent-node + kind: Precedence + to: index-node + query: + - $dependent[Type] IN ['*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.SecondaryIndexPartial', '*scpb.IndexComment', '*scpb.IndexColumn'] + - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] + - joinOnIndexID($dependent, $index, $table-id, $index-id) + - $dependent-target[TargetStatus] = TRANSIENT_ABSENT + - $dependent-node[CurrentStatus] = TRANSIENT_ABSENT + - $index-target[TargetStatus] = ABSENT + - $index-node[CurrentStatus] = ABSENT + - joinTargetNode($dependent, $dependent-target, $dependent-node) + - joinTargetNode($index, $index-target, $index-node) +- name: dependents removed before index + from: dependent-node + kind: Precedence + to: index-node + query: + - $dependent[Type] IN ['*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.SecondaryIndexPartial', '*scpb.IndexComment', '*scpb.IndexColumn'] + - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] + - joinOnIndexID($dependent, $index, $table-id, $index-id) + - $dependent-target[TargetStatus] = ABSENT + - $dependent-node[CurrentStatus] = ABSENT + - $index-target[TargetStatus] = TRANSIENT_ABSENT + - $index-node[CurrentStatus] = TRANSIENT_ABSENT + - joinTargetNode($dependent, $dependent-target, $dependent-node) + - joinTargetNode($index, $index-target, $index-node) - name: descriptor drop right before dependent element removal from: descriptor-node kind: SameStagePrecedence @@ -334,26 +405,39 @@ deprules - $later-column[Type] = '*scpb.Column' - $earlier-column[Type] = '*scpb.Column' - joinOnDescID($later-column, $earlier-column, $table-id) - - toPublic($later-column-target, $earlier-column-target) + - toPublicOrTransient($later-column-target, $earlier-column-target) - $status IN [WRITE_ONLY, PUBLIC] - $later-column-node[CurrentStatus] = $status - $earlier-column-node[CurrentStatus] = $status - SmallerColumnIDFirst(*scpb.Column, *scpb.Column)($later-column, $earlier-column) - joinTargetNode($later-column, $later-column-target, $later-column-node) - joinTargetNode($earlier-column, $earlier-column-target, $earlier-column-node) -- name: index existence precedes index name and comment +- name: index dependents exist before index becomes public + from: dependent-node + kind: Precedence + to: index-node + query: + - $dependent[Type] IN ['*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.SecondaryIndexPartial', '*scpb.IndexComment', '*scpb.IndexColumn'] + - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] + - joinOnIndexID($dependent, $index, $table-id, $index-id) + - toPublicOrTransient($dependent-target, $index-target) + - $dependent-node[CurrentStatus] = PUBLIC + - $index-node[CurrentStatus] = PUBLIC + - joinTargetNode($dependent, $dependent-target, $dependent-node) + - joinTargetNode($index, $index-target, $index-node) +- name: index existence precedes index dependents from: index-node kind: Precedence - to: index-dependent-node + to: dependent-node query: - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex'] - - $index-dependent[Type] IN ['*scpb.IndexName', '*scpb.IndexComment'] - - joinOnIndexID($index, $index-dependent, $table-id, $index-id) - - toPublic($index-target, $index-dependent-target) + - $dependent[Type] IN ['*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.SecondaryIndexPartial', '*scpb.IndexComment', '*scpb.IndexColumn'] + - joinOnIndexID($index, $dependent, $table-id, $index-id) + - toPublicOrTransient($index-target, $dependent-target) - $index-node[CurrentStatus] = BACKFILL_ONLY - - $index-dependent-node[CurrentStatus] = PUBLIC + - $dependent-node[CurrentStatus] = PUBLIC - joinTargetNode($index, $index-target, $index-node) - - joinTargetNode($index-dependent, $index-dependent-target, $index-dependent-node) + - joinTargetNode($dependent, $dependent-target, $dependent-node) - name: index named right before index becomes public from: index-name-node kind: SameStagePrecedence @@ -361,52 +445,66 @@ deprules query: - $index-name[Type] = '*scpb.IndexName' - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex'] - - toPublic($index-name-target, $index-target) + - joinOnIndexID($index-name, $index, $table-id, $index-id) + - toPublicOrTransient($index-name-target, $index-target) - $index-name-node[CurrentStatus] = PUBLIC - $index-node[CurrentStatus] = PUBLIC - - joinOnIndexID($index-name, $index, $table-id, $index-id) - joinTargetNode($index-name, $index-name-target, $index-name-node) - joinTargetNode($index, $index-target, $index-node) -- name: index no longer public before dependents removed +- name: index no longer public before dependents from: index-node kind: Precedence - to: child-node + to: dependent-node query: - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - - $child[Type] IN ['*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.SecondaryIndexPartial', '*scpb.IndexComment', '*scpb.IndexColumn'] - - joinOnIndexID($index, $child, $table-id, $index-id) - - toAbsent($index-target, $child-target) - - $index-node[CurrentStatus] = VALIDATED - - $child-node[CurrentStatus] = ABSENT + - $dependent[Type] IN ['*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.SecondaryIndexPartial', '*scpb.IndexComment', '*scpb.IndexColumn'] + - joinOnIndexID($index, $dependent, $table-id, $index-id) + - transient($index-target, $dependent-target) + - $index-node[CurrentStatus] = TRANSIENT_VALIDATED + - $dependent-node[CurrentStatus] = TRANSIENT_ABSENT - joinTargetNode($index, $index-target, $index-node) - - joinTargetNode($child, $child-target, $child-node) -- name: index-column added to index after index exists + - joinTargetNode($dependent, $dependent-target, $dependent-node) +- name: index no longer public before dependents from: index-node kind: Precedence - to: index-column-node + to: dependent-node query: - - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex'] - - $index-column[Type] = '*scpb.IndexColumn' - - joinOnIndexID($index, $index-column, $table-id, $index-id) - - toPublic($index-target, $index-column-target) - - $index-node[CurrentStatus] = BACKFILL_ONLY - - $index-column-node[CurrentStatus] = PUBLIC + - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] + - $dependent[Type] IN ['*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.SecondaryIndexPartial', '*scpb.IndexComment', '*scpb.IndexColumn'] + - joinOnIndexID($index, $dependent, $table-id, $index-id) + - $index-target[TargetStatus] = TRANSIENT_ABSENT + - $index-node[CurrentStatus] = TRANSIENT_VALIDATED + - $dependent-target[TargetStatus] = ABSENT + - $dependent-node[CurrentStatus] = ABSENT - joinTargetNode($index, $index-target, $index-node) - - joinTargetNode($index-column, $index-column-target, $index-column-node) -- name: index-column added to index after temp index exists + - joinTargetNode($dependent, $dependent-target, $dependent-node) +- name: index no longer public before dependents from: index-node kind: Precedence - to: index-column-node + to: dependent-node query: - - $index[Type] = '*scpb.TemporaryIndex' - - $index-column[Type] = '*scpb.IndexColumn' - - joinOnIndexID($index, $index-column, $table-id, $index-id) - - $index-target[TargetStatus] = TRANSIENT_ABSENT - - $index-column-target[TargetStatus] = PUBLIC - - $index-node[CurrentStatus] = DELETE_ONLY - - $index-column-node[CurrentStatus] = PUBLIC + - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] + - $dependent[Type] IN ['*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.SecondaryIndexPartial', '*scpb.IndexComment', '*scpb.IndexColumn'] + - joinOnIndexID($index, $dependent, $table-id, $index-id) + - $index-target[TargetStatus] = ABSENT + - $index-node[CurrentStatus] = VALIDATED + - $dependent-target[TargetStatus] = TRANSIENT_ABSENT + - $dependent-node[CurrentStatus] = TRANSIENT_ABSENT - joinTargetNode($index, $index-target, $index-node) - - joinTargetNode($index-column, $index-column-target, $index-column-node) + - joinTargetNode($dependent, $dependent-target, $dependent-node) +- name: index no longer public before dependents + from: index-node + kind: Precedence + to: dependent-node + query: + - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] + - $dependent[Type] IN ['*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.SecondaryIndexPartial', '*scpb.IndexComment', '*scpb.IndexColumn'] + - joinOnIndexID($index, $dependent, $table-id, $index-id) + - toAbsent($index-target, $dependent-target) + - $index-node[CurrentStatus] = VALIDATED + - $dependent-node[CurrentStatus] = ABSENT + - joinTargetNode($index, $index-target, $index-node) + - joinTargetNode($dependent, $dependent-target, $dependent-node) - name: index-column added to index before index is backfilled from: index-column-node kind: Precedence @@ -415,7 +513,7 @@ deprules - $index-column[Type] = '*scpb.IndexColumn' - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex'] - joinOnIndexID($index-column, $index, $table-id, $index-id) - - toPublic($index-column-target, $index-target) + - toPublicOrTransient($index-column-target, $index-target) - $index-column-node[CurrentStatus] = PUBLIC - $index-node[CurrentStatus] = BACKFILLED - joinTargetNode($index-column, $index-column-target, $index-column-node) @@ -428,13 +526,30 @@ deprules - $index-column[Type] = '*scpb.IndexColumn' - $index[Type] = '*scpb.TemporaryIndex' - joinOnIndexID($index-column, $index, $table-id, $index-id) - - $index-column-target[TargetStatus] = PUBLIC - - $index-target[TargetStatus] = TRANSIENT_ABSENT + - transient($index-column-target, $index-target) - $index-column-node[CurrentStatus] = PUBLIC - $index-node[CurrentStatus] = WRITE_ONLY - joinTargetNode($index-column, $index-column-target, $index-column-node) - joinTargetNode($index, $index-target, $index-node) -- name: indexes containing columns reach absent before column +- name: indexes containing column reach absent before column + from: index-node + kind: Precedence + to: column-node + query: + - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex'] + - $column[Type] = '*scpb.Column' + - $column-type[Type] = '*scpb.ColumnType' + - columnInIndex($index-column, $index, $table-id, $column-id, $index-id) + - joinOnColumnID($index-column, $column, $table-id, $column-id) + - joinOnColumnID($index-column, $column-type, $table-id, $column-id) + - relationIsNotBeingDropped(*scpb.ColumnType)($column-type) + - $index-target[TargetStatus] = ABSENT + - $index-node[CurrentStatus] = ABSENT + - $column-target[TargetStatus] = TRANSIENT_ABSENT + - $column-node[CurrentStatus] = TRANSIENT_ABSENT + - joinTargetNode($index, $index-target, $index-node) + - joinTargetNode($column, $column-target, $column-node) +- name: indexes containing column reach absent before column from: index-node kind: Precedence to: column-node @@ -445,10 +560,45 @@ deprules - columnInIndex($index-column, $index, $table-id, $column-id, $index-id) - joinOnColumnID($index-column, $column, $table-id, $column-id) - joinOnColumnID($index-column, $column-type, $table-id, $column-id) + - relationIsNotBeingDropped(*scpb.ColumnType)($column-type) + - $index-target[TargetStatus] = TRANSIENT_ABSENT + - $index-node[CurrentStatus] = TRANSIENT_ABSENT + - $column-target[TargetStatus] = ABSENT + - $column-node[CurrentStatus] = ABSENT + - joinTargetNode($index, $index-target, $index-node) + - joinTargetNode($column, $column-target, $column-node) +- name: indexes containing column reach absent before column + from: index-node + kind: Precedence + to: column-node + query: + - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex'] + - $column[Type] = '*scpb.Column' + - $column-type[Type] = '*scpb.ColumnType' + - columnInIndex($index-column, $index, $table-id, $column-id, $index-id) + - joinOnColumnID($index-column, $column, $table-id, $column-id) + - joinOnColumnID($index-column, $column-type, $table-id, $column-id) + - relationIsNotBeingDropped(*scpb.ColumnType)($column-type) + - transient($index-target, $column-target) + - $index-node[CurrentStatus] = TRANSIENT_ABSENT + - $column-node[CurrentStatus] = TRANSIENT_ABSENT + - joinTargetNode($index, $index-target, $index-node) + - joinTargetNode($column, $column-target, $column-node) +- name: indexes containing column reach absent before column + from: index-node + kind: Precedence + to: column-node + query: + - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex'] + - $column[Type] = '*scpb.Column' + - $column-type[Type] = '*scpb.ColumnType' + - columnInIndex($index-column, $index, $table-id, $column-id, $index-id) + - joinOnColumnID($index-column, $column, $table-id, $column-id) + - joinOnColumnID($index-column, $column-type, $table-id, $column-id) + - relationIsNotBeingDropped(*scpb.ColumnType)($column-type) - toAbsent($index-target, $column-target) - $index-node[CurrentStatus] = ABSENT - $column-node[CurrentStatus] = ABSENT - - RelationIsNotBeingDropped(*scpb.ColumnType)($column-type) - joinTargetNode($index, $index-target, $index-node) - joinTargetNode($column, $column-target, $column-node) - name: partial predicate removed right before secondary index when not dropping relation @@ -459,26 +609,72 @@ deprules - $partial-predicate[Type] = '*scpb.SecondaryIndexPartial' - $index[Type] = '*scpb.SecondaryIndex' - joinOnIndexID($partial-predicate, $index, $table-id, $index-id) + - relationIsNotBeingDropped(*scpb.SecondaryIndexPartial)($partial-predicate) + - $partial-predicate-target[TargetStatus] = ABSENT + - $partial-predicate-node[CurrentStatus] = ABSENT + - $index-target[TargetStatus] = TRANSIENT_ABSENT + - $index-node[CurrentStatus] = TRANSIENT_ABSENT + - joinTargetNode($partial-predicate, $partial-predicate-target, $partial-predicate-node) + - joinTargetNode($index, $index-target, $index-node) +- name: partial predicate removed right before secondary index when not dropping relation + from: partial-predicate-node + kind: SameStagePrecedence + to: index-node + query: + - $partial-predicate[Type] = '*scpb.SecondaryIndexPartial' + - $index[Type] = '*scpb.SecondaryIndex' + - joinOnIndexID($partial-predicate, $index, $table-id, $index-id) + - relationIsNotBeingDropped(*scpb.SecondaryIndexPartial)($partial-predicate) + - $partial-predicate-target[TargetStatus] = TRANSIENT_ABSENT + - $partial-predicate-node[CurrentStatus] = TRANSIENT_ABSENT + - $index-target[TargetStatus] = ABSENT + - $index-node[CurrentStatus] = ABSENT + - joinTargetNode($partial-predicate, $partial-predicate-target, $partial-predicate-node) + - joinTargetNode($index, $index-target, $index-node) +- name: partial predicate removed right before secondary index when not dropping relation + from: partial-predicate-node + kind: SameStagePrecedence + to: index-node + query: + - $partial-predicate[Type] = '*scpb.SecondaryIndexPartial' + - $index[Type] = '*scpb.SecondaryIndex' + - joinOnIndexID($partial-predicate, $index, $table-id, $index-id) + - relationIsNotBeingDropped(*scpb.SecondaryIndexPartial)($partial-predicate) - toAbsent($partial-predicate-target, $index-target) - $partial-predicate-node[CurrentStatus] = ABSENT - $index-node[CurrentStatus] = ABSENT - - RelationIsNotBeingDropped(*scpb.SecondaryIndexPartial)($partial-predicate) - joinTargetNode($partial-predicate, $partial-predicate-target, $partial-predicate-node) - joinTargetNode($index, $index-target, $index-node) -- name: primary index should be cleaned up before newly added column when reverting - from: index-node - kind: Precedence - to: column-node +- name: partial predicate removed right before secondary index when not dropping relation + from: partial-predicate-node + kind: SameStagePrecedence + to: index-node query: - - $index[Type] = '*scpb.PrimaryIndex' - - $column[Type] = '*scpb.Column' - - columnInPrimaryIndexSwap($index-column, $index, $table-id, $column-id, $index-id) - - joinOnColumnID($index-column, $column, $table-id, $column-id) - - toAbsent($index-target, $column-target) - - $index-node[CurrentStatus] = WRITE_ONLY - - $column-node[CurrentStatus] = WRITE_ONLY + - $partial-predicate[Type] = '*scpb.SecondaryIndexPartial' + - $index[Type] = '*scpb.SecondaryIndex' + - joinOnIndexID($partial-predicate, $index, $table-id, $index-id) + - relationIsNotBeingDropped(*scpb.SecondaryIndexPartial)($partial-predicate) + - transient($partial-predicate-target, $index-target) + - $partial-predicate-node[CurrentStatus] = TRANSIENT_ABSENT + - $index-node[CurrentStatus] = TRANSIENT_ABSENT + - joinTargetNode($partial-predicate, $partial-predicate-target, $partial-predicate-node) - joinTargetNode($index, $index-target, $index-node) - - joinTargetNode($column, $column-target, $column-node) +- name: primary index swap + from: new-index-node + kind: SameStagePrecedence + to: old-index-node + query: + - $new-index[Type] = '*scpb.PrimaryIndex' + - $old-index[Type] = '*scpb.PrimaryIndex' + - joinOnDescID($new-index, $old-index, $table-id) + - $new-index[SourceIndexID] = $old-index-id + - $old-index[IndexID] = $old-index-id + - $new-index-target[TargetStatus] = ABSENT + - $new-index-node[CurrentStatus] = VALIDATED + - $old-index-target[TargetStatus] = PUBLIC + - $old-index-node[CurrentStatus] = PUBLIC + - joinTargetNode($new-index, $new-index-target, $new-index-node) + - joinTargetNode($old-index, $old-index-target, $old-index-node) - name: primary index swap from: old-index-node kind: SameStagePrecedence @@ -487,110 +683,159 @@ deprules - $old-index[Type] = '*scpb.PrimaryIndex' - $new-index[Type] = '*scpb.PrimaryIndex' - joinOnDescID($old-index, $new-index, $table-id) + - $old-index[IndexID] = $old-index-id + - $new-index[SourceIndexID] = $old-index-id + - $old-index-target[TargetStatus] = TRANSIENT_ABSENT + - $old-index-node[CurrentStatus] = TRANSIENT_VALIDATED + - $new-index-target[TargetStatus] IN [PUBLIC, TRANSIENT_ABSENT] + - $new-index-node[CurrentStatus] = PUBLIC + - joinTargetNode($old-index, $old-index-target, $old-index-node) + - joinTargetNode($new-index, $new-index-target, $new-index-node) +- name: primary index swap + from: old-index-node + kind: SameStagePrecedence + to: new-index-node + query: + - $old-index[Type] = '*scpb.PrimaryIndex' + - $new-index[Type] = '*scpb.PrimaryIndex' + - joinOnDescID($old-index, $new-index, $table-id) + - $old-index[IndexID] = $old-index-id + - $new-index[SourceIndexID] = $old-index-id - $old-index-target[TargetStatus] = ABSENT - - $new-index-target[TargetStatus] = PUBLIC - $old-index-node[CurrentStatus] = VALIDATED + - $new-index-target[TargetStatus] IN [PUBLIC, TRANSIENT_ABSENT] - $new-index-node[CurrentStatus] = PUBLIC - - primaryIndexesDependency(*scpb.PrimaryIndex, *scpb.PrimaryIndex)($old-index, $new-index) - joinTargetNode($old-index, $old-index-target, $old-index-node) - joinTargetNode($new-index, $new-index-target, $new-index-node) - name: primary index with new columns should exist before secondary indexes from: primary-index-node kind: Precedence - to: second-index-node + to: secondary-index-node query: - $primary-index[Type] = '*scpb.PrimaryIndex' - - $second-index[Type] = '*scpb.SecondaryIndex' - - joinOnDescID($primary-index, $second-index, $table-id) + - $secondary-index[Type] = '*scpb.SecondaryIndex' + - joinOnDescID($primary-index, $secondary-index, $table-id) - $primary-index[IndexID] = $primary-index-id - - $second-index[SourceIndexID] = $primary-index-id - - toPublic($primary-index-target, $second-index-target) + - $secondary-index[SourceIndexID] = $primary-index-id + - toPublicOrTransient($primary-index-target, $secondary-index-target) - $primary-index-node[CurrentStatus] = PUBLIC - - $second-index-node[CurrentStatus] = BACKFILL_ONLY + - $secondary-index-node[CurrentStatus] = BACKFILL_ONLY - joinTargetNode($primary-index, $primary-index-target, $primary-index-node) - - joinTargetNode($second-index, $second-index-target, $second-index-node) + - joinTargetNode($secondary-index, $secondary-index-target, $secondary-index-node) - name: primary index with new columns should exist before temp indexes from: primary-index-node kind: Precedence - to: second-index-node + to: temp-index-node query: - $primary-index[Type] = '*scpb.PrimaryIndex' - - $second-index[Type] = '*scpb.TemporaryIndex' - - joinOnDescID($primary-index, $second-index, $table-id) + - $temp-index[Type] = '*scpb.TemporaryIndex' + - joinOnDescID($primary-index, $temp-index, $table-id) - $primary-index[IndexID] = $primary-index-id - - $second-index[SourceIndexID] = $primary-index-id - - $primary-index-target[TargetStatus] = PUBLIC - - $second-index-target[TargetStatus] = TRANSIENT_ABSENT + - $temp-index[SourceIndexID] = $primary-index-id + - toPublicOrTransient($primary-index-target, $temp-index-target) - $primary-index-node[CurrentStatus] = PUBLIC - - $second-index-node[CurrentStatus] = DELETE_ONLY + - $temp-index-node[CurrentStatus] = DELETE_ONLY - joinTargetNode($primary-index, $primary-index-target, $primary-index-node) - - joinTargetNode($second-index, $second-index-target, $second-index-node) -- name: secondary index columns removed before removing the index - from: index-column-node + - joinTargetNode($temp-index, $temp-index-target, $temp-index-node) +- name: remove columns from index right before removing index + from: index-node kind: Precedence - to: index-node + to: index-column-node query: - - $index-column[Type] = '*scpb.IndexColumn' - - $index[Type] = '*scpb.SecondaryIndex' - - joinOnIndexID($index-column, $index, $table-id, $index-id) - - toAbsent($index-column-target, $index-target) + - $index[Type] = '*scpb.IndexColumn' + - $index-column[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] + - joinOnIndexID($index, $index-column, $table-id, $index-id) + - $index-target[TargetStatus] = ABSENT + - $index-node[CurrentStatus] = DELETE_ONLY + - $index-column-target[TargetStatus] = TRANSIENT_ABSENT + - $index-column-node[CurrentStatus] = TRANSIENT_ABSENT + - joinTargetNode($index, $index-target, $index-node) + - joinTargetNode($index-column, $index-column-target, $index-column-node) +- name: remove columns from index right before removing index + from: index-node + kind: Precedence + to: index-column-node + query: + - $index[Type] = '*scpb.IndexColumn' + - $index-column[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] + - joinOnIndexID($index, $index-column, $table-id, $index-id) + - $index-target[TargetStatus] = TRANSIENT_ABSENT + - $index-node[CurrentStatus] = TRANSIENT_DELETE_ONLY + - $index-column-target[TargetStatus] = ABSENT - $index-column-node[CurrentStatus] = ABSENT - - $index-node[CurrentStatus] = ABSENT + - joinTargetNode($index, $index-target, $index-node) - joinTargetNode($index-column, $index-column-target, $index-column-node) +- name: remove columns from index right before removing index + from: index-node + kind: Precedence + to: index-column-node + query: + - $index[Type] = '*scpb.IndexColumn' + - $index-column[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] + - joinOnIndexID($index, $index-column, $table-id, $index-id) + - transient($index-target, $index-column-target) + - $index-node[CurrentStatus] = TRANSIENT_DELETE_ONLY + - $index-column-node[CurrentStatus] = TRANSIENT_ABSENT - joinTargetNode($index, $index-target, $index-node) -- name: secondary index in DELETE_ONLY before removing columns + - joinTargetNode($index-column, $index-column-target, $index-column-node) +- name: remove columns from index right before removing index from: index-node kind: Precedence to: index-column-node query: - - $index[Type] = '*scpb.SecondaryIndex' - - $index-column[Type] = '*scpb.IndexColumn' + - $index[Type] = '*scpb.IndexColumn' + - $index-column[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - joinOnIndexID($index, $index-column, $table-id, $index-id) - toAbsent($index-target, $index-column-target) - $index-node[CurrentStatus] = DELETE_ONLY - $index-column-node[CurrentStatus] = ABSENT - joinTargetNode($index, $index-target, $index-node) - joinTargetNode($index-column, $index-column-target, $index-column-node) -- name: temp index columns removed before removing the index - from: index-column-node +- name: secondary indexes containing column as key reach write-only before column + from: index-node kind: Precedence - to: index-node + to: column-node query: - - $index-column[Type] = '*scpb.IndexColumn' - - $index[Type] = '*scpb.TemporaryIndex' - - joinOnIndexID($index-column, $index, $table-id, $index-id) - - toAbsent($index-column-target, $index-target) - - $index-column-node[CurrentStatus] = ABSENT - - $index-node[CurrentStatus] = TRANSIENT_ABSENT - - joinTargetNode($index-column, $index-column-target, $index-column-node) + - $index[Type] = '*scpb.SecondaryIndex' + - $column[Type] = '*scpb.Column' + - columnInIndex($index-column, $index, $table-id, $column-id, $index-id) + - joinOnColumnID($index-column, $column, $table-id, $column-id) + - toAbsent($index-target, $column-target) + - $index-node[CurrentStatus] = VALIDATED + - $column-node[CurrentStatus] = WRITE_ONLY + - $column-type[Type] = '*scpb.ColumnType' + - joinOnColumnID($index-column, $column-type, $table-id, $column-id) + - relationIsNotBeingDropped(*scpb.ColumnType)($column-type) + - isIndexKeyColumnKey(*scpb.IndexColumn)($index-column) - joinTargetNode($index, $index-target, $index-node) -- name: temp index exists before columns, partitioning, and partial - from: temp-index-node + - joinTargetNode($column, $column-target, $column-node) +- name: swapped primary index public before column + from: index-node kind: Precedence - to: index-partitioning-node + to: column-node query: - - $temp-index[Type] = '*scpb.TemporaryIndex' - - $index-partitioning[Type] IN ['*scpb.IndexColumn', '*scpb.IndexPartitioning', '*scpb.SecondaryIndexPartial'] - - joinOnIndexID($temp-index, $index-partitioning, $table-id, $index-id) - - $temp-index-target[TargetStatus] = TRANSIENT_ABSENT - - $index-partitioning-target[TargetStatus] = PUBLIC - - $temp-index-node[CurrentStatus] = DELETE_ONLY - - $index-partitioning-node[CurrentStatus] = PUBLIC - - joinTargetNode($temp-index, $temp-index-target, $temp-index-node) - - joinTargetNode($index-partitioning, $index-partitioning-target, $index-partitioning-node) -- name: temp index in DELETE_ONLY before removing columns + - $index[Type] = '*scpb.PrimaryIndex' + - $column[Type] = '*scpb.Column' + - columnInPrimaryIndexSwap($index-column, $index, $table-id, $column-id, $index-id) + - joinOnColumnID($index-column, $column, $table-id, $column-id) + - toPublicOrTransient($index-target, $column-target) + - $index-node[CurrentStatus] = PUBLIC + - $column-node[CurrentStatus] = PUBLIC + - joinTargetNode($index, $index-target, $index-node) + - joinTargetNode($column, $column-target, $column-node) +- name: temp index existence precedes index dependents from: index-node kind: Precedence - to: index-column-node + to: dependent-node query: - $index[Type] = '*scpb.TemporaryIndex' - - $index-column[Type] = '*scpb.IndexColumn' - - joinOnIndexID($index, $index-column, $table-id, $index-id) - - toAbsent($index-target, $index-column-target) - - $index-node[CurrentStatus] = TRANSIENT_DELETE_ONLY - - $index-column-node[CurrentStatus] = ABSENT + - $dependent[Type] IN ['*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.SecondaryIndexPartial', '*scpb.IndexComment', '*scpb.IndexColumn'] + - joinOnIndexID($index, $dependent, $table-id, $index-id) + - toPublicOrTransient($index-target, $dependent-target) + - $index-node[CurrentStatus] = DELETE_ONLY + - $dependent-node[CurrentStatus] = PUBLIC - joinTargetNode($index, $index-target, $index-node) - - joinTargetNode($index-column, $index-column-target, $index-column-node) + - joinTargetNode($dependent, $dependent-target, $dependent-node) - name: temp index is WRITE_ONLY before backfill from: temp-node kind: Precedence @@ -602,22 +847,8 @@ deprules - $temp[IndexID] = $temp-index-id - $index[TemporaryIndexID] = $temp-index-id - $temp-target[TargetStatus] = TRANSIENT_ABSENT - - $index-target[TargetStatus] = PUBLIC + - $index-target[TargetStatus] IN [PUBLIC, TRANSIENT_ABSENT] - $temp-node[CurrentStatus] = WRITE_ONLY - $index-node[CurrentStatus] = BACKFILLED - joinTargetNode($temp, $temp-target, $temp-node) - joinTargetNode($index, $index-target, $index-node) -- name: temp indexes reach absent at the same time as other indexes - from: index-a-node - kind: SameStagePrecedence - to: index-b-node - query: - - $index-a[Type] = '*scpb.TemporaryIndex' - - $index-b[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex'] - - joinOnDescID($index-a, $index-b, $desc-id) - - $index-a-target[TargetStatus] = TRANSIENT_ABSENT - - $index-b-target[TargetStatus] = ABSENT - - $index-a-node[CurrentStatus] = TRANSIENT_ABSENT - - $index-b-node[CurrentStatus] = ABSENT - - joinTargetNode($index-a, $index-a-target, $index-a-node) - - joinTargetNode($index-b, $index-b-target, $index-b-node) diff --git a/pkg/sql/schemachanger/scplan/internal/rules/testdata/oprules b/pkg/sql/schemachanger/scplan/internal/rules/testdata/oprules index 5dedd93249b7..9cf9a1318091 100644 --- a/pkg/sql/schemachanger/scplan/internal/rules/testdata/oprules +++ b/pkg/sql/schemachanger/scplan/internal/rules/testdata/oprules @@ -40,9 +40,12 @@ sourceIndexNotSet(index): toAbsent(target1, target2): - $target1[TargetStatus] = ABSENT - $target2[TargetStatus] = ABSENT -toPublic(target1, target2): - - $target1[TargetStatus] = PUBLIC - - $target2[TargetStatus] = PUBLIC +toPublicOrTransient(target1, target2): + - $target1[TargetStatus] IN [PUBLIC, TRANSIENT_ABSENT] + - $target2[TargetStatus] IN [PUBLIC, TRANSIENT_ABSENT] +transient(target1, target2): + - $target1[TargetStatus] = TRANSIENT_ABSENT + - $target2[TargetStatus] = TRANSIENT_ABSENT oprules ---- @@ -129,6 +132,17 @@ oprules - $relation-target[TargetStatus] = ABSENT - joinTargetNode($index, $index-target, $index-node) - $index-target[TargetStatus] = ABSENT +- name: skip index-column removal ops on index removal + from: index-column-node + query: + - $index-column[Type] = '*scpb.IndexColumn' + - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] + - joinOnIndexID($index-column, $index, $relation-id, $index-id) + - joinTargetNode($index-column, $index-column-target, $index-column-node) + - $index-column-target[TargetStatus] IN [ABSENT, TRANSIENT_ABSENT] + - $index-column-node[CurrentStatus] IN [PUBLIC, TRANSIENT_PUBLIC] + - joinTarget($index, $index-target) + - $index-target[TargetStatus] IN [ABSENT, TRANSIENT_ABSENT] - name: skip table comment removal ops on descriptor drop from: dep-node query: diff --git a/pkg/sql/schemachanger/scplan/testdata/alter_table_add_column b/pkg/sql/schemachanger/scplan/testdata/alter_table_add_column index dacc4f778dfb..719beadaddeb 100644 --- a/pkg/sql/schemachanger/scplan/testdata/alter_table_add_column +++ b/pkg/sql/schemachanger/scplan/testdata/alter_table_add_column @@ -144,8 +144,8 @@ StatementPhase stage 1 of 1 with 11 MutationType ops [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2}, PUBLIC], ABSENT] -> PUBLIC [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2}, PUBLIC], ABSENT] -> PUBLIC [[TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], ABSENT] -> DELETE_ONLY - [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, PUBLIC], ABSENT] -> PUBLIC - [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, PUBLIC], ABSENT] -> PUBLIC + [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] -> PUBLIC + [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] -> PUBLIC ops: *scop.MakeAddedColumnDeleteOnly Column: @@ -309,7 +309,7 @@ PostCommitPhase stage 7 of 7 with 1 ValidationType op *scop.ValidateUniqueIndex IndexID: 2 TableID: 104 -PostCommitNonRevertiblePhase stage 1 of 3 with 10 MutationType ops +PostCommitNonRevertiblePhase stage 1 of 3 with 9 MutationType ops transitions: [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1}, ABSENT], PUBLIC] -> ABSENT [[PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY @@ -318,6 +318,8 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 10 MutationType ops [[PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC], VALIDATED] -> PUBLIC [[IndexName:{DescID: 104, Name: foo_pkey, IndexID: 2}, PUBLIC], ABSENT] -> PUBLIC [[TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], WRITE_ONLY] -> TRANSIENT_DELETE_ONLY + [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, TRANSIENT_ABSENT], PUBLIC] -> TRANSIENT_ABSENT + [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, TRANSIENT_ABSENT], PUBLIC] -> TRANSIENT_ABSENT ops: *scop.MakeDroppedPrimaryIndexDeleteAndWriteOnly IndexID: 1 @@ -333,10 +335,6 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 10 MutationType ops *scop.MakeDroppedIndexDeleteOnly IndexID: 3 TableID: 104 - *scop.RemoveColumnFromIndex - ColumnID: 1 - IndexID: 1 - TableID: 104 *scop.MakeAddedPrimaryIndexPublic EventBase: Authorization: @@ -368,29 +366,29 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 10 MutationType ops *scop.UpdateSchemaChangerJob IsNonCancelable: true JobID: 1 -PostCommitNonRevertiblePhase stage 2 of 3 with 3 MutationType ops +PostCommitNonRevertiblePhase stage 2 of 3 with 5 MutationType ops transitions: [[PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY + [[TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], TRANSIENT_DELETE_ONLY] -> TRANSIENT_ABSENT ops: *scop.MakeDroppedIndexDeleteOnly IndexID: 1 TableID: 104 + *scop.CreateGcJobForIndex + IndexID: 3 + TableID: 104 + *scop.MakeIndexAbsent + IndexID: 3 + TableID: 104 *scop.SetJobStateOnDescriptor DescriptorID: 104 *scop.UpdateSchemaChangerJob IsNonCancelable: true JobID: 1 -PostCommitNonRevertiblePhase stage 3 of 3 with 6 MutationType ops +PostCommitNonRevertiblePhase stage 3 of 3 with 4 MutationType ops transitions: [[PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1}, ABSENT], DELETE_ONLY] -> ABSENT - [[TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], TRANSIENT_DELETE_ONLY] -> TRANSIENT_ABSENT ops: - *scop.CreateGcJobForIndex - IndexID: 3 - TableID: 104 - *scop.MakeIndexAbsent - IndexID: 3 - TableID: 104 *scop.CreateGcJobForIndex IndexID: 1 StatementForDropJob: @@ -429,8 +427,8 @@ StatementPhase stage 1 of 1 with 18 MutationType ops [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2}, PUBLIC], ABSENT] -> PUBLIC [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2}, PUBLIC], ABSENT] -> PUBLIC [[TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], ABSENT] -> DELETE_ONLY - [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, PUBLIC], ABSENT] -> PUBLIC - [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, PUBLIC], ABSENT] -> PUBLIC + [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] -> PUBLIC + [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] -> PUBLIC [[Column:{DescID: 104, ColumnID: 3}, PUBLIC], ABSENT] -> DELETE_ONLY [[ColumnName:{DescID: 104, Name: k, ColumnID: 3}, PUBLIC], ABSENT] -> PUBLIC [[ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3}, PUBLIC], ABSENT] -> PUBLIC @@ -661,7 +659,7 @@ PostCommitPhase stage 7 of 7 with 1 ValidationType op *scop.ValidateUniqueIndex IndexID: 2 TableID: 104 -PostCommitNonRevertiblePhase stage 1 of 3 with 12 MutationType ops +PostCommitNonRevertiblePhase stage 1 of 3 with 11 MutationType ops transitions: [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1}, ABSENT], PUBLIC] -> ABSENT [[PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY @@ -670,6 +668,8 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 12 MutationType ops [[PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC], VALIDATED] -> PUBLIC [[IndexName:{DescID: 104, Name: foo_pkey, IndexID: 2}, PUBLIC], ABSENT] -> PUBLIC [[TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], WRITE_ONLY] -> TRANSIENT_DELETE_ONLY + [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, TRANSIENT_ABSENT], PUBLIC] -> TRANSIENT_ABSENT + [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, TRANSIENT_ABSENT], PUBLIC] -> TRANSIENT_ABSENT [[Column:{DescID: 104, ColumnID: 3}, PUBLIC], WRITE_ONLY] -> PUBLIC ops: *scop.MakeDroppedPrimaryIndexDeleteAndWriteOnly @@ -686,10 +686,6 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 12 MutationType ops *scop.MakeDroppedIndexDeleteOnly IndexID: 3 TableID: 104 - *scop.RemoveColumnFromIndex - ColumnID: 1 - IndexID: 1 - TableID: 104 *scop.MakeAddedPrimaryIndexPublic EventBase: Authorization: @@ -733,29 +729,29 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 12 MutationType ops *scop.UpdateSchemaChangerJob IsNonCancelable: true JobID: 1 -PostCommitNonRevertiblePhase stage 2 of 3 with 3 MutationType ops +PostCommitNonRevertiblePhase stage 2 of 3 with 5 MutationType ops transitions: [[PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY + [[TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], TRANSIENT_DELETE_ONLY] -> TRANSIENT_ABSENT ops: *scop.MakeDroppedIndexDeleteOnly IndexID: 1 TableID: 104 + *scop.CreateGcJobForIndex + IndexID: 3 + TableID: 104 + *scop.MakeIndexAbsent + IndexID: 3 + TableID: 104 *scop.SetJobStateOnDescriptor DescriptorID: 104 *scop.UpdateSchemaChangerJob IsNonCancelable: true JobID: 1 -PostCommitNonRevertiblePhase stage 3 of 3 with 6 MutationType ops +PostCommitNonRevertiblePhase stage 3 of 3 with 4 MutationType ops transitions: [[PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1}, ABSENT], DELETE_ONLY] -> ABSENT - [[TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], TRANSIENT_DELETE_ONLY] -> TRANSIENT_ABSENT ops: - *scop.CreateGcJobForIndex - IndexID: 3 - TableID: 104 - *scop.MakeIndexAbsent - IndexID: 3 - TableID: 104 *scop.CreateGcJobForIndex IndexID: 1 StatementForDropJob: @@ -791,8 +787,8 @@ StatementPhase stage 1 of 1 with 10 MutationType ops [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2}, PUBLIC], ABSENT] -> PUBLIC [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2}, PUBLIC], ABSENT] -> PUBLIC [[TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], ABSENT] -> DELETE_ONLY - [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, PUBLIC], ABSENT] -> PUBLIC - [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, PUBLIC], ABSENT] -> PUBLIC + [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] -> PUBLIC + [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] -> PUBLIC ops: *scop.MakeAddedColumnDeleteOnly Column: @@ -953,7 +949,7 @@ PostCommitPhase stage 7 of 7 with 1 ValidationType op *scop.ValidateUniqueIndex IndexID: 2 TableID: 104 -PostCommitNonRevertiblePhase stage 1 of 3 with 10 MutationType ops +PostCommitNonRevertiblePhase stage 1 of 3 with 9 MutationType ops transitions: [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1}, ABSENT], PUBLIC] -> ABSENT [[PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY @@ -962,6 +958,8 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 10 MutationType ops [[PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC], VALIDATED] -> PUBLIC [[IndexName:{DescID: 104, Name: foo_pkey, IndexID: 2}, PUBLIC], ABSENT] -> PUBLIC [[TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], WRITE_ONLY] -> TRANSIENT_DELETE_ONLY + [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, TRANSIENT_ABSENT], PUBLIC] -> TRANSIENT_ABSENT + [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, TRANSIENT_ABSENT], PUBLIC] -> TRANSIENT_ABSENT ops: *scop.MakeDroppedPrimaryIndexDeleteAndWriteOnly IndexID: 1 @@ -977,10 +975,6 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 10 MutationType ops *scop.MakeDroppedIndexDeleteOnly IndexID: 3 TableID: 104 - *scop.RemoveColumnFromIndex - ColumnID: 1 - IndexID: 1 - TableID: 104 *scop.MakeAddedPrimaryIndexPublic EventBase: Authorization: @@ -1012,29 +1006,29 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 10 MutationType ops *scop.UpdateSchemaChangerJob IsNonCancelable: true JobID: 1 -PostCommitNonRevertiblePhase stage 2 of 3 with 3 MutationType ops +PostCommitNonRevertiblePhase stage 2 of 3 with 5 MutationType ops transitions: [[PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY + [[TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], TRANSIENT_DELETE_ONLY] -> TRANSIENT_ABSENT ops: *scop.MakeDroppedIndexDeleteOnly IndexID: 1 TableID: 104 + *scop.CreateGcJobForIndex + IndexID: 3 + TableID: 104 + *scop.MakeIndexAbsent + IndexID: 3 + TableID: 104 *scop.SetJobStateOnDescriptor DescriptorID: 104 *scop.UpdateSchemaChangerJob IsNonCancelable: true JobID: 1 -PostCommitNonRevertiblePhase stage 3 of 3 with 6 MutationType ops +PostCommitNonRevertiblePhase stage 3 of 3 with 4 MutationType ops transitions: [[PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1}, ABSENT], DELETE_ONLY] -> ABSENT - [[TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], TRANSIENT_DELETE_ONLY] -> TRANSIENT_ABSENT ops: - *scop.CreateGcJobForIndex - IndexID: 3 - TableID: 104 - *scop.MakeIndexAbsent - IndexID: 3 - TableID: 104 *scop.CreateGcJobForIndex IndexID: 1 StatementForDropJob: @@ -1255,8 +1249,8 @@ StatementPhase stage 1 of 1 with 12 MutationType ops [[IndexColumn:{DescID: 108, ColumnID: 2, IndexID: 2}, PUBLIC], ABSENT] -> PUBLIC [[IndexColumn:{DescID: 108, ColumnID: 1, IndexID: 2}, PUBLIC], ABSENT] -> PUBLIC [[TemporaryIndex:{DescID: 108, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], ABSENT] -> DELETE_ONLY - [[IndexColumn:{DescID: 108, ColumnID: 2, IndexID: 3}, PUBLIC], ABSENT] -> PUBLIC - [[IndexColumn:{DescID: 108, ColumnID: 1, IndexID: 3}, PUBLIC], ABSENT] -> PUBLIC + [[IndexColumn:{DescID: 108, ColumnID: 2, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] -> PUBLIC + [[IndexColumn:{DescID: 108, ColumnID: 1, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] -> PUBLIC [[SecondaryIndex:{DescID: 108, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1}, PUBLIC], ABSENT] -> BACKFILL_ONLY [[TemporaryIndex:{DescID: 108, IndexID: 5, ConstraintID: 5, SourceIndexID: 1}, TRANSIENT_ABSENT], ABSENT] -> DELETE_ONLY [[IndexColumn:{DescID: 108, ColumnID: 1, IndexID: 4}, PUBLIC], ABSENT] -> PUBLIC @@ -1447,7 +1441,7 @@ PostCommitPhase stage 7 of 7 with 2 ValidationType ops *scop.ValidateUniqueIndex IndexID: 4 TableID: 108 -PostCommitNonRevertiblePhase stage 1 of 3 with 12 MutationType ops +PostCommitNonRevertiblePhase stage 1 of 3 with 10 MutationType ops transitions: [[IndexColumn:{DescID: 108, ColumnID: 1, IndexID: 1}, ABSENT], PUBLIC] -> ABSENT [[IndexColumn:{DescID: 108, ColumnID: 2, IndexID: 1}, ABSENT], PUBLIC] -> ABSENT @@ -1456,6 +1450,8 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 12 MutationType ops [[PrimaryIndex:{DescID: 108, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC], VALIDATED] -> PUBLIC [[IndexName:{DescID: 108, Name: t_pkey, IndexID: 2}, PUBLIC], ABSENT] -> PUBLIC [[TemporaryIndex:{DescID: 108, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], WRITE_ONLY] -> TRANSIENT_DELETE_ONLY + [[IndexColumn:{DescID: 108, ColumnID: 2, IndexID: 3}, TRANSIENT_ABSENT], PUBLIC] -> TRANSIENT_ABSENT + [[IndexColumn:{DescID: 108, ColumnID: 1, IndexID: 3}, TRANSIENT_ABSENT], PUBLIC] -> TRANSIENT_ABSENT [[SecondaryIndex:{DescID: 108, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1}, PUBLIC], VALIDATED] -> PUBLIC [[TemporaryIndex:{DescID: 108, IndexID: 5, ConstraintID: 5, SourceIndexID: 1}, TRANSIENT_ABSENT], WRITE_ONLY] -> TRANSIENT_DELETE_ONLY [[IndexName:{DescID: 108, Name: t_i_key, IndexID: 4}, PUBLIC], ABSENT] -> PUBLIC @@ -1481,15 +1477,6 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 12 MutationType ops IndexID: 4 Name: t_i_key TableID: 108 - *scop.RemoveColumnFromIndex - ColumnID: 1 - IndexID: 1 - TableID: 108 - *scop.RemoveColumnFromIndex - ColumnID: 2 - IndexID: 1 - Kind: 2 - TableID: 108 *scop.MakeAddedPrimaryIndexPublic EventBase: Authorization: @@ -1509,24 +1496,15 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 12 MutationType ops *scop.UpdateSchemaChangerJob IsNonCancelable: true JobID: 1 -PostCommitNonRevertiblePhase stage 2 of 3 with 3 MutationType ops +PostCommitNonRevertiblePhase stage 2 of 3 with 7 MutationType ops transitions: [[PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY + [[TemporaryIndex:{DescID: 108, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], TRANSIENT_DELETE_ONLY] -> TRANSIENT_ABSENT + [[TemporaryIndex:{DescID: 108, IndexID: 5, ConstraintID: 5, SourceIndexID: 1}, TRANSIENT_ABSENT], TRANSIENT_DELETE_ONLY] -> TRANSIENT_ABSENT ops: *scop.MakeDroppedIndexDeleteOnly IndexID: 1 TableID: 108 - *scop.SetJobStateOnDescriptor - DescriptorID: 108 - *scop.UpdateSchemaChangerJob - IsNonCancelable: true - JobID: 1 -PostCommitNonRevertiblePhase stage 3 of 3 with 8 MutationType ops - transitions: - [[PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1}, ABSENT], DELETE_ONLY] -> ABSENT - [[TemporaryIndex:{DescID: 108, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], TRANSIENT_DELETE_ONLY] -> TRANSIENT_ABSENT - [[TemporaryIndex:{DescID: 108, IndexID: 5, ConstraintID: 5, SourceIndexID: 1}, TRANSIENT_ABSENT], TRANSIENT_DELETE_ONLY] -> TRANSIENT_ABSENT - ops: *scop.CreateGcJobForIndex IndexID: 3 TableID: 108 @@ -1539,6 +1517,15 @@ PostCommitNonRevertiblePhase stage 3 of 3 with 8 MutationType ops *scop.MakeIndexAbsent IndexID: 5 TableID: 108 + *scop.SetJobStateOnDescriptor + DescriptorID: 108 + *scop.UpdateSchemaChangerJob + IsNonCancelable: true + JobID: 1 +PostCommitNonRevertiblePhase stage 3 of 3 with 4 MutationType ops + transitions: + [[PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1}, ABSENT], DELETE_ONLY] -> ABSENT + ops: *scop.CreateGcJobForIndex IndexID: 1 StatementForDropJob: @@ -1561,3 +1548,641 @@ PostCommitNonRevertiblePhase stage 3 of 3 with 8 MutationType ops *scop.UpdateSchemaChangerJob IsNonCancelable: true JobID: 1 + +setup +CREATE TABLE defaultdb.baz (i INT PRIMARY KEY); +---- + +ops +ALTER TABLE defaultdb.baz ADD g INT UNIQUE DEFAULT 1 +---- +StatementPhase stage 1 of 1 with 11 MutationType ops + transitions: + [[Column:{DescID: 109, ColumnID: 2}, PUBLIC], ABSENT] -> DELETE_ONLY + [[ColumnName:{DescID: 109, Name: g, ColumnID: 2}, PUBLIC], ABSENT] -> PUBLIC + [[ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 2}, PUBLIC], ABSENT] -> PUBLIC + [[ColumnDefaultExpression:{DescID: 109, ColumnID: 2}, PUBLIC], ABSENT] -> PUBLIC + [[PrimaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC], ABSENT] -> BACKFILL_ONLY + [[IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 2}, PUBLIC], ABSENT] -> PUBLIC + [[IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 2}, PUBLIC], ABSENT] -> PUBLIC + [[TemporaryIndex:{DescID: 109, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], ABSENT] -> DELETE_ONLY + [[IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] -> PUBLIC + [[IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] -> PUBLIC + ops: + *scop.MakeAddedColumnDeleteOnly + Column: + ColumnID: 2 + PgAttributeNum: 2 + TableID: 109 + *scop.LogEvent + Element: + Column: + columnId: 2 + pgAttributeNum: 2 + tableId: 109 + EventBase: + Authorization: + UserName: root + Statement: ALTER TABLE ‹defaultdb›.public.‹baz› ADD COLUMN ‹g› INT8 UNIQUE DEFAULT + ‹1› + StatementTag: ALTER TABLE + TargetMetadata: + SourceElementID: 1 + SubWorkID: 1 + TargetStatus: 2 + *scop.SetColumnName + ColumnID: 2 + Name: g + TableID: 109 + *scop.SetAddedColumnType + ColumnType: + ColumnID: 2 + IsNullable: true + TableID: 109 + TypeT: + Type: + family: IntFamily + oid: 20 + width: 64 + *scop.AddColumnDefaultExpression + Default: + ColumnID: 2 + Expression: + Expr: 1:::INT8 + TableID: 109 + *scop.MakeAddedIndexBackfilling + Index: + ConstraintID: 2 + IndexID: 2 + IsUnique: true + SourceIndexID: 1 + TableID: 109 + TemporaryIndexID: 3 + *scop.AddColumnToIndex + ColumnID: 1 + IndexID: 2 + TableID: 109 + *scop.AddColumnToIndex + ColumnID: 2 + IndexID: 2 + Kind: 2 + TableID: 109 + *scop.MakeAddedTempIndexDeleteOnly + Index: + ConstraintID: 3 + IndexID: 3 + IsUnique: true + SourceIndexID: 1 + TableID: 109 + *scop.AddColumnToIndex + ColumnID: 1 + IndexID: 3 + TableID: 109 + *scop.AddColumnToIndex + ColumnID: 2 + IndexID: 3 + Kind: 2 + TableID: 109 +PreCommitPhase stage 1 of 1 with 2 MutationType ops + transitions: + ops: + *scop.SetJobStateOnDescriptor + DescriptorID: 109 + Initialize: true + *scop.CreateSchemaChangerJob + Authorization: + UserName: root + DescriptorIDs: + - 109 + JobID: 1 + RunningStatus: PostCommitPhase stage 1 of 15 with 2 MutationType ops pending + Statements: + - statement: ALTER TABLE defaultdb.baz ADD COLUMN g INT8 UNIQUE DEFAULT 1 + redactedstatement: ALTER TABLE ‹defaultdb›.public.‹baz› ADD COLUMN ‹g› INT8 UNIQUE + DEFAULT ‹1› + statementtag: ALTER TABLE +PostCommitPhase stage 1 of 15 with 4 MutationType ops + transitions: + [[Column:{DescID: 109, ColumnID: 2}, PUBLIC], DELETE_ONLY] -> WRITE_ONLY + [[TemporaryIndex:{DescID: 109, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], DELETE_ONLY] -> WRITE_ONLY + ops: + *scop.MakeAddedColumnDeleteAndWriteOnly + ColumnID: 2 + TableID: 109 + *scop.MakeAddedIndexDeleteAndWriteOnly + IndexID: 3 + TableID: 109 + *scop.SetJobStateOnDescriptor + DescriptorID: 109 + *scop.UpdateSchemaChangerJob + JobID: 1 +PostCommitPhase stage 2 of 15 with 1 BackfillType op + transitions: + [[PrimaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC], BACKFILL_ONLY] -> BACKFILLED + ops: + *scop.BackfillIndex + IndexID: 2 + SourceIndexID: 1 + TableID: 109 +PostCommitPhase stage 3 of 15 with 3 MutationType ops + transitions: + [[PrimaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC], BACKFILLED] -> DELETE_ONLY + ops: + *scop.MakeBackfillingIndexDeleteOnly + IndexID: 2 + TableID: 109 + *scop.SetJobStateOnDescriptor + DescriptorID: 109 + *scop.UpdateSchemaChangerJob + JobID: 1 +PostCommitPhase stage 4 of 15 with 3 MutationType ops + transitions: + [[PrimaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC], DELETE_ONLY] -> MERGE_ONLY + ops: + *scop.MakeBackfilledIndexMerging + IndexID: 2 + TableID: 109 + *scop.SetJobStateOnDescriptor + DescriptorID: 109 + *scop.UpdateSchemaChangerJob + JobID: 1 +PostCommitPhase stage 5 of 15 with 1 BackfillType op + transitions: + [[PrimaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC], MERGE_ONLY] -> MERGED + ops: + *scop.MergeIndex + BackfilledIndexID: 2 + TableID: 109 + TemporaryIndexID: 3 +PostCommitPhase stage 6 of 15 with 3 MutationType ops + transitions: + [[PrimaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC], MERGED] -> WRITE_ONLY + ops: + *scop.MakeMergedIndexWriteOnly + IndexID: 2 + TableID: 109 + *scop.SetJobStateOnDescriptor + DescriptorID: 109 + *scop.UpdateSchemaChangerJob + JobID: 1 +PostCommitPhase stage 7 of 15 with 1 ValidationType op + transitions: + [[PrimaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC], WRITE_ONLY] -> VALIDATED + ops: + *scop.ValidateUniqueIndex + IndexID: 2 + TableID: 109 +PostCommitPhase stage 8 of 15 with 14 MutationType ops + transitions: + [[PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, ABSENT], PUBLIC] -> VALIDATED + [[IndexName:{DescID: 109, Name: baz_pkey, IndexID: 1}, ABSENT], PUBLIC] -> ABSENT + [[Column:{DescID: 109, ColumnID: 2}, PUBLIC], WRITE_ONLY] -> PUBLIC + [[PrimaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC], VALIDATED] -> PUBLIC + [[IndexName:{DescID: 109, Name: baz_pkey, IndexID: 2}, PUBLIC], ABSENT] -> PUBLIC + [[IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 4}, PUBLIC], ABSENT] -> PUBLIC + [[IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 4}, PUBLIC], ABSENT] -> PUBLIC + [[SecondaryIndex:{DescID: 109, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2}, PUBLIC], ABSENT] -> BACKFILL_ONLY + [[IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 5}, PUBLIC], ABSENT] -> PUBLIC + [[IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 5}, PUBLIC], ABSENT] -> PUBLIC + [[TemporaryIndex:{DescID: 109, IndexID: 5, ConstraintID: 4, SourceIndexID: 2}, TRANSIENT_ABSENT], ABSENT] -> DELETE_ONLY + ops: + *scop.MakeDroppedPrimaryIndexDeleteAndWriteOnly + IndexID: 1 + TableID: 109 + *scop.SetIndexName + IndexID: 1 + Name: crdb_internal_index_1_name_placeholder + TableID: 109 + *scop.SetIndexName + IndexID: 2 + Name: baz_pkey + TableID: 109 + *scop.MakeAddedPrimaryIndexPublic + EventBase: + Authorization: + UserName: root + Statement: ALTER TABLE ‹defaultdb›.public.‹baz› ADD COLUMN ‹g› INT8 UNIQUE DEFAULT + ‹1› + StatementTag: ALTER TABLE + TargetMetadata: + SourceElementID: 1 + SubWorkID: 1 + IndexID: 2 + TableID: 109 + *scop.MakeAddedIndexBackfilling + Index: + ConstraintID: 4 + IndexID: 4 + IsUnique: true + SourceIndexID: 2 + TableID: 109 + TemporaryIndexID: 5 + IsSecondaryIndex: true + *scop.MakeAddedTempIndexDeleteOnly + Index: + ConstraintID: 4 + IndexID: 5 + IsUnique: true + SourceIndexID: 2 + TableID: 109 + IsSecondaryIndex: true + *scop.AddColumnToIndex + ColumnID: 2 + IndexID: 4 + TableID: 109 + *scop.AddColumnToIndex + ColumnID: 1 + IndexID: 4 + Kind: 1 + TableID: 109 + *scop.AddColumnToIndex + ColumnID: 2 + IndexID: 5 + TableID: 109 + *scop.AddColumnToIndex + ColumnID: 1 + IndexID: 5 + Kind: 1 + TableID: 109 + *scop.MakeColumnPublic + ColumnID: 2 + EventBase: + Authorization: + UserName: root + Statement: ALTER TABLE ‹defaultdb›.public.‹baz› ADD COLUMN ‹g› INT8 UNIQUE DEFAULT + ‹1› + StatementTag: ALTER TABLE + TargetMetadata: + SourceElementID: 1 + SubWorkID: 1 + TableID: 109 + *scop.RefreshStats + TableID: 109 + *scop.SetJobStateOnDescriptor + DescriptorID: 109 + *scop.UpdateSchemaChangerJob + JobID: 1 +PostCommitPhase stage 9 of 15 with 3 MutationType ops + transitions: + [[TemporaryIndex:{DescID: 109, IndexID: 5, ConstraintID: 4, SourceIndexID: 2}, TRANSIENT_ABSENT], DELETE_ONLY] -> WRITE_ONLY + ops: + *scop.MakeAddedIndexDeleteAndWriteOnly + IndexID: 5 + TableID: 109 + *scop.SetJobStateOnDescriptor + DescriptorID: 109 + *scop.UpdateSchemaChangerJob + JobID: 1 +PostCommitPhase stage 10 of 15 with 1 BackfillType op + transitions: + [[SecondaryIndex:{DescID: 109, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2}, PUBLIC], BACKFILL_ONLY] -> BACKFILLED + ops: + *scop.BackfillIndex + IndexID: 4 + SourceIndexID: 2 + TableID: 109 +PostCommitPhase stage 11 of 15 with 3 MutationType ops + transitions: + [[SecondaryIndex:{DescID: 109, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2}, PUBLIC], BACKFILLED] -> DELETE_ONLY + ops: + *scop.MakeBackfillingIndexDeleteOnly + IndexID: 4 + TableID: 109 + *scop.SetJobStateOnDescriptor + DescriptorID: 109 + *scop.UpdateSchemaChangerJob + JobID: 1 +PostCommitPhase stage 12 of 15 with 3 MutationType ops + transitions: + [[SecondaryIndex:{DescID: 109, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2}, PUBLIC], DELETE_ONLY] -> MERGE_ONLY + ops: + *scop.MakeBackfilledIndexMerging + IndexID: 4 + TableID: 109 + *scop.SetJobStateOnDescriptor + DescriptorID: 109 + *scop.UpdateSchemaChangerJob + JobID: 1 +PostCommitPhase stage 13 of 15 with 1 BackfillType op + transitions: + [[SecondaryIndex:{DescID: 109, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2}, PUBLIC], MERGE_ONLY] -> MERGED + ops: + *scop.MergeIndex + BackfilledIndexID: 4 + TableID: 109 + TemporaryIndexID: 5 +PostCommitPhase stage 14 of 15 with 3 MutationType ops + transitions: + [[SecondaryIndex:{DescID: 109, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2}, PUBLIC], MERGED] -> WRITE_ONLY + ops: + *scop.MakeMergedIndexWriteOnly + IndexID: 4 + TableID: 109 + *scop.SetJobStateOnDescriptor + DescriptorID: 109 + *scop.UpdateSchemaChangerJob + JobID: 1 +PostCommitPhase stage 15 of 15 with 1 ValidationType op + transitions: + [[SecondaryIndex:{DescID: 109, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2}, PUBLIC], WRITE_ONLY] -> VALIDATED + ops: + *scop.ValidateUniqueIndex + IndexID: 4 + TableID: 109 +PostCommitNonRevertiblePhase stage 1 of 2 with 7 MutationType ops + transitions: + [[IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 1}, ABSENT], PUBLIC] -> ABSENT + [[PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, ABSENT], VALIDATED] -> DELETE_ONLY + [[TemporaryIndex:{DescID: 109, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], WRITE_ONLY] -> TRANSIENT_DELETE_ONLY + [[IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 3}, TRANSIENT_ABSENT], PUBLIC] -> TRANSIENT_ABSENT + [[IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 3}, TRANSIENT_ABSENT], PUBLIC] -> TRANSIENT_ABSENT + [[SecondaryIndex:{DescID: 109, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2}, PUBLIC], VALIDATED] -> PUBLIC + [[IndexName:{DescID: 109, Name: baz_g_key, IndexID: 4}, PUBLIC], ABSENT] -> PUBLIC + [[TemporaryIndex:{DescID: 109, IndexID: 5, ConstraintID: 4, SourceIndexID: 2}, TRANSIENT_ABSENT], WRITE_ONLY] -> TRANSIENT_DELETE_ONLY + ops: + *scop.MakeDroppedIndexDeleteOnly + IndexID: 3 + TableID: 109 + *scop.SetIndexName + IndexID: 4 + Name: baz_g_key + TableID: 109 + *scop.MakeDroppedIndexDeleteOnly + IndexID: 5 + TableID: 109 + *scop.MakeDroppedIndexDeleteOnly + IndexID: 1 + TableID: 109 + *scop.MakeAddedSecondaryIndexPublic + IndexID: 4 + TableID: 109 + *scop.SetJobStateOnDescriptor + DescriptorID: 109 + *scop.UpdateSchemaChangerJob + IsNonCancelable: true + JobID: 1 +PostCommitNonRevertiblePhase stage 2 of 2 with 8 MutationType ops + transitions: + [[PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, ABSENT], DELETE_ONLY] -> ABSENT + [[TemporaryIndex:{DescID: 109, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], TRANSIENT_DELETE_ONLY] -> TRANSIENT_ABSENT + [[TemporaryIndex:{DescID: 109, IndexID: 5, ConstraintID: 4, SourceIndexID: 2}, TRANSIENT_ABSENT], TRANSIENT_DELETE_ONLY] -> TRANSIENT_ABSENT + ops: + *scop.CreateGcJobForIndex + IndexID: 1 + StatementForDropJob: + Statement: ALTER TABLE defaultdb.public.baz ADD COLUMN g INT8 UNIQUE DEFAULT 1 + TableID: 109 + *scop.MakeIndexAbsent + EventBase: + Authorization: + UserName: root + Statement: ALTER TABLE ‹defaultdb›.public.‹baz› ADD COLUMN ‹g› INT8 UNIQUE DEFAULT + ‹1› + StatementTag: ALTER TABLE + TargetMetadata: + SourceElementID: 1 + SubWorkID: 1 + IndexID: 1 + TableID: 109 + *scop.CreateGcJobForIndex + IndexID: 3 + TableID: 109 + *scop.MakeIndexAbsent + IndexID: 3 + TableID: 109 + *scop.CreateGcJobForIndex + IndexID: 5 + TableID: 109 + *scop.MakeIndexAbsent + IndexID: 5 + TableID: 109 + *scop.RemoveJobStateFromDescriptor + DescriptorID: 109 + JobID: 1 + *scop.UpdateSchemaChangerJob + IsNonCancelable: true + JobID: 1 + +deps +ALTER TABLE defaultdb.baz ADD g INT UNIQUE DEFAULT 1 +---- +- from: [Column:{DescID: 109, ColumnID: 2}, DELETE_ONLY] + to: [ColumnDefaultExpression:{DescID: 109, ColumnID: 2}, PUBLIC] + kind: Precedence + rule: column existence precedes column dependents +- from: [Column:{DescID: 109, ColumnID: 2}, DELETE_ONLY] + to: [ColumnName:{DescID: 109, Name: g, ColumnID: 2}, PUBLIC] + kind: SameStagePrecedence + rules: [column existence precedes column dependents; column name and type set right after column existence] +- from: [Column:{DescID: 109, ColumnID: 2}, DELETE_ONLY] + to: [ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 2}, PUBLIC] + kind: SameStagePrecedence + rules: [column existence precedes column dependents; column name and type set right after column existence] +- from: [Column:{DescID: 109, ColumnID: 2}, DELETE_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 2}, PUBLIC] + kind: Precedence + rule: column existence precedes column dependents +- from: [Column:{DescID: 109, ColumnID: 2}, DELETE_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 3}, PUBLIC] + kind: Precedence + rule: column existence precedes column dependents +- from: [Column:{DescID: 109, ColumnID: 2}, DELETE_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 4}, PUBLIC] + kind: Precedence + rule: column existence precedes column dependents +- from: [Column:{DescID: 109, ColumnID: 2}, DELETE_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 5}, PUBLIC] + kind: Precedence + rule: column existence precedes column dependents +- from: [Column:{DescID: 109, ColumnID: 2}, DELETE_ONLY] + to: [PrimaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILL_ONLY] + kind: Precedence + rule: column existence precedes index existence +- from: [Column:{DescID: 109, ColumnID: 2}, DELETE_ONLY] + to: [SecondaryIndex:{DescID: 109, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2}, BACKFILL_ONLY] + kind: Precedence + rule: column existence precedes index existence +- from: [Column:{DescID: 109, ColumnID: 2}, DELETE_ONLY] + to: [TemporaryIndex:{DescID: 109, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, DELETE_ONLY] + kind: Precedence + rule: column existence precedes temp index existence +- from: [Column:{DescID: 109, ColumnID: 2}, DELETE_ONLY] + to: [TemporaryIndex:{DescID: 109, IndexID: 5, ConstraintID: 4, SourceIndexID: 2}, DELETE_ONLY] + kind: Precedence + rule: column existence precedes temp index existence +- from: [Column:{DescID: 109, ColumnID: 2}, WRITE_ONLY] + to: [TemporaryIndex:{DescID: 109, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, WRITE_ONLY] + kind: Precedence + rule: column is WRITE_ONLY before temporary index is WRITE_ONLY +- from: [Column:{DescID: 109, ColumnID: 2}, WRITE_ONLY] + to: [TemporaryIndex:{DescID: 109, IndexID: 5, ConstraintID: 4, SourceIndexID: 2}, WRITE_ONLY] + kind: Precedence + rule: column is WRITE_ONLY before temporary index is WRITE_ONLY +- from: [ColumnDefaultExpression:{DescID: 109, ColumnID: 2}, PUBLIC] + to: [Column:{DescID: 109, ColumnID: 2}, PUBLIC] + kind: Precedence + rule: column dependents exist before column becomes public +- from: [ColumnDefaultExpression:{DescID: 109, ColumnID: 2}, PUBLIC] + to: [Column:{DescID: 109, ColumnID: 2}, WRITE_ONLY] + kind: Precedence + rule: DEFAULT or ON UPDATE existence precedes writes to column +- from: [ColumnName:{DescID: 109, Name: g, ColumnID: 2}, PUBLIC] + to: [Column:{DescID: 109, ColumnID: 2}, PUBLIC] + kind: Precedence + rule: column dependents exist before column becomes public +- from: [ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 2}, PUBLIC] + to: [Column:{DescID: 109, ColumnID: 2}, PUBLIC] + kind: Precedence + rule: column dependents exist before column becomes public +- from: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 1}, ABSENT] + to: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, ABSENT] + kind: Precedence + rule: dependents removed before index +- from: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 2}, PUBLIC] + to: [PrimaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILLED] + kind: Precedence + rule: index-column added to index before index is backfilled +- from: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 2}, PUBLIC] + to: [PrimaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC] + kind: Precedence + rule: index dependents exist before index becomes public +- from: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 3}, PUBLIC] + to: [TemporaryIndex:{DescID: 109, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, WRITE_ONLY] + kind: Precedence + rule: index-column added to index before temp index receives writes +- from: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 3}, TRANSIENT_ABSENT] + to: [TemporaryIndex:{DescID: 109, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT] + kind: Precedence + rule: dependents removed before index +- from: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 4}, PUBLIC] + to: [SecondaryIndex:{DescID: 109, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2}, BACKFILLED] + kind: Precedence + rule: index-column added to index before index is backfilled +- from: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 4}, PUBLIC] + to: [SecondaryIndex:{DescID: 109, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2}, PUBLIC] + kind: Precedence + rule: index dependents exist before index becomes public +- from: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 2}, PUBLIC] + to: [Column:{DescID: 109, ColumnID: 2}, PUBLIC] + kind: Precedence + rule: column dependents exist before column becomes public +- from: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 2}, PUBLIC] + to: [PrimaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILLED] + kind: Precedence + rule: index-column added to index before index is backfilled +- from: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 2}, PUBLIC] + to: [PrimaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC] + kind: Precedence + rule: index dependents exist before index becomes public +- from: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 3}, PUBLIC] + to: [Column:{DescID: 109, ColumnID: 2}, PUBLIC] + kind: Precedence + rule: column dependents exist before column becomes public +- from: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 3}, PUBLIC] + to: [TemporaryIndex:{DescID: 109, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, WRITE_ONLY] + kind: Precedence + rule: index-column added to index before temp index receives writes +- from: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 3}, TRANSIENT_ABSENT] + to: [TemporaryIndex:{DescID: 109, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT] + kind: Precedence + rule: dependents removed before index +- from: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 4}, PUBLIC] + to: [Column:{DescID: 109, ColumnID: 2}, PUBLIC] + kind: Precedence + rule: column dependents exist before column becomes public +- from: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 4}, PUBLIC] + to: [SecondaryIndex:{DescID: 109, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2}, BACKFILLED] + kind: Precedence + rule: index-column added to index before index is backfilled +- from: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 4}, PUBLIC] + to: [SecondaryIndex:{DescID: 109, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2}, PUBLIC] + kind: Precedence + rule: index dependents exist before index becomes public +- from: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 5}, PUBLIC] + to: [Column:{DescID: 109, ColumnID: 2}, PUBLIC] + kind: Precedence + rule: column dependents exist before column becomes public +- from: [IndexName:{DescID: 109, Name: baz_g_key, IndexID: 4}, PUBLIC] + to: [SecondaryIndex:{DescID: 109, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2}, PUBLIC] + kind: SameStagePrecedence + rules: [index dependents exist before index becomes public; index named right before index becomes public] +- from: [IndexName:{DescID: 109, Name: baz_pkey, IndexID: 1}, ABSENT] + to: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, ABSENT] + kind: Precedence + rule: dependents removed before index +- from: [IndexName:{DescID: 109, Name: baz_pkey, IndexID: 2}, PUBLIC] + to: [PrimaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC] + kind: SameStagePrecedence + rules: [index dependents exist before index becomes public; index named right before index becomes public] +- from: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, VALIDATED] + to: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 1}, ABSENT] + kind: Precedence + rule: index no longer public before dependents +- from: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, VALIDATED] + to: [IndexName:{DescID: 109, Name: baz_pkey, IndexID: 1}, ABSENT] + kind: Precedence + rule: index no longer public before dependents +- from: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, VALIDATED] + to: [PrimaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC] + kind: SameStagePrecedence + rule: primary index swap +- from: [PrimaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILL_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 2}, PUBLIC] + kind: Precedence + rule: index existence precedes index dependents +- from: [PrimaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILL_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 2}, PUBLIC] + kind: Precedence + rule: index existence precedes index dependents +- from: [PrimaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILL_ONLY] + to: [IndexName:{DescID: 109, Name: baz_pkey, IndexID: 2}, PUBLIC] + kind: Precedence + rule: index existence precedes index dependents +- from: [PrimaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC] + to: [Column:{DescID: 109, ColumnID: 2}, PUBLIC] + kind: Precedence + rule: swapped primary index public before column +- from: [PrimaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC] + to: [SecondaryIndex:{DescID: 109, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2}, BACKFILL_ONLY] + kind: Precedence + rule: primary index with new columns should exist before secondary indexes +- from: [PrimaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC] + to: [TemporaryIndex:{DescID: 109, IndexID: 5, ConstraintID: 4, SourceIndexID: 2}, DELETE_ONLY] + kind: Precedence + rule: primary index with new columns should exist before temp indexes +- from: [SecondaryIndex:{DescID: 109, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2}, BACKFILL_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 4}, PUBLIC] + kind: Precedence + rule: index existence precedes index dependents +- from: [SecondaryIndex:{DescID: 109, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2}, BACKFILL_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 4}, PUBLIC] + kind: Precedence + rule: index existence precedes index dependents +- from: [SecondaryIndex:{DescID: 109, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2}, BACKFILL_ONLY] + to: [IndexName:{DescID: 109, Name: baz_g_key, IndexID: 4}, PUBLIC] + kind: Precedence + rule: index existence precedes index dependents +- from: [TemporaryIndex:{DescID: 109, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, DELETE_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 3}, PUBLIC] + kind: Precedence + rule: temp index existence precedes index dependents +- from: [TemporaryIndex:{DescID: 109, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, DELETE_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 3}, PUBLIC] + kind: Precedence + rule: temp index existence precedes index dependents +- from: [TemporaryIndex:{DescID: 109, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, WRITE_ONLY] + to: [PrimaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILLED] + kind: Precedence + rule: temp index is WRITE_ONLY before backfill +- from: [TemporaryIndex:{DescID: 109, IndexID: 5, ConstraintID: 4, SourceIndexID: 2}, DELETE_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 5}, PUBLIC] + kind: Precedence + rule: temp index existence precedes index dependents +- from: [TemporaryIndex:{DescID: 109, IndexID: 5, ConstraintID: 4, SourceIndexID: 2}, DELETE_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 5}, PUBLIC] + kind: Precedence + rule: temp index existence precedes index dependents +- from: [TemporaryIndex:{DescID: 109, IndexID: 5, ConstraintID: 4, SourceIndexID: 2}, WRITE_ONLY] + to: [SecondaryIndex:{DescID: 109, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2}, BACKFILLED] + kind: Precedence + rule: temp index is WRITE_ONLY before backfill 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 36719dce7c32..ef4fcfc67b9d 100644 --- a/pkg/sql/schemachanger/scplan/testdata/alter_table_alter_primary_key +++ b/pkg/sql/schemachanger/scplan/testdata/alter_table_alter_primary_key @@ -12,9 +12,9 @@ StatementPhase stage 1 of 1 with 14 MutationType ops [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2}, PUBLIC], ABSENT] -> PUBLIC [[IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2}, PUBLIC], ABSENT] -> PUBLIC [[TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], ABSENT] -> DELETE_ONLY - [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, PUBLIC], ABSENT] -> PUBLIC - [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, PUBLIC], ABSENT] -> PUBLIC - [[IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3}, PUBLIC], ABSENT] -> PUBLIC + [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] -> PUBLIC + [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] -> PUBLIC + [[IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3}, TRANSIENT_ABSENT], ABSENT] -> PUBLIC [[SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1}, PUBLIC], ABSENT] -> BACKFILL_ONLY [[TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1}, TRANSIENT_ABSENT], ABSENT] -> DELETE_ONLY [[IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4}, PUBLIC], ABSENT] -> PUBLIC @@ -217,7 +217,7 @@ PostCommitPhase stage 7 of 7 with 2 ValidationType ops *scop.ValidateUniqueIndex IndexID: 4 TableID: 104 -PostCommitNonRevertiblePhase stage 1 of 3 with 13 MutationType ops +PostCommitNonRevertiblePhase stage 1 of 3 with 10 MutationType ops transitions: [[IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1}, ABSENT], PUBLIC] -> ABSENT [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1}, ABSENT], PUBLIC] -> ABSENT @@ -227,6 +227,9 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 13 MutationType ops [[PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC], VALIDATED] -> PUBLIC [[IndexName:{DescID: 104, Name: t_pkey, IndexID: 2}, PUBLIC], ABSENT] -> PUBLIC [[TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], WRITE_ONLY] -> TRANSIENT_DELETE_ONLY + [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, TRANSIENT_ABSENT], PUBLIC] -> TRANSIENT_ABSENT + [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, TRANSIENT_ABSENT], PUBLIC] -> TRANSIENT_ABSENT + [[IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3}, TRANSIENT_ABSENT], PUBLIC] -> TRANSIENT_ABSENT [[SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1}, PUBLIC], VALIDATED] -> PUBLIC [[TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1}, TRANSIENT_ABSENT], WRITE_ONLY] -> TRANSIENT_DELETE_ONLY [[IndexName:{DescID: 104, Name: t_rowid_key, IndexID: 4}, PUBLIC], ABSENT] -> PUBLIC @@ -252,21 +255,6 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 13 MutationType ops IndexID: 4 Name: t_rowid_key TableID: 104 - *scop.RemoveColumnFromIndex - ColumnID: 3 - IndexID: 1 - TableID: 104 - *scop.RemoveColumnFromIndex - ColumnID: 1 - IndexID: 1 - Kind: 2 - TableID: 104 - *scop.RemoveColumnFromIndex - ColumnID: 2 - IndexID: 1 - Kind: 2 - Ordinal: 1 - TableID: 104 *scop.MakeAddedPrimaryIndexPublic EventBase: Authorization: @@ -286,24 +274,15 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 13 MutationType ops *scop.UpdateSchemaChangerJob IsNonCancelable: true JobID: 1 -PostCommitNonRevertiblePhase stage 2 of 3 with 3 MutationType ops +PostCommitNonRevertiblePhase stage 2 of 3 with 7 MutationType ops transitions: [[PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY + [[TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], TRANSIENT_DELETE_ONLY] -> TRANSIENT_ABSENT + [[TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1}, TRANSIENT_ABSENT], TRANSIENT_DELETE_ONLY] -> TRANSIENT_ABSENT ops: *scop.MakeDroppedIndexDeleteOnly IndexID: 1 TableID: 104 - *scop.SetJobStateOnDescriptor - DescriptorID: 104 - *scop.UpdateSchemaChangerJob - IsNonCancelable: true - JobID: 1 -PostCommitNonRevertiblePhase stage 3 of 3 with 8 MutationType ops - transitions: - [[PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1}, ABSENT], DELETE_ONLY] -> ABSENT - [[TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT], TRANSIENT_DELETE_ONLY] -> TRANSIENT_ABSENT - [[TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1}, TRANSIENT_ABSENT], TRANSIENT_DELETE_ONLY] -> TRANSIENT_ABSENT - ops: *scop.CreateGcJobForIndex IndexID: 3 TableID: 104 @@ -316,6 +295,15 @@ PostCommitNonRevertiblePhase stage 3 of 3 with 8 MutationType ops *scop.MakeIndexAbsent IndexID: 5 TableID: 104 + *scop.SetJobStateOnDescriptor + DescriptorID: 104 + *scop.UpdateSchemaChangerJob + IsNonCancelable: true + JobID: 1 +PostCommitNonRevertiblePhase stage 3 of 3 with 4 MutationType ops + transitions: + [[PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1}, ABSENT], DELETE_ONLY] -> ABSENT + ops: *scop.CreateGcJobForIndex IndexID: 1 StatementForDropJob: @@ -350,18 +338,26 @@ ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (k); to: [PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILLED] kind: Precedence rule: index-column added to index before index is backfilled +- from: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2}, PUBLIC] + to: [PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC] + kind: Precedence + rule: index dependents exist before index becomes public - from: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, PUBLIC] to: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, WRITE_ONLY] kind: Precedence rule: index-column added to index before temp index receives writes +- from: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, TRANSIENT_ABSENT] + to: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT] + kind: Precedence + rule: dependents removed before index - from: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4}, PUBLIC] to: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1}, BACKFILLED] kind: Precedence rule: index-column added to index before index is backfilled -- from: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5}, PUBLIC] - to: [TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1}, WRITE_ONLY] +- from: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4}, PUBLIC] + to: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1}, PUBLIC] kind: Precedence - rule: index-column added to index before temp index receives writes + rule: index dependents exist before index becomes public - from: [IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1}, ABSENT] kind: Precedence @@ -370,10 +366,18 @@ ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (k); to: [PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILLED] kind: Precedence rule: index-column added to index before index is backfilled +- from: [IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2}, PUBLIC] + to: [PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC] + kind: Precedence + rule: index dependents exist before index becomes public - from: [IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, PUBLIC] to: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, WRITE_ONLY] kind: Precedence rule: index-column added to index before temp index receives writes +- from: [IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, TRANSIENT_ABSENT] + to: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT] + kind: Precedence + rule: dependents removed before index - from: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1}, ABSENT] kind: Precedence @@ -382,18 +386,26 @@ ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (k); to: [PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILLED] kind: Precedence rule: index-column added to index before index is backfilled +- from: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2}, PUBLIC] + to: [PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC] + kind: Precedence + rule: index dependents exist before index becomes public - from: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3}, PUBLIC] to: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, WRITE_ONLY] kind: Precedence rule: index-column added to index before temp index receives writes +- from: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3}, TRANSIENT_ABSENT] + to: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT] + kind: Precedence + rule: dependents removed before index - from: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4}, PUBLIC] to: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1}, BACKFILLED] kind: Precedence rule: index-column added to index before index is backfilled -- from: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 5}, PUBLIC] - to: [TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1}, WRITE_ONLY] +- from: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4}, PUBLIC] + to: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1}, PUBLIC] kind: Precedence - rule: index-column added to index before temp index receives writes + rule: index dependents exist before index becomes public - from: [IndexName:{DescID: 104, Name: t_pkey, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1}, ABSENT] kind: Precedence @@ -401,27 +413,27 @@ ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (k); - from: [IndexName:{DescID: 104, Name: t_pkey, IndexID: 2}, PUBLIC] to: [PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC] kind: SameStagePrecedence - rule: index named right before index becomes public + rules: [index dependents exist before index becomes public; index named right before index becomes public] - from: [IndexName:{DescID: 104, Name: t_rowid_key, IndexID: 4}, PUBLIC] to: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1}, PUBLIC] kind: SameStagePrecedence - rule: index named right before index becomes public + rules: [index dependents exist before index becomes public; index named right before index becomes public] - from: [PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexName:{DescID: 104, Name: t_pkey, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC] kind: SameStagePrecedence @@ -429,47 +441,43 @@ ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (k); - from: [PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILL_ONLY] to: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2}, PUBLIC] kind: Precedence - rule: index-column added to index after index exists + rule: index existence precedes index dependents - from: [PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILL_ONLY] to: [IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2}, PUBLIC] kind: Precedence - rule: index-column added to index after index exists + rule: index existence precedes index dependents - from: [PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILL_ONLY] to: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2}, PUBLIC] kind: Precedence - rule: index-column added to index after index exists + rule: index existence precedes index dependents - from: [PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILL_ONLY] to: [IndexName:{DescID: 104, Name: t_pkey, IndexID: 2}, PUBLIC] kind: Precedence - rule: index existence precedes index name and comment + rule: index existence precedes index dependents - from: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1}, BACKFILL_ONLY] to: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4}, PUBLIC] kind: Precedence - rule: index-column added to index after index exists + rule: index existence precedes index dependents - from: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1}, BACKFILL_ONLY] to: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4}, PUBLIC] kind: Precedence - rule: index-column added to index after index exists + rule: index existence precedes index dependents - from: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1}, BACKFILL_ONLY] to: [IndexName:{DescID: 104, Name: t_rowid_key, IndexID: 4}, PUBLIC] kind: Precedence - rule: index existence precedes index name and comment + rule: index existence precedes index dependents - from: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, DELETE_ONLY] to: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, PUBLIC] kind: Precedence - rules: [temp index exists before columns, partitioning, and partial; index-column added to index after temp index exists] + rule: temp index existence precedes index dependents - from: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, DELETE_ONLY] to: [IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, PUBLIC] kind: Precedence - rules: [temp index exists before columns, partitioning, and partial; index-column added to index after temp index exists] + rule: temp index existence precedes index dependents - from: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, DELETE_ONLY] to: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3}, PUBLIC] kind: Precedence - rules: [temp index exists before columns, partitioning, and partial; index-column added to index after temp index exists] -- from: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, TRANSIENT_ABSENT] - to: [PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1}, ABSENT] - kind: SameStagePrecedence - rule: temp indexes reach absent at the same time as other indexes + rule: temp index existence precedes index dependents - from: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1}, WRITE_ONLY] to: [PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILLED] kind: Precedence @@ -477,15 +485,11 @@ ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (k); - from: [TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1}, DELETE_ONLY] to: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5}, PUBLIC] kind: Precedence - rules: [temp index exists before columns, partitioning, and partial; index-column added to index after temp index exists] + rule: temp index existence precedes index dependents - from: [TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1}, DELETE_ONLY] to: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 5}, PUBLIC] kind: Precedence - rules: [temp index exists before columns, partitioning, and partial; index-column added to index after temp index exists] -- from: [TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1}, TRANSIENT_ABSENT] - to: [PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1}, ABSENT] - kind: SameStagePrecedence - rule: temp indexes reach absent at the same time as other indexes + rule: temp index existence precedes index dependents - from: [TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1}, WRITE_ONLY] to: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1}, BACKFILLED] 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 e586f9d3c6bf..0ba5b08e4e33 100644 --- a/pkg/sql/schemachanger/scplan/testdata/alter_table_drop_column +++ b/pkg/sql/schemachanger/scplan/testdata/alter_table_drop_column @@ -30,8 +30,8 @@ StatementPhase stage 1 of 1 with 12 MutationType ops [[IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 3}, PUBLIC], ABSENT] -> PUBLIC [[IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 3}, PUBLIC], ABSENT] -> PUBLIC [[TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, TRANSIENT_ABSENT], ABSENT] -> DELETE_ONLY - [[IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 4}, PUBLIC], ABSENT] -> PUBLIC - [[IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 4}, PUBLIC], ABSENT] -> PUBLIC + [[IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 4}, TRANSIENT_ABSENT], ABSENT] -> PUBLIC + [[IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 4}, TRANSIENT_ABSENT], ABSENT] -> PUBLIC ops: *scop.MakeDroppedColumnDeleteAndWriteOnly ColumnID: 2 @@ -218,7 +218,7 @@ PostCommitPhase stage 7 of 7 with 1 ValidationType op *scop.ValidateUniqueIndex IndexID: 3 TableID: 107 -PostCommitNonRevertiblePhase stage 1 of 3 with 25 MutationType ops +PostCommitNonRevertiblePhase stage 1 of 3 with 19 MutationType ops transitions: [[Column:{DescID: 107, ColumnID: 2}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 1}, ABSENT], PUBLIC] -> ABSENT @@ -254,6 +254,8 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 25 MutationType ops [[PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, PUBLIC], VALIDATED] -> PUBLIC [[IndexName:{DescID: 107, Name: foo_pkey, IndexID: 3}, PUBLIC], ABSENT] -> PUBLIC [[TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, TRANSIENT_ABSENT], WRITE_ONLY] -> TRANSIENT_DELETE_ONLY + [[IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 4}, TRANSIENT_ABSENT], PUBLIC] -> TRANSIENT_ABSENT + [[IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 4}, TRANSIENT_ABSENT], PUBLIC] -> TRANSIENT_ABSENT ops: *scop.MakeDroppedColumnDeleteOnly ColumnID: 2 @@ -292,21 +294,6 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 25 MutationType ops *scop.MakeDroppedIndexDeleteOnly IndexID: 4 TableID: 107 - *scop.RemoveColumnFromIndex - ColumnID: 1 - IndexID: 1 - TableID: 107 - *scop.RemoveColumnFromIndex - ColumnID: 2 - IndexID: 1 - Kind: 2 - TableID: 107 - *scop.RemoveColumnFromIndex - ColumnID: 3 - IndexID: 1 - Kind: 2 - Ordinal: 1 - TableID: 107 *scop.MakeDroppedIndexDeleteOnly IndexID: 2 TableID: 107 @@ -327,20 +314,6 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 25 MutationType ops SubWorkID: 1 IndexID: 3 TableID: 107 - *scop.RemoveColumnFromIndex - ColumnID: 3 - IndexID: 2 - TableID: 107 - *scop.RemoveColumnFromIndex - ColumnID: 1 - IndexID: 2 - Kind: 1 - TableID: 107 - *scop.RemoveColumnFromIndex - ColumnID: 2 - IndexID: 2 - Kind: 2 - TableID: 107 *scop.SetJobStateOnDescriptor DescriptorID: 104 *scop.SetJobStateOnDescriptor @@ -352,19 +325,45 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 25 MutationType ops *scop.UpdateSchemaChangerJob IsNonCancelable: true JobID: 1 -PostCommitNonRevertiblePhase stage 2 of 3 with 12 MutationType ops +PostCommitNonRevertiblePhase stage 2 of 3 with 17 MutationType ops transitions: [[PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, ABSENT], WRITE_ONLY] -> DELETE_ONLY + [[SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT], DELETE_ONLY] -> ABSENT [[View:{DescID: 108}, ABSENT], DROPPED] -> ABSENT [[Column:{DescID: 108, ColumnID: 1}, ABSENT], DELETE_ONLY] -> ABSENT [[Column:{DescID: 108, ColumnID: 2}, ABSENT], DELETE_ONLY] -> ABSENT [[Column:{DescID: 108, ColumnID: 3}, ABSENT], DELETE_ONLY] -> ABSENT [[Column:{DescID: 108, ColumnID: 4294967295}, ABSENT], DELETE_ONLY] -> ABSENT [[Column:{DescID: 108, ColumnID: 4294967294}, ABSENT], DELETE_ONLY] -> ABSENT + [[TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, TRANSIENT_ABSENT], TRANSIENT_DELETE_ONLY] -> TRANSIENT_ABSENT ops: *scop.MakeDroppedIndexDeleteOnly IndexID: 1 TableID: 107 + *scop.LogEvent + Element: + SecondaryIndex: + constraintId: 1 + indexId: 2 + isUnique: true + tableId: 107 + EventBase: + Authorization: + UserName: root + Statement: ALTER TABLE ‹defaultdb›.public.‹foo› DROP COLUMN ‹v1› CASCADE + StatementTag: ALTER TABLE + TargetMetadata: + SourceElementID: 1 + SubWorkID: 1 + TargetStatus: 1 + *scop.CreateGcJobForIndex + IndexID: 2 + StatementForDropJob: + Statement: ALTER TABLE defaultdb.public.foo DROP COLUMN v1 CASCADE + TableID: 107 + *scop.MakeIndexAbsent + IndexID: 2 + TableID: 107 *scop.LogEvent Element: View: @@ -445,6 +444,12 @@ PostCommitNonRevertiblePhase stage 2 of 3 with 12 MutationType ops SourceElementID: 1 SubWorkID: 1 TableID: 108 + *scop.CreateGcJobForIndex + IndexID: 4 + TableID: 107 + *scop.MakeIndexAbsent + IndexID: 4 + TableID: 107 *scop.SetJobStateOnDescriptor DescriptorID: 104 *scop.SetJobStateOnDescriptor @@ -456,20 +461,12 @@ PostCommitNonRevertiblePhase stage 2 of 3 with 12 MutationType ops - 108 IsNonCancelable: true JobID: 1 -PostCommitNonRevertiblePhase stage 3 of 3 with 14 MutationType ops +PostCommitNonRevertiblePhase stage 3 of 3 with 9 MutationType ops transitions: [[Column:{DescID: 107, ColumnID: 2}, ABSENT], DELETE_ONLY] -> ABSENT [[ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 2}, ABSENT], PUBLIC] -> ABSENT [[PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, ABSENT], DELETE_ONLY] -> ABSENT - [[SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT], DELETE_ONLY] -> ABSENT - [[TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, TRANSIENT_ABSENT], TRANSIENT_DELETE_ONLY] -> TRANSIENT_ABSENT ops: - *scop.CreateGcJobForIndex - IndexID: 4 - TableID: 107 - *scop.MakeIndexAbsent - IndexID: 4 - TableID: 107 *scop.CreateGcJobForIndex IndexID: 1 StatementForDropJob: @@ -486,30 +483,6 @@ PostCommitNonRevertiblePhase stage 3 of 3 with 14 MutationType ops SubWorkID: 1 IndexID: 1 TableID: 107 - *scop.LogEvent - Element: - SecondaryIndex: - constraintId: 1 - indexId: 2 - isUnique: true - tableId: 107 - EventBase: - Authorization: - UserName: root - Statement: ALTER TABLE ‹defaultdb›.public.‹foo› DROP COLUMN ‹v1› CASCADE - StatementTag: ALTER TABLE - TargetMetadata: - SourceElementID: 1 - SubWorkID: 1 - TargetStatus: 1 - *scop.CreateGcJobForIndex - IndexID: 2 - StatementForDropJob: - Statement: ALTER TABLE defaultdb.public.foo DROP COLUMN v1 CASCADE - TableID: 107 - *scop.MakeIndexAbsent - IndexID: 2 - TableID: 107 *scop.RemoveDroppedColumnType ColumnID: 2 TableID: 107 @@ -548,51 +521,59 @@ ALTER TABLE defaultdb.foo DROP COLUMN v1 CASCADE; - from: [Column:{DescID: 107, ColumnID: 2}, WRITE_ONLY] to: [ColumnName:{DescID: 107, Name: v1, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 107, ColumnID: 2}, WRITE_ONLY] to: [ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents +- from: [Column:{DescID: 107, ColumnID: 2}, WRITE_ONLY] + to: [IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 1}, ABSENT] + kind: Precedence + rule: column no longer public before dependents +- from: [Column:{DescID: 107, ColumnID: 2}, WRITE_ONLY] + to: [IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 2}, ABSENT] + kind: Precedence + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 108, Name: k, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 2}, WRITE_ONLY] to: [ColumnName:{DescID: 108, Name: v1, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 2}, WRITE_ONLY] to: [ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 3}, WRITE_ONLY] to: [ColumnName:{DescID: 108, Name: v2, ColumnID: 3}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 3}, WRITE_ONLY] to: [ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 3}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 108, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 108, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [ColumnName:{DescID: 107, Name: v1, ColumnID: 2}, ABSENT] to: [Column:{DescID: 107, ColumnID: 2}, ABSENT] kind: Precedence @@ -648,23 +629,39 @@ ALTER TABLE defaultdb.foo DROP COLUMN v1 CASCADE; - from: [IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 2}, ABSENT] to: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT] kind: Precedence - rules: [secondary index columns removed before removing the index; dependents removed before index] + rule: dependents removed before index - from: [IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 3}, PUBLIC] to: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, BACKFILLED] kind: Precedence rule: index-column added to index before index is backfilled +- from: [IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 3}, PUBLIC] + to: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, PUBLIC] + kind: Precedence + rule: index dependents exist before index becomes public - from: [IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 4}, PUBLIC] to: [TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, WRITE_ONLY] kind: Precedence rule: index-column added to index before temp index receives writes +- from: [IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 4}, TRANSIENT_ABSENT] + to: [TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, TRANSIENT_ABSENT] + kind: Precedence + rule: dependents removed before index +- from: [IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 1}, ABSENT] + to: [Column:{DescID: 107, ColumnID: 2}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, ABSENT] kind: Precedence rule: dependents removed before index +- from: [IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 2}, ABSENT] + to: [Column:{DescID: 107, ColumnID: 2}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 2}, ABSENT] to: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT] kind: Precedence - rules: [secondary index columns removed before removing the index; dependents removed before index] + rule: dependents removed before index - from: [IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, ABSENT] kind: Precedence @@ -672,15 +669,23 @@ ALTER TABLE defaultdb.foo DROP COLUMN v1 CASCADE; - from: [IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 2}, ABSENT] to: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT] kind: Precedence - rules: [secondary index columns removed before removing the index; dependents removed before index] + rule: dependents removed before index - from: [IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 3}, PUBLIC] to: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, BACKFILLED] kind: Precedence rule: index-column added to index before index is backfilled +- from: [IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 3}, PUBLIC] + to: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, PUBLIC] + kind: Precedence + rule: index dependents exist before index becomes public - from: [IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 4}, PUBLIC] to: [TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, WRITE_ONLY] kind: Precedence rule: index-column added to index before temp index receives writes +- from: [IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 4}, TRANSIENT_ABSENT] + to: [TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, TRANSIENT_ABSENT] + kind: Precedence + rule: dependents removed before index - from: [IndexName:{DescID: 107, Name: foo_pkey, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, ABSENT] kind: Precedence @@ -688,7 +693,7 @@ ALTER TABLE defaultdb.foo DROP COLUMN v1 CASCADE; - from: [IndexName:{DescID: 107, Name: foo_pkey, IndexID: 3}, PUBLIC] to: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, PUBLIC] kind: SameStagePrecedence - rule: index named right before index becomes public + rules: [index dependents exist before index becomes public; index named right before index becomes public] - from: [IndexName:{DescID: 107, Name: foo_v2_key, IndexID: 2}, ABSENT] to: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT] kind: Precedence @@ -696,23 +701,23 @@ ALTER TABLE defaultdb.foo DROP COLUMN v1 CASCADE; - from: [PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, ABSENT] to: [Column:{DescID: 107, ColumnID: 2}, ABSENT] kind: Precedence - rule: indexes containing columns reach absent before column + rule: indexes containing column reach absent before column - from: [PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, VALIDATED] to: [IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, VALIDATED] to: [IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, VALIDATED] to: [IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, VALIDATED] to: [IndexName:{DescID: 107, Name: foo_pkey, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, VALIDATED] to: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, PUBLIC] kind: SameStagePrecedence @@ -720,63 +725,43 @@ ALTER TABLE defaultdb.foo DROP COLUMN v1 CASCADE; - from: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, BACKFILL_ONLY] to: [IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 3}, PUBLIC] kind: Precedence - rule: index-column added to index after index exists + rule: index existence precedes index dependents - from: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, BACKFILL_ONLY] to: [IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 3}, PUBLIC] kind: Precedence - rule: index-column added to index after index exists + rule: index existence precedes index dependents - from: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, BACKFILL_ONLY] to: [IndexName:{DescID: 107, Name: foo_pkey, IndexID: 3}, PUBLIC] kind: Precedence - rule: index existence precedes index name and comment + rule: index existence precedes index dependents - from: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT] to: [Column:{DescID: 107, ColumnID: 2}, ABSENT] kind: Precedence - rule: indexes containing columns reach absent before column -- from: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, DELETE_ONLY] - to: [IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 2}, ABSENT] - kind: Precedence - rule: secondary index in DELETE_ONLY before removing columns -- from: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, DELETE_ONLY] - to: [IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 2}, ABSENT] - kind: Precedence - rule: secondary index in DELETE_ONLY before removing columns -- from: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, DELETE_ONLY] - to: [IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 2}, ABSENT] - kind: Precedence - rule: secondary index in DELETE_ONLY before removing columns + rule: indexes containing column reach absent before column - from: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 2}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 2}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 2}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, VALIDATED] to: [IndexName:{DescID: 107, Name: foo_v2_key, IndexID: 2}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, DELETE_ONLY] to: [IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 4}, PUBLIC] kind: Precedence - rules: [temp index exists before columns, partitioning, and partial; index-column added to index after temp index exists] + rule: temp index existence precedes index dependents - from: [TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, DELETE_ONLY] to: [IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 4}, PUBLIC] kind: Precedence - rules: [temp index exists before columns, partitioning, and partial; index-column added to index after temp index exists] -- from: [TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, TRANSIENT_ABSENT] - to: [PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, ABSENT] - kind: SameStagePrecedence - rule: temp indexes reach absent at the same time as other indexes -- from: [TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, TRANSIENT_ABSENT] - to: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT] - kind: SameStagePrecedence - rule: temp indexes reach absent at the same time as other indexes + rule: temp index existence precedes index dependents - from: [TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, WRITE_ONLY] to: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, BACKFILLED] kind: Precedence @@ -881,31 +866,9 @@ StatementPhase stage 1 of 1 with 12 MutationType ops [[IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 3}, PUBLIC], ABSENT] -> PUBLIC [[IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 3}, PUBLIC], ABSENT] -> PUBLIC [[TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, TRANSIENT_ABSENT], ABSENT] -> DELETE_ONLY - [[IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 4}, PUBLIC], ABSENT] -> PUBLIC - [[IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 4}, PUBLIC], ABSENT] -> PUBLIC + [[IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 4}, TRANSIENT_ABSENT], ABSENT] -> PUBLIC + [[IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 4}, TRANSIENT_ABSENT], ABSENT] -> PUBLIC ops: - *scop.MakeDroppedColumnDeleteAndWriteOnly - ColumnID: 3 - TableID: 107 - *scop.LogEvent - Element: - Column: - columnId: 3 - pgAttributeNum: 3 - tableId: 107 - EventBase: - Authorization: - UserName: root - Statement: ALTER TABLE ‹defaultdb›.public.‹foo› DROP COLUMN ‹v2› CASCADE - StatementTag: ALTER TABLE - TargetMetadata: - SourceElementID: 1 - SubWorkID: 1 - TargetStatus: 1 - *scop.SetColumnName - ColumnID: 3 - Name: crdb_internal_column_3_name_placeholder - TableID: 107 *scop.MakeDroppedNonPrimaryIndexDeleteAndWriteOnly IndexID: 2 TableID: 107 @@ -949,6 +912,28 @@ StatementPhase stage 1 of 1 with 12 MutationType ops IndexID: 4 Kind: 2 TableID: 107 + *scop.MakeDroppedColumnDeleteAndWriteOnly + ColumnID: 3 + TableID: 107 + *scop.LogEvent + Element: + Column: + columnId: 3 + pgAttributeNum: 3 + tableId: 107 + EventBase: + Authorization: + UserName: root + Statement: ALTER TABLE ‹defaultdb›.public.‹foo› DROP COLUMN ‹v2› CASCADE + StatementTag: ALTER TABLE + TargetMetadata: + SourceElementID: 1 + SubWorkID: 1 + TargetStatus: 1 + *scop.SetColumnName + ColumnID: 3 + Name: crdb_internal_column_3_name_placeholder + TableID: 107 PreCommitPhase stage 1 of 1 with 6 MutationType ops transitions: ops: @@ -1081,7 +1066,7 @@ PostCommitPhase stage 7 of 7 with 1 ValidationType op *scop.ValidateUniqueIndex IndexID: 3 TableID: 107 -PostCommitNonRevertiblePhase stage 1 of 3 with 26 MutationType ops +PostCommitNonRevertiblePhase stage 1 of 3 with 20 MutationType ops transitions: [[Column:{DescID: 107, ColumnID: 3}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 1}, ABSENT], PUBLIC] -> ABSENT @@ -1117,6 +1102,8 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 26 MutationType ops [[PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, PUBLIC], VALIDATED] -> PUBLIC [[IndexName:{DescID: 107, Name: foo_pkey, IndexID: 3}, PUBLIC], ABSENT] -> PUBLIC [[TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, TRANSIENT_ABSENT], WRITE_ONLY] -> TRANSIENT_DELETE_ONLY + [[IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 4}, TRANSIENT_ABSENT], PUBLIC] -> TRANSIENT_ABSENT + [[IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 4}, TRANSIENT_ABSENT], PUBLIC] -> TRANSIENT_ABSENT ops: *scop.MakeDroppedColumnDeleteOnly ColumnID: 3 @@ -1155,21 +1142,6 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 26 MutationType ops *scop.MakeDroppedIndexDeleteOnly IndexID: 4 TableID: 107 - *scop.RemoveColumnFromIndex - ColumnID: 1 - IndexID: 1 - TableID: 107 - *scop.RemoveColumnFromIndex - ColumnID: 2 - IndexID: 1 - Kind: 2 - TableID: 107 - *scop.RemoveColumnFromIndex - ColumnID: 3 - IndexID: 1 - Kind: 2 - Ordinal: 1 - TableID: 107 *scop.MakeDroppedIndexDeleteOnly IndexID: 2 TableID: 107 @@ -1190,20 +1162,6 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 26 MutationType ops SubWorkID: 1 IndexID: 3 TableID: 107 - *scop.RemoveColumnFromIndex - ColumnID: 3 - IndexID: 2 - TableID: 107 - *scop.RemoveColumnFromIndex - ColumnID: 1 - IndexID: 2 - Kind: 1 - TableID: 107 - *scop.RemoveColumnFromIndex - ColumnID: 2 - IndexID: 2 - Kind: 2 - TableID: 107 *scop.SetJobStateOnDescriptor DescriptorID: 104 *scop.SetJobStateOnDescriptor @@ -1217,19 +1175,45 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 26 MutationType ops *scop.UpdateSchemaChangerJob IsNonCancelable: true JobID: 1 -PostCommitNonRevertiblePhase stage 2 of 3 with 13 MutationType ops +PostCommitNonRevertiblePhase stage 2 of 3 with 18 MutationType ops transitions: [[PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, ABSENT], WRITE_ONLY] -> DELETE_ONLY + [[SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT], DELETE_ONLY] -> ABSENT [[View:{DescID: 108}, ABSENT], DROPPED] -> ABSENT [[Column:{DescID: 108, ColumnID: 1}, ABSENT], DELETE_ONLY] -> ABSENT [[Column:{DescID: 108, ColumnID: 2}, ABSENT], DELETE_ONLY] -> ABSENT [[Column:{DescID: 108, ColumnID: 3}, ABSENT], DELETE_ONLY] -> ABSENT [[Column:{DescID: 108, ColumnID: 4294967295}, ABSENT], DELETE_ONLY] -> ABSENT [[Column:{DescID: 108, ColumnID: 4294967294}, ABSENT], DELETE_ONLY] -> ABSENT + [[TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, TRANSIENT_ABSENT], TRANSIENT_DELETE_ONLY] -> TRANSIENT_ABSENT ops: *scop.MakeDroppedIndexDeleteOnly IndexID: 1 TableID: 107 + *scop.LogEvent + Element: + SecondaryIndex: + constraintId: 1 + indexId: 2 + isUnique: true + tableId: 107 + EventBase: + Authorization: + UserName: root + Statement: ALTER TABLE ‹defaultdb›.public.‹foo› DROP COLUMN ‹v2› CASCADE + StatementTag: ALTER TABLE + TargetMetadata: + SourceElementID: 1 + SubWorkID: 1 + TargetStatus: 1 + *scop.CreateGcJobForIndex + IndexID: 2 + StatementForDropJob: + Statement: ALTER TABLE defaultdb.public.foo DROP COLUMN v2 CASCADE + TableID: 107 + *scop.MakeIndexAbsent + IndexID: 2 + TableID: 107 *scop.LogEvent Element: View: @@ -1310,6 +1294,12 @@ PostCommitNonRevertiblePhase stage 2 of 3 with 13 MutationType ops SourceElementID: 1 SubWorkID: 1 TableID: 108 + *scop.CreateGcJobForIndex + IndexID: 4 + TableID: 107 + *scop.MakeIndexAbsent + IndexID: 4 + TableID: 107 *scop.SetJobStateOnDescriptor DescriptorID: 104 *scop.SetJobStateOnDescriptor @@ -1323,21 +1313,13 @@ PostCommitNonRevertiblePhase stage 2 of 3 with 13 MutationType ops - 108 IsNonCancelable: true JobID: 1 -PostCommitNonRevertiblePhase stage 3 of 3 with 15 MutationType ops +PostCommitNonRevertiblePhase stage 3 of 3 with 10 MutationType ops transitions: [[Column:{DescID: 107, ColumnID: 3}, ABSENT], DELETE_ONLY] -> ABSENT [[ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 3}, ABSENT], PUBLIC] -> ABSENT [[ColumnDefaultExpression:{DescID: 107, ColumnID: 3}, ABSENT], PUBLIC] -> ABSENT [[PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, ABSENT], DELETE_ONLY] -> ABSENT - [[SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT], DELETE_ONLY] -> ABSENT - [[TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, TRANSIENT_ABSENT], TRANSIENT_DELETE_ONLY] -> TRANSIENT_ABSENT ops: - *scop.CreateGcJobForIndex - IndexID: 4 - TableID: 107 - *scop.MakeIndexAbsent - IndexID: 4 - TableID: 107 *scop.CreateGcJobForIndex IndexID: 1 StatementForDropJob: @@ -1354,30 +1336,6 @@ PostCommitNonRevertiblePhase stage 3 of 3 with 15 MutationType ops SubWorkID: 1 IndexID: 1 TableID: 107 - *scop.LogEvent - Element: - SecondaryIndex: - constraintId: 1 - indexId: 2 - isUnique: true - tableId: 107 - EventBase: - Authorization: - UserName: root - Statement: ALTER TABLE ‹defaultdb›.public.‹foo› DROP COLUMN ‹v2› CASCADE - StatementTag: ALTER TABLE - TargetMetadata: - SourceElementID: 1 - SubWorkID: 1 - TargetStatus: 1 - *scop.CreateGcJobForIndex - IndexID: 2 - StatementForDropJob: - Statement: ALTER TABLE defaultdb.public.foo DROP COLUMN v2 CASCADE - TableID: 107 - *scop.MakeIndexAbsent - IndexID: 2 - TableID: 107 *scop.RemoveColumnDefaultExpression ColumnID: 3 TableID: 107 @@ -1416,54 +1374,70 @@ PostCommitNonRevertiblePhase stage 3 of 3 with 15 MutationType ops deps ALTER TABLE defaultdb.foo DROP COLUMN v2 CASCADE; ---- +- from: [Column:{DescID: 107, ColumnID: 3}, WRITE_ONLY] + to: [ColumnDefaultExpression:{DescID: 107, ColumnID: 3}, ABSENT] + kind: Precedence + rule: column no longer public before dependents - from: [Column:{DescID: 107, ColumnID: 3}, WRITE_ONLY] to: [ColumnName:{DescID: 107, Name: v2, ColumnID: 3}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 107, ColumnID: 3}, WRITE_ONLY] to: [ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 3}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents +- from: [Column:{DescID: 107, ColumnID: 3}, WRITE_ONLY] + to: [IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 1}, ABSENT] + kind: Precedence + rule: column no longer public before dependents +- from: [Column:{DescID: 107, ColumnID: 3}, WRITE_ONLY] + to: [IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 2}, ABSENT] + kind: Precedence + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 108, Name: k, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 2}, WRITE_ONLY] to: [ColumnName:{DescID: 108, Name: v1, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 2}, WRITE_ONLY] to: [ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 3}, WRITE_ONLY] to: [ColumnName:{DescID: 108, Name: v2, ColumnID: 3}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 3}, WRITE_ONLY] to: [ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 3}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 108, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 108, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents +- from: [ColumnDefaultExpression:{DescID: 107, ColumnID: 3}, ABSENT] + to: [Column:{DescID: 107, ColumnID: 3}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [ColumnDefaultExpression:{DescID: 107, ColumnID: 3}, ABSENT] to: [ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 3}, ABSENT] kind: SameStagePrecedence @@ -1523,15 +1497,23 @@ ALTER TABLE defaultdb.foo DROP COLUMN v2 CASCADE; - from: [IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 2}, ABSENT] to: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT] kind: Precedence - rules: [secondary index columns removed before removing the index; dependents removed before index] + rule: dependents removed before index - from: [IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 3}, PUBLIC] to: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, BACKFILLED] kind: Precedence rule: index-column added to index before index is backfilled +- from: [IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 3}, PUBLIC] + to: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, PUBLIC] + kind: Precedence + rule: index dependents exist before index becomes public - from: [IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 4}, PUBLIC] to: [TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, WRITE_ONLY] kind: Precedence rule: index-column added to index before temp index receives writes +- from: [IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 4}, TRANSIENT_ABSENT] + to: [TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, TRANSIENT_ABSENT] + kind: Precedence + rule: dependents removed before index - from: [IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, ABSENT] kind: Precedence @@ -1539,23 +1521,39 @@ ALTER TABLE defaultdb.foo DROP COLUMN v2 CASCADE; - from: [IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 2}, ABSENT] to: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT] kind: Precedence - rules: [secondary index columns removed before removing the index; dependents removed before index] + rule: dependents removed before index - from: [IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 3}, PUBLIC] to: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, BACKFILLED] kind: Precedence rule: index-column added to index before index is backfilled +- from: [IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 3}, PUBLIC] + to: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, PUBLIC] + kind: Precedence + rule: index dependents exist before index becomes public - from: [IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 4}, PUBLIC] to: [TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, WRITE_ONLY] kind: Precedence rule: index-column added to index before temp index receives writes +- from: [IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 4}, TRANSIENT_ABSENT] + to: [TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, TRANSIENT_ABSENT] + kind: Precedence + rule: dependents removed before index +- from: [IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 1}, ABSENT] + to: [Column:{DescID: 107, ColumnID: 3}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, ABSENT] kind: Precedence rule: dependents removed before index +- from: [IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 2}, ABSENT] + to: [Column:{DescID: 107, ColumnID: 3}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 2}, ABSENT] to: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT] kind: Precedence - rules: [secondary index columns removed before removing the index; dependents removed before index] + rule: dependents removed before index - from: [IndexName:{DescID: 107, Name: foo_pkey, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, ABSENT] kind: Precedence @@ -1563,7 +1561,7 @@ ALTER TABLE defaultdb.foo DROP COLUMN v2 CASCADE; - from: [IndexName:{DescID: 107, Name: foo_pkey, IndexID: 3}, PUBLIC] to: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, PUBLIC] kind: SameStagePrecedence - rule: index named right before index becomes public + rules: [index dependents exist before index becomes public; index named right before index becomes public] - from: [IndexName:{DescID: 107, Name: foo_v2_key, IndexID: 2}, ABSENT] to: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT] kind: Precedence @@ -1571,23 +1569,23 @@ ALTER TABLE defaultdb.foo DROP COLUMN v2 CASCADE; - from: [PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, ABSENT] to: [Column:{DescID: 107, ColumnID: 3}, ABSENT] kind: Precedence - rule: indexes containing columns reach absent before column + rule: indexes containing column reach absent before column - from: [PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, VALIDATED] to: [IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, VALIDATED] to: [IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, VALIDATED] to: [IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, VALIDATED] to: [IndexName:{DescID: 107, Name: foo_pkey, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, VALIDATED] to: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, PUBLIC] kind: SameStagePrecedence @@ -1595,63 +1593,47 @@ ALTER TABLE defaultdb.foo DROP COLUMN v2 CASCADE; - from: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, BACKFILL_ONLY] to: [IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 3}, PUBLIC] kind: Precedence - rule: index-column added to index after index exists + rule: index existence precedes index dependents - from: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, BACKFILL_ONLY] to: [IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 3}, PUBLIC] kind: Precedence - rule: index-column added to index after index exists + rule: index existence precedes index dependents - from: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, BACKFILL_ONLY] to: [IndexName:{DescID: 107, Name: foo_pkey, IndexID: 3}, PUBLIC] kind: Precedence - rule: index existence precedes index name and comment + rule: index existence precedes index dependents - from: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT] to: [Column:{DescID: 107, ColumnID: 3}, ABSENT] kind: Precedence - rule: indexes containing columns reach absent before column -- from: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, DELETE_ONLY] - to: [IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 2}, ABSENT] - kind: Precedence - rule: secondary index in DELETE_ONLY before removing columns -- from: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, DELETE_ONLY] - to: [IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 2}, ABSENT] - kind: Precedence - rule: secondary index in DELETE_ONLY before removing columns -- from: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, DELETE_ONLY] - to: [IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 2}, ABSENT] + rule: indexes containing column reach absent before column +- from: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, VALIDATED] + to: [Column:{DescID: 107, ColumnID: 3}, WRITE_ONLY] kind: Precedence - rule: secondary index in DELETE_ONLY before removing columns + rule: secondary indexes containing column as key reach write-only before column - from: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 2}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 2}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 2}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, VALIDATED] to: [IndexName:{DescID: 107, Name: foo_v2_key, IndexID: 2}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, DELETE_ONLY] to: [IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 4}, PUBLIC] kind: Precedence - rules: [temp index exists before columns, partitioning, and partial; index-column added to index after temp index exists] + rule: temp index existence precedes index dependents - from: [TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, DELETE_ONLY] to: [IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 4}, PUBLIC] kind: Precedence - rules: [temp index exists before columns, partitioning, and partial; index-column added to index after temp index exists] -- from: [TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, TRANSIENT_ABSENT] - to: [PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, ABSENT] - kind: SameStagePrecedence - rule: temp indexes reach absent at the same time as other indexes -- from: [TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, TRANSIENT_ABSENT] - to: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT] - kind: SameStagePrecedence - rule: temp indexes reach absent at the same time as other indexes + rule: temp index existence precedes index dependents - from: [TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, WRITE_ONLY] to: [PrimaryIndex:{DescID: 107, IndexID: 3, ConstraintID: 3, TemporaryIndexID: 4, SourceIndexID: 1}, BACKFILLED] kind: Precedence diff --git a/pkg/sql/schemachanger/scplan/testdata/create_index b/pkg/sql/schemachanger/scplan/testdata/create_index index 41dc6a29b337..fccb19b04d9e 100644 --- a/pkg/sql/schemachanger/scplan/testdata/create_index +++ b/pkg/sql/schemachanger/scplan/testdata/create_index @@ -187,58 +187,58 @@ CREATE INDEX id1 ON defaultdb.t1 (id, name) STORING (money) to: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILLED] kind: Precedence rule: index-column added to index before index is backfilled -- from: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, PUBLIC] - to: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 0, SourceIndexID: 1}, WRITE_ONLY] +- from: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2}, PUBLIC] + to: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC] kind: Precedence - rule: index-column added to index before temp index receives writes + rule: index dependents exist before index becomes public - from: [IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2}, PUBLIC] to: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILLED] kind: Precedence rule: index-column added to index before index is backfilled -- from: [IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, PUBLIC] - to: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 0, SourceIndexID: 1}, WRITE_ONLY] +- from: [IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2}, PUBLIC] + to: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC] kind: Precedence - rule: index-column added to index before temp index receives writes + rule: index dependents exist before index becomes public - from: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2}, PUBLIC] to: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILLED] kind: Precedence rule: index-column added to index before index is backfilled -- from: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3}, PUBLIC] - to: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 0, SourceIndexID: 1}, WRITE_ONLY] +- from: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2}, PUBLIC] + to: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC] kind: Precedence - rule: index-column added to index before temp index receives writes + rule: index dependents exist before index becomes public - from: [IndexName:{DescID: 104, Name: id1, IndexID: 2}, PUBLIC] to: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC] kind: SameStagePrecedence - rule: index named right before index becomes public + rules: [index dependents exist before index becomes public; index named right before index becomes public] - from: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILL_ONLY] to: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2}, PUBLIC] kind: Precedence - rule: index-column added to index after index exists + rule: index existence precedes index dependents - from: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILL_ONLY] to: [IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2}, PUBLIC] kind: Precedence - rule: index-column added to index after index exists + rule: index existence precedes index dependents - from: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILL_ONLY] to: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2}, PUBLIC] kind: Precedence - rule: index-column added to index after index exists + rule: index existence precedes index dependents - from: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILL_ONLY] to: [IndexName:{DescID: 104, Name: id1, IndexID: 2}, PUBLIC] kind: Precedence - rule: index existence precedes index name and comment + rule: index existence precedes index dependents - from: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 0, SourceIndexID: 1}, DELETE_ONLY] to: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, PUBLIC] kind: Precedence - rules: [temp index exists before columns, partitioning, and partial; index-column added to index after temp index exists] + rule: temp index existence precedes index dependents - from: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 0, SourceIndexID: 1}, DELETE_ONLY] to: [IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, PUBLIC] kind: Precedence - rules: [temp index exists before columns, partitioning, and partial; index-column added to index after temp index exists] + rule: temp index existence precedes index dependents - from: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 0, SourceIndexID: 1}, DELETE_ONLY] to: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3}, PUBLIC] kind: Precedence - rules: [temp index exists before columns, partitioning, and partial; index-column added to index after temp index exists] + rule: temp index existence precedes index dependents - from: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 0, SourceIndexID: 1}, WRITE_ONLY] to: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILLED] kind: Precedence @@ -434,58 +434,58 @@ CREATE INDEX id1 ON defaultdb.t1 (id, name) STORING (money) to: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILLED] kind: Precedence rule: index-column added to index before index is backfilled -- from: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, PUBLIC] - to: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 0, SourceIndexID: 1}, WRITE_ONLY] +- from: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2}, PUBLIC] + to: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC] kind: Precedence - rule: index-column added to index before temp index receives writes + rule: index dependents exist before index becomes public - from: [IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2}, PUBLIC] to: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILLED] kind: Precedence rule: index-column added to index before index is backfilled -- from: [IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, PUBLIC] - to: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 0, SourceIndexID: 1}, WRITE_ONLY] +- from: [IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2}, PUBLIC] + to: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC] kind: Precedence - rule: index-column added to index before temp index receives writes + rule: index dependents exist before index becomes public - from: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2}, PUBLIC] to: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILLED] kind: Precedence rule: index-column added to index before index is backfilled -- from: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3}, PUBLIC] - to: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 0, SourceIndexID: 1}, WRITE_ONLY] +- from: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2}, PUBLIC] + to: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC] kind: Precedence - rule: index-column added to index before temp index receives writes + rule: index dependents exist before index becomes public - from: [IndexName:{DescID: 104, Name: id1, IndexID: 2}, PUBLIC] to: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, PUBLIC] kind: SameStagePrecedence - rule: index named right before index becomes public + rules: [index dependents exist before index becomes public; index named right before index becomes public] - from: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILL_ONLY] to: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2}, PUBLIC] kind: Precedence - rule: index-column added to index after index exists + rule: index existence precedes index dependents - from: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILL_ONLY] to: [IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2}, PUBLIC] kind: Precedence - rule: index-column added to index after index exists + rule: index existence precedes index dependents - from: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILL_ONLY] to: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2}, PUBLIC] kind: Precedence - rule: index-column added to index after index exists + rule: index existence precedes index dependents - from: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILL_ONLY] to: [IndexName:{DescID: 104, Name: id1, IndexID: 2}, PUBLIC] kind: Precedence - rule: index existence precedes index name and comment + rule: index existence precedes index dependents - from: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 0, SourceIndexID: 1}, DELETE_ONLY] to: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3}, PUBLIC] kind: Precedence - rules: [temp index exists before columns, partitioning, and partial; index-column added to index after temp index exists] + rule: temp index existence precedes index dependents - from: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 0, SourceIndexID: 1}, DELETE_ONLY] to: [IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3}, PUBLIC] kind: Precedence - rules: [temp index exists before columns, partitioning, and partial; index-column added to index after temp index exists] + rule: temp index existence precedes index dependents - from: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 0, SourceIndexID: 1}, DELETE_ONLY] to: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3}, PUBLIC] kind: Precedence - rules: [temp index exists before columns, partitioning, and partial; index-column added to index after temp index exists] + rule: temp index existence precedes index dependents - from: [TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 0, SourceIndexID: 1}, WRITE_ONLY] to: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1}, BACKFILLED] kind: Precedence diff --git a/pkg/sql/schemachanger/scplan/testdata/drop_database b/pkg/sql/schemachanger/scplan/testdata/drop_database index b0f5fcaad881..df01e4e73800 100644 --- a/pkg/sql/schemachanger/scplan/testdata/drop_database +++ b/pkg/sql/schemachanger/scplan/testdata/drop_database @@ -1338,247 +1338,287 @@ DROP DATABASE db1 CASCADE - from: [Column:{DescID: 109, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 109, Name: id, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents +- from: [Column:{DescID: 109, ColumnID: 1}, WRITE_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 1}, ABSENT] + kind: Precedence + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 2}, WRITE_ONLY] to: [ColumnName:{DescID: 109, Name: name, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 2}, WRITE_ONLY] to: [ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents +- from: [Column:{DescID: 109, ColumnID: 2}, WRITE_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 1}, ABSENT] + kind: Precedence + rule: column no longer public before dependents +- from: [Column:{DescID: 109, ColumnID: 3}, WRITE_ONLY] + to: [ColumnDefaultExpression:{DescID: 109, ColumnID: 3}, ABSENT] + kind: Precedence + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 3}, WRITE_ONLY] to: [ColumnName:{DescID: 109, Name: val, ColumnID: 3}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 3}, WRITE_ONLY] to: [ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 3}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents +- from: [Column:{DescID: 109, ColumnID: 3}, WRITE_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 3, IndexID: 1}, ABSENT] + kind: Precedence + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 109, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 109, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 110, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 110, Name: id, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 110, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 110, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents +- from: [Column:{DescID: 110, ColumnID: 1}, WRITE_ONLY] + to: [IndexColumn:{DescID: 110, ColumnID: 1, IndexID: 1}, ABSENT] + kind: Precedence + rule: column no longer public before dependents - from: [Column:{DescID: 110, ColumnID: 2}, WRITE_ONLY] to: [ColumnName:{DescID: 110, Name: name, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 110, ColumnID: 2}, WRITE_ONLY] to: [ColumnType:{DescID: 110, ColumnFamilyID: 0, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents +- from: [Column:{DescID: 110, ColumnID: 2}, WRITE_ONLY] + to: [IndexColumn:{DescID: 110, ColumnID: 2, IndexID: 1}, ABSENT] + kind: Precedence + rule: column no longer public before dependents +- from: [Column:{DescID: 110, ColumnID: 3}, WRITE_ONLY] + to: [ColumnDefaultExpression:{DescID: 110, ColumnID: 3}, ABSENT] + kind: Precedence + rule: column no longer public before dependents - from: [Column:{DescID: 110, ColumnID: 3}, WRITE_ONLY] to: [ColumnName:{DescID: 110, Name: val, ColumnID: 3}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 110, ColumnID: 3}, WRITE_ONLY] to: [ColumnType:{DescID: 110, ColumnFamilyID: 0, ColumnID: 3}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents +- from: [Column:{DescID: 110, ColumnID: 3}, WRITE_ONLY] + to: [IndexColumn:{DescID: 110, ColumnID: 3, IndexID: 1}, ABSENT] + kind: Precedence + rule: column no longer public before dependents - from: [Column:{DescID: 110, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 110, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 110, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 110, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 110, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 110, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 110, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 110, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 111, Name: name, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 111, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 111, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 111, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 111, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 111, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 112, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 112, Name: n1, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 112, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 112, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 112, ColumnID: 2}, WRITE_ONLY] to: [ColumnName:{DescID: 112, Name: n2, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 112, ColumnID: 2}, WRITE_ONLY] to: [ColumnType:{DescID: 112, ColumnFamilyID: 0, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 112, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 112, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 112, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 112, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 112, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 112, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 112, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 112, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 113, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 113, Name: name, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 113, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 113, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 113, ColumnID: 2}, WRITE_ONLY] to: [ColumnName:{DescID: 113, Name: n1, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 113, ColumnID: 2}, WRITE_ONLY] to: [ColumnType:{DescID: 113, ColumnFamilyID: 0, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 113, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 113, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 113, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 113, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 113, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 113, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 113, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 113, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 114, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 114, Name: n2, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 114, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 114, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 114, ColumnID: 2}, WRITE_ONLY] to: [ColumnName:{DescID: 114, Name: n1, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 114, ColumnID: 2}, WRITE_ONLY] to: [ColumnType:{DescID: 114, ColumnFamilyID: 0, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 114, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 114, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 114, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 114, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 114, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 114, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 114, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 114, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 117, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 117, Name: k, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 117, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 117, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 117, ColumnID: 2}, WRITE_ONLY] to: [ColumnName:{DescID: 117, Name: n2, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 117, ColumnID: 2}, WRITE_ONLY] to: [ColumnType:{DescID: 117, ColumnFamilyID: 0, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 117, ColumnID: 3}, WRITE_ONLY] to: [ColumnName:{DescID: 117, Name: n1, ColumnID: 3}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 117, ColumnID: 3}, WRITE_ONLY] to: [ColumnType:{DescID: 117, ColumnFamilyID: 0, ColumnID: 3}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 117, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 117, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 117, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 117, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 117, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 117, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 117, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 117, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents +- from: [ColumnDefaultExpression:{DescID: 109, ColumnID: 3}, ABSENT] + to: [Column:{DescID: 109, ColumnID: 3}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [ColumnDefaultExpression:{DescID: 109, ColumnID: 3}, ABSENT] to: [ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 3}, ABSENT] kind: SameStagePrecedence rule: column type dependents removed right before column type +- from: [ColumnDefaultExpression:{DescID: 110, ColumnID: 3}, ABSENT] + to: [Column:{DescID: 110, ColumnID: 3}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [ColumnDefaultExpression:{DescID: 110, ColumnID: 3}, ABSENT] to: [ColumnType:{DescID: 110, ColumnFamilyID: 0, ColumnID: 3}, ABSENT] kind: SameStagePrecedence @@ -1939,26 +1979,50 @@ DROP DATABASE db1 CASCADE to: [UserPrivileges:{DescID: 115, Name: root}, ABSENT] kind: SameStagePrecedence rule: descriptor drop right before dependent element removal +- from: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 1}, ABSENT] + to: [Column:{DescID: 109, ColumnID: 1}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, ABSENT] kind: Precedence rule: dependents removed before index +- from: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 1}, ABSENT] + to: [Column:{DescID: 109, ColumnID: 2}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, ABSENT] kind: Precedence rule: dependents removed before index +- from: [IndexColumn:{DescID: 109, ColumnID: 3, IndexID: 1}, ABSENT] + to: [Column:{DescID: 109, ColumnID: 3}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 109, ColumnID: 3, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, ABSENT] kind: Precedence rule: dependents removed before index +- from: [IndexColumn:{DescID: 110, ColumnID: 1, IndexID: 1}, ABSENT] + to: [Column:{DescID: 110, ColumnID: 1}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 110, ColumnID: 1, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 110, IndexID: 1, ConstraintID: 1}, ABSENT] kind: Precedence rule: dependents removed before index +- from: [IndexColumn:{DescID: 110, ColumnID: 2, IndexID: 1}, ABSENT] + to: [Column:{DescID: 110, ColumnID: 2}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 110, ColumnID: 2, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 110, IndexID: 1, ConstraintID: 1}, ABSENT] kind: Precedence rule: dependents removed before index +- from: [IndexColumn:{DescID: 110, ColumnID: 3, IndexID: 1}, ABSENT] + to: [Column:{DescID: 110, ColumnID: 3}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 110, ColumnID: 3, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 110, IndexID: 1, ConstraintID: 1}, ABSENT] kind: Precedence @@ -1974,35 +2038,35 @@ DROP DATABASE db1 CASCADE - from: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 109, ColumnID: 3, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexName:{DescID: 109, Name: t1_pkey, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 110, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 110, ColumnID: 1, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 110, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 110, ColumnID: 2, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 110, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 110, ColumnID: 3, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 110, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexName:{DescID: 110, Name: t1_pkey, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [Schema:{DescID: 105}, DROPPED] to: [Namespace:{DescID: 105, Name: public, ReferencedDescID: 104}, ABSENT] kind: SameStagePrecedence diff --git a/pkg/sql/schemachanger/scplan/testdata/drop_index b/pkg/sql/schemachanger/scplan/testdata/drop_index index 5e7ed7bebfc6..76ec4d19e4cc 100644 --- a/pkg/sql/schemachanger/scplan/testdata/drop_index +++ b/pkg/sql/schemachanger/scplan/testdata/drop_index @@ -40,12 +40,12 @@ PreCommitPhase stage 1 of 1 with 2 MutationType ops - 104 JobID: 1 NonCancelable: true - RunningStatus: PostCommitNonRevertiblePhase stage 1 of 2 with 3 MutationType ops pending + RunningStatus: PostCommitNonRevertiblePhase stage 1 of 2 with 1 MutationType op pending Statements: - statement: DROP INDEX idx1 CASCADE redactedstatement: DROP INDEX ‹defaultdb›.public.‹t1›@‹idx1› CASCADE statementtag: DROP INDEX -PostCommitNonRevertiblePhase stage 1 of 2 with 5 MutationType ops +PostCommitNonRevertiblePhase stage 1 of 2 with 3 MutationType ops transitions: [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2}, ABSENT], PUBLIC] -> ABSENT [[IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2}, ABSENT], PUBLIC] -> ABSENT @@ -54,15 +54,6 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 5 MutationType ops *scop.MakeDroppedIndexDeleteOnly IndexID: 2 TableID: 104 - *scop.RemoveColumnFromIndex - ColumnID: 1 - IndexID: 2 - TableID: 104 - *scop.RemoveColumnFromIndex - ColumnID: 3 - IndexID: 2 - Kind: 1 - TableID: 104 *scop.SetJobStateOnDescriptor DescriptorID: 104 *scop.UpdateSchemaChangerJob @@ -108,35 +99,27 @@ DROP INDEX idx1 CASCADE - from: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2}, ABSENT] to: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0}, ABSENT] kind: Precedence - rules: [secondary index columns removed before removing the index; dependents removed before index] + rule: dependents removed before index - from: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2}, ABSENT] to: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0}, ABSENT] kind: Precedence - rules: [secondary index columns removed before removing the index; dependents removed before index] + rule: dependents removed before index - from: [IndexName:{DescID: 104, Name: idx1, IndexID: 2}, ABSENT] to: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0}, ABSENT] kind: Precedence rule: dependents removed before index -- from: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0}, DELETE_ONLY] - to: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2}, ABSENT] - kind: Precedence - rule: secondary index in DELETE_ONLY before removing columns -- from: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0}, DELETE_ONLY] - to: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2}, ABSENT] - kind: Precedence - rule: secondary index in DELETE_ONLY before removing columns - from: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0}, VALIDATED] to: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0}, VALIDATED] to: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0}, VALIDATED] to: [IndexName:{DescID: 104, Name: idx1, IndexID: 2}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents ops DROP INDEX idx2 CASCADE @@ -148,6 +131,13 @@ StatementPhase stage 1 of 1 with 5 MutationType ops [[SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 0}, ABSENT], PUBLIC] -> VALIDATED [[IndexName:{DescID: 104, Name: idx2, IndexID: 4}, ABSENT], PUBLIC] -> ABSENT ops: + *scop.MakeDroppedNonPrimaryIndexDeleteAndWriteOnly + IndexID: 4 + TableID: 104 + *scop.SetIndexName + IndexID: 4 + Name: crdb_internal_index_4_name_placeholder + TableID: 104 *scop.MakeDroppedColumnDeleteAndWriteOnly ColumnID: 4 TableID: 104 @@ -171,13 +161,6 @@ StatementPhase stage 1 of 1 with 5 MutationType ops ColumnID: 4 Name: crdb_internal_column_4_name_placeholder TableID: 104 - *scop.MakeDroppedNonPrimaryIndexDeleteAndWriteOnly - IndexID: 4 - TableID: 104 - *scop.SetIndexName - IndexID: 4 - Name: crdb_internal_index_4_name_placeholder - TableID: 104 PreCommitPhase stage 1 of 1 with 2 MutationType ops transitions: ops: @@ -191,12 +174,12 @@ PreCommitPhase stage 1 of 1 with 2 MutationType ops - 104 JobID: 1 NonCancelable: true - RunningStatus: PostCommitNonRevertiblePhase stage 1 of 2 with 4 MutationType ops pending + RunningStatus: PostCommitNonRevertiblePhase stage 1 of 2 with 2 MutationType ops pending Statements: - statement: DROP INDEX idx2 CASCADE redactedstatement: DROP INDEX ‹defaultdb›.public.‹t1›@‹idx2› CASCADE statementtag: DROP INDEX -PostCommitNonRevertiblePhase stage 1 of 2 with 6 MutationType ops +PostCommitNonRevertiblePhase stage 1 of 2 with 4 MutationType ops transitions: [[Column:{DescID: 104, ColumnID: 4}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 4}, ABSENT], PUBLIC] -> ABSENT @@ -209,15 +192,6 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 6 MutationType ops *scop.MakeDroppedIndexDeleteOnly IndexID: 4 TableID: 104 - *scop.RemoveColumnFromIndex - ColumnID: 4 - IndexID: 4 - TableID: 104 - *scop.RemoveColumnFromIndex - ColumnID: 3 - IndexID: 4 - Kind: 1 - TableID: 104 *scop.SetJobStateOnDescriptor DescriptorID: 104 *scop.UpdateSchemaChangerJob @@ -280,11 +254,15 @@ DROP INDEX idx2 CASCADE - from: [Column:{DescID: 104, ColumnID: 4}, WRITE_ONLY] to: [ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 104, ColumnID: 4}, WRITE_ONLY] to: [ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents +- from: [Column:{DescID: 104, ColumnID: 4}, WRITE_ONLY] + to: [IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 4}, ABSENT] + kind: Precedence + rule: column no longer public before dependents - from: [ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4}, ABSENT] to: [Column:{DescID: 104, ColumnID: 4}, ABSENT] kind: Precedence @@ -296,11 +274,15 @@ DROP INDEX idx2 CASCADE - from: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4}, ABSENT] to: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 0}, ABSENT] kind: Precedence - rules: [secondary index columns removed before removing the index; dependents removed before index] + rule: dependents removed before index +- from: [IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 4}, ABSENT] + to: [Column:{DescID: 104, ColumnID: 4}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 4}, ABSENT] to: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 0}, ABSENT] kind: Precedence - rules: [secondary index columns removed before removing the index; dependents removed before index] + rule: dependents removed before index - from: [IndexName:{DescID: 104, Name: idx2, IndexID: 4}, ABSENT] to: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 0}, ABSENT] kind: Precedence @@ -308,31 +290,27 @@ DROP INDEX idx2 CASCADE - from: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 0}, ABSENT] to: [Column:{DescID: 104, ColumnID: 4}, ABSENT] kind: Precedence - rule: indexes containing columns reach absent before column -- from: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 0}, DELETE_ONLY] - to: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4}, ABSENT] - kind: Precedence - rule: secondary index in DELETE_ONLY before removing columns -- from: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 0}, DELETE_ONLY] - to: [IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 4}, ABSENT] + rule: indexes containing column reach absent before column +- from: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 0}, VALIDATED] + to: [Column:{DescID: 104, ColumnID: 4}, WRITE_ONLY] kind: Precedence - rule: secondary index in DELETE_ONLY before removing columns + rule: secondary indexes containing column as key reach write-only before column - from: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 0}, VALIDATED] to: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 0}, VALIDATED] to: [IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 4}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 0}, VALIDATED] to: [IndexName:{DescID: 104, Name: idx2, IndexID: 4}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 0}, VALIDATED] to: [SecondaryIndexPartial:{DescID: 104, IndexID: 4}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [SecondaryIndexPartial:{DescID: 104, IndexID: 4}, ABSENT] to: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 0}, ABSENT] kind: SameStagePrecedence @@ -348,6 +326,13 @@ StatementPhase stage 1 of 1 with 5 MutationType ops [[SecondaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 0}, ABSENT], PUBLIC] -> VALIDATED [[IndexName:{DescID: 104, Name: idx3, IndexID: 6}, ABSENT], PUBLIC] -> ABSENT ops: + *scop.MakeDroppedNonPrimaryIndexDeleteAndWriteOnly + IndexID: 6 + TableID: 104 + *scop.SetIndexName + IndexID: 6 + Name: crdb_internal_index_6_name_placeholder + TableID: 104 *scop.MakeDroppedColumnDeleteAndWriteOnly ColumnID: 5 TableID: 104 @@ -371,13 +356,6 @@ StatementPhase stage 1 of 1 with 5 MutationType ops ColumnID: 5 Name: crdb_internal_column_5_name_placeholder TableID: 104 - *scop.MakeDroppedNonPrimaryIndexDeleteAndWriteOnly - IndexID: 6 - TableID: 104 - *scop.SetIndexName - IndexID: 6 - Name: crdb_internal_index_6_name_placeholder - TableID: 104 PreCommitPhase stage 1 of 1 with 2 MutationType ops transitions: ops: @@ -391,12 +369,12 @@ PreCommitPhase stage 1 of 1 with 2 MutationType ops - 104 JobID: 1 NonCancelable: true - RunningStatus: PostCommitNonRevertiblePhase stage 1 of 2 with 7 MutationType ops pending + RunningStatus: PostCommitNonRevertiblePhase stage 1 of 2 with 4 MutationType ops pending Statements: - statement: DROP INDEX idx3 CASCADE redactedstatement: DROP INDEX ‹defaultdb›.public.‹t1›@‹idx3› CASCADE statementtag: DROP INDEX -PostCommitNonRevertiblePhase stage 1 of 2 with 9 MutationType ops +PostCommitNonRevertiblePhase stage 1 of 2 with 6 MutationType ops transitions: [[Column:{DescID: 104, ColumnID: 5}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[IndexColumn:{DescID: 104, ColumnID: 5, IndexID: 6}, ABSENT], PUBLIC] -> ABSENT @@ -417,20 +395,6 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 9 MutationType ops *scop.MakeDroppedIndexDeleteOnly IndexID: 6 TableID: 104 - *scop.RemoveColumnFromIndex - ColumnID: 5 - IndexID: 6 - TableID: 104 - *scop.RemoveColumnFromIndex - ColumnID: 1 - IndexID: 6 - Ordinal: 1 - TableID: 104 - *scop.RemoveColumnFromIndex - ColumnID: 3 - IndexID: 6 - Kind: 1 - TableID: 104 *scop.SetJobStateOnDescriptor DescriptorID: 104 *scop.UpdateSchemaChangerJob @@ -495,11 +459,15 @@ DROP INDEX idx3 CASCADE - from: [Column:{DescID: 104, ColumnID: 5}, WRITE_ONLY] to: [ColumnName:{DescID: 104, Name: crdb_internal_i_shard_16, ColumnID: 5}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 104, ColumnID: 5}, WRITE_ONLY] to: [ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 5}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents +- from: [Column:{DescID: 104, ColumnID: 5}, WRITE_ONLY] + to: [IndexColumn:{DescID: 104, ColumnID: 5, IndexID: 6}, ABSENT] + kind: Precedence + rule: column no longer public before dependents - from: [ColumnName:{DescID: 104, Name: crdb_internal_i_shard_16, ColumnID: 5}, ABSENT] to: [Column:{DescID: 104, ColumnID: 5}, ABSENT] kind: Precedence @@ -511,15 +479,19 @@ DROP INDEX idx3 CASCADE - from: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6}, ABSENT] to: [SecondaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 0}, ABSENT] kind: Precedence - rules: [secondary index columns removed before removing the index; dependents removed before index] + rule: dependents removed before index - from: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 6}, ABSENT] to: [SecondaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 0}, ABSENT] kind: Precedence - rules: [secondary index columns removed before removing the index; dependents removed before index] + rule: dependents removed before index +- from: [IndexColumn:{DescID: 104, ColumnID: 5, IndexID: 6}, ABSENT] + to: [Column:{DescID: 104, ColumnID: 5}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 104, ColumnID: 5, IndexID: 6}, ABSENT] to: [SecondaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 0}, ABSENT] kind: Precedence - rules: [secondary index columns removed before removing the index; dependents removed before index] + rule: dependents removed before index - from: [IndexName:{DescID: 104, Name: idx3, IndexID: 6}, ABSENT] to: [SecondaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 0}, ABSENT] kind: Precedence @@ -527,35 +499,27 @@ DROP INDEX idx3 CASCADE - from: [SecondaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 0}, ABSENT] to: [Column:{DescID: 104, ColumnID: 5}, ABSENT] kind: Precedence - rule: indexes containing columns reach absent before column -- from: [SecondaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 0}, DELETE_ONLY] - to: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6}, ABSENT] - kind: Precedence - rule: secondary index in DELETE_ONLY before removing columns -- from: [SecondaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 0}, DELETE_ONLY] - to: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 6}, ABSENT] - kind: Precedence - rule: secondary index in DELETE_ONLY before removing columns -- from: [SecondaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 0}, DELETE_ONLY] - to: [IndexColumn:{DescID: 104, ColumnID: 5, IndexID: 6}, ABSENT] + rule: indexes containing column reach absent before column +- from: [SecondaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 0}, VALIDATED] + to: [Column:{DescID: 104, ColumnID: 5}, WRITE_ONLY] kind: Precedence - rule: secondary index in DELETE_ONLY before removing columns + rule: secondary indexes containing column as key reach write-only before column - from: [SecondaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 0}, VALIDATED] to: [IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [SecondaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 0}, VALIDATED] to: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 6}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [SecondaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 0}, VALIDATED] to: [IndexColumn:{DescID: 104, ColumnID: 5, IndexID: 6}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [SecondaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 0}, VALIDATED] to: [IndexName:{DescID: 104, Name: idx3, IndexID: 6}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents ops DROP INDEX idx4 CASCADE @@ -596,12 +560,12 @@ PreCommitPhase stage 1 of 1 with 3 MutationType ops - 105 JobID: 1 NonCancelable: true - RunningStatus: PostCommitNonRevertiblePhase stage 1 of 2 with 7 MutationType ops pending + RunningStatus: PostCommitNonRevertiblePhase stage 1 of 2 with 5 MutationType ops pending Statements: - statement: DROP INDEX idx4 CASCADE redactedstatement: DROP INDEX ‹defaultdb›.public.‹t1›@‹idx4› CASCADE statementtag: DROP INDEX -PostCommitNonRevertiblePhase stage 1 of 2 with 10 MutationType ops +PostCommitNonRevertiblePhase stage 1 of 2 with 8 MutationType ops transitions: [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 8}, ABSENT], PUBLIC] -> ABSENT [[IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 8}, ABSENT], PUBLIC] -> ABSENT @@ -639,15 +603,6 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 10 MutationType ops DescriptorID: 105 Name: v SchemaID: 101 - *scop.RemoveColumnFromIndex - ColumnID: 2 - IndexID: 8 - TableID: 104 - *scop.RemoveColumnFromIndex - ColumnID: 3 - IndexID: 8 - Kind: 1 - TableID: 104 *scop.SetJobStateOnDescriptor DescriptorID: 104 *scop.SetJobStateOnDescriptor @@ -759,27 +714,27 @@ DROP INDEX idx4 CASCADE - from: [Column:{DescID: 105, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 105, Name: count, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 105, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 105, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 105, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 105, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 105, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 105, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 105, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 105, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 105, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 105, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [ColumnName:{DescID: 105, Name: count, ColumnID: 1}, ABSENT] to: [Column:{DescID: 105, ColumnID: 1}, ABSENT] kind: Precedence @@ -807,35 +762,27 @@ DROP INDEX idx4 CASCADE - from: [IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 8}, ABSENT] to: [SecondaryIndex:{DescID: 104, IndexID: 8, ConstraintID: 3}, ABSENT] kind: Precedence - rules: [secondary index columns removed before removing the index; dependents removed before index] + rule: dependents removed before index - from: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 8}, ABSENT] to: [SecondaryIndex:{DescID: 104, IndexID: 8, ConstraintID: 3}, ABSENT] kind: Precedence - rules: [secondary index columns removed before removing the index; dependents removed before index] + rule: dependents removed before index - from: [IndexName:{DescID: 104, Name: idx4, IndexID: 8}, ABSENT] to: [SecondaryIndex:{DescID: 104, IndexID: 8, ConstraintID: 3}, ABSENT] kind: Precedence rule: dependents removed before index -- from: [SecondaryIndex:{DescID: 104, IndexID: 8, ConstraintID: 3}, DELETE_ONLY] - to: [IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 8}, ABSENT] - kind: Precedence - rule: secondary index in DELETE_ONLY before removing columns -- from: [SecondaryIndex:{DescID: 104, IndexID: 8, ConstraintID: 3}, DELETE_ONLY] - to: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 8}, ABSENT] - kind: Precedence - rule: secondary index in DELETE_ONLY before removing columns - from: [SecondaryIndex:{DescID: 104, IndexID: 8, ConstraintID: 3}, VALIDATED] to: [IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 8}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [SecondaryIndex:{DescID: 104, IndexID: 8, ConstraintID: 3}, VALIDATED] to: [IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 8}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [SecondaryIndex:{DescID: 104, IndexID: 8, ConstraintID: 3}, VALIDATED] to: [IndexName:{DescID: 104, Name: idx4, IndexID: 8}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [View:{DescID: 105}, ABSENT] to: [Column:{DescID: 105, ColumnID: 1}, ABSENT] kind: SameStagePrecedence diff --git a/pkg/sql/schemachanger/scplan/testdata/drop_schema b/pkg/sql/schemachanger/scplan/testdata/drop_schema index 98e18c40dbb2..afa31b2c2c72 100644 --- a/pkg/sql/schemachanger/scplan/testdata/drop_schema +++ b/pkg/sql/schemachanger/scplan/testdata/drop_schema @@ -42,203 +42,223 @@ DROP SCHEMA defaultdb.SC1 CASCADE - from: [Column:{DescID: 106, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 106, Name: id, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 106, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents +- from: [Column:{DescID: 106, ColumnID: 1}, WRITE_ONLY] + to: [IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 1}, ABSENT] + kind: Precedence + rule: column no longer public before dependents - from: [Column:{DescID: 106, ColumnID: 2}, WRITE_ONLY] to: [ColumnName:{DescID: 106, Name: name, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 106, ColumnID: 2}, WRITE_ONLY] to: [ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents +- from: [Column:{DescID: 106, ColumnID: 2}, WRITE_ONLY] + to: [IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 1}, ABSENT] + kind: Precedence + rule: column no longer public before dependents +- from: [Column:{DescID: 106, ColumnID: 3}, WRITE_ONLY] + to: [ColumnDefaultExpression:{DescID: 106, ColumnID: 3}, ABSENT] + kind: Precedence + rule: column no longer public before dependents - from: [Column:{DescID: 106, ColumnID: 3}, WRITE_ONLY] to: [ColumnName:{DescID: 106, Name: val, ColumnID: 3}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 106, ColumnID: 3}, WRITE_ONLY] to: [ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 3}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents +- from: [Column:{DescID: 106, ColumnID: 3}, WRITE_ONLY] + to: [IndexColumn:{DescID: 106, ColumnID: 3, IndexID: 1}, ABSENT] + kind: Precedence + rule: column no longer public before dependents - from: [Column:{DescID: 106, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 106, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 106, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 106, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 106, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 106, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 107, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 107, Name: name, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 107, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 107, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 107, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 107, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 107, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 107, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 107, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 108, Name: n1, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 2}, WRITE_ONLY] to: [ColumnName:{DescID: 108, Name: n2, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 2}, WRITE_ONLY] to: [ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 108, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 108, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 109, Name: name, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 2}, WRITE_ONLY] to: [ColumnName:{DescID: 109, Name: n1, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 2}, WRITE_ONLY] to: [ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 109, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 109, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 110, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 110, Name: n2, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 110, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 110, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 110, ColumnID: 2}, WRITE_ONLY] to: [ColumnName:{DescID: 110, Name: n1, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 110, ColumnID: 2}, WRITE_ONLY] to: [ColumnType:{DescID: 110, ColumnFamilyID: 0, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 110, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 110, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 110, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 110, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 110, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 110, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 110, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 110, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 113, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 113, Name: k, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 113, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 113, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 113, ColumnID: 2}, WRITE_ONLY] to: [ColumnName:{DescID: 113, Name: n2, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 113, ColumnID: 2}, WRITE_ONLY] to: [ColumnType:{DescID: 113, ColumnFamilyID: 0, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 113, ColumnID: 3}, WRITE_ONLY] to: [ColumnName:{DescID: 113, Name: n1, ColumnID: 3}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 113, ColumnID: 3}, WRITE_ONLY] to: [ColumnType:{DescID: 113, ColumnFamilyID: 0, ColumnID: 3}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 113, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 113, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 113, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 113, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 113, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 113, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 113, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 113, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents +- from: [ColumnDefaultExpression:{DescID: 106, ColumnID: 3}, ABSENT] + to: [Column:{DescID: 106, ColumnID: 3}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [ColumnDefaultExpression:{DescID: 106, ColumnID: 3}, ABSENT] to: [ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 3}, ABSENT] kind: SameStagePrecedence @@ -471,14 +491,26 @@ DROP SCHEMA defaultdb.SC1 CASCADE to: [UserPrivileges:{DescID: 111, Name: root}, ABSENT] kind: SameStagePrecedence rule: descriptor drop right before dependent element removal +- from: [IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 1}, ABSENT] + to: [Column:{DescID: 106, ColumnID: 1}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1}, ABSENT] kind: Precedence rule: dependents removed before index +- from: [IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 1}, ABSENT] + to: [Column:{DescID: 106, ColumnID: 2}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1}, ABSENT] kind: Precedence rule: dependents removed before index +- from: [IndexColumn:{DescID: 106, ColumnID: 3, IndexID: 1}, ABSENT] + to: [Column:{DescID: 106, ColumnID: 3}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 106, ColumnID: 3, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1}, ABSENT] kind: Precedence @@ -490,19 +522,19 @@ DROP SCHEMA defaultdb.SC1 CASCADE - from: [PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 106, ColumnID: 3, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexName:{DescID: 106, Name: t1_pkey, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [Schema:{DescID: 104}, DROPPED] to: [Namespace:{DescID: 104, Name: sc1, ReferencedDescID: 100}, ABSENT] kind: SameStagePrecedence diff --git a/pkg/sql/schemachanger/scplan/testdata/drop_table b/pkg/sql/schemachanger/scplan/testdata/drop_table index ac529b561dcd..25fc1d81e5c1 100644 --- a/pkg/sql/schemachanger/scplan/testdata/drop_table +++ b/pkg/sql/schemachanger/scplan/testdata/drop_table @@ -183,24 +183,6 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 32 MutationType ops [[ColumnName:{DescID: 111, Name: tableoid, ColumnID: 4294967294}, ABSENT], PUBLIC] -> ABSENT [[ColumnType:{DescID: 111, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT], PUBLIC] -> ABSENT ops: - *scop.MarkDescriptorAsDropped - DescID: 111 - *scop.RemoveViewBackReferencesInRelations - BackReferencedViewID: 111 - RelationIDs: - - 109 - *scop.RemoveAllTableComments - TableID: 111 - *scop.MarkDescriptorAsDropped - DescID: 110 - *scop.RemoveAllTableComments - TableID: 110 - *scop.DrainDescriptorName - Namespace: - DatabaseID: 100 - DescriptorID: 111 - Name: v1 - SchemaID: 101 *scop.MarkDescriptorAsDropped DescID: 109 *scop.RemoveAllTableComments @@ -208,12 +190,6 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 32 MutationType ops *scop.RemoveColumnDefaultExpression ColumnID: 1 TableID: 109 - *scop.RemoveSequenceOwner - ColumnID: 2 - OwnedSequenceID: 110 - TableID: 109 - *scop.RemoveOwnerBackReferenceInSequence - SequenceID: 110 *scop.RemoveDroppedColumnType ColumnID: 3 TableID: 109 @@ -252,6 +228,30 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 32 MutationType ops *scop.RemoveForeignKeyConstraint ConstraintID: 3 TableID: 109 + *scop.MarkDescriptorAsDropped + DescID: 110 + *scop.RemoveAllTableComments + TableID: 110 + *scop.MarkDescriptorAsDropped + DescID: 111 + *scop.RemoveViewBackReferencesInRelations + BackReferencedViewID: 111 + RelationIDs: + - 109 + *scop.RemoveAllTableComments + TableID: 111 + *scop.DrainDescriptorName + Namespace: + DatabaseID: 100 + DescriptorID: 109 + Name: shipments + SchemaID: 101 + *scop.RemoveSequenceOwner + ColumnID: 2 + OwnedSequenceID: 110 + TableID: 109 + *scop.RemoveOwnerBackReferenceInSequence + SequenceID: 110 *scop.DrainDescriptorName Namespace: DatabaseID: 100 @@ -261,8 +261,8 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 32 MutationType ops *scop.DrainDescriptorName Namespace: DatabaseID: 100 - DescriptorID: 109 - Name: shipments + DescriptorID: 111 + Name: v1 SchemaID: 101 *scop.SetJobStateOnDescriptor DescriptorID: 104 @@ -513,103 +513,155 @@ DROP TABLE defaultdb.shipments CASCADE; - from: [Column:{DescID: 109, ColumnID: 1}, WRITE_ONLY] to: [ColumnComment:{DescID: 109, ColumnID: 1, Comment: tracking_number is a must}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents +- from: [Column:{DescID: 109, ColumnID: 1}, WRITE_ONLY] + to: [ColumnDefaultExpression:{DescID: 109, ColumnID: 1}, ABSENT] + kind: Precedence + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 109, Name: tracking_number, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents +- from: [Column:{DescID: 109, ColumnID: 1}, WRITE_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 1}, ABSENT] + kind: Precedence + rule: column no longer public before dependents +- from: [Column:{DescID: 109, ColumnID: 1}, WRITE_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 2}, ABSENT] + kind: Precedence + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 2}, WRITE_ONLY] to: [ColumnName:{DescID: 109, Name: carrier, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 2}, WRITE_ONLY] to: [ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents +- from: [Column:{DescID: 109, ColumnID: 2}, WRITE_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 1}, ABSENT] + kind: Precedence + rule: column no longer public before dependents +- from: [Column:{DescID: 109, ColumnID: 2}, WRITE_ONLY] + to: [SequenceOwner:{DescID: 109, ColumnID: 2, ReferencedDescID: 110}, ABSENT] + kind: Precedence + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 3}, WRITE_ONLY] to: [ColumnName:{DescID: 109, Name: status, ColumnID: 3}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 3}, WRITE_ONLY] to: [ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 3}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents +- from: [Column:{DescID: 109, ColumnID: 3}, WRITE_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 3, IndexID: 1}, ABSENT] + kind: Precedence + rule: column no longer public before dependents +- from: [Column:{DescID: 109, ColumnID: 3}, WRITE_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 3, IndexID: 2}, ABSENT] + kind: Precedence + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 109, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 109, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 4}, WRITE_ONLY] to: [ColumnName:{DescID: 109, Name: customer_id, ColumnID: 4}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 4}, WRITE_ONLY] to: [ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 4}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents +- from: [Column:{DescID: 109, ColumnID: 4}, WRITE_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 4, IndexID: 1}, ABSENT] + kind: Precedence + rule: column no longer public before dependents +- from: [Column:{DescID: 109, ColumnID: 4}, WRITE_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 4, IndexID: 2}, ABSENT] + kind: Precedence + rule: column no longer public before dependents +- from: [Column:{DescID: 109, ColumnID: 5}, WRITE_ONLY] + to: [ColumnDefaultExpression:{DescID: 109, ColumnID: 5}, ABSENT] + kind: Precedence + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 5}, WRITE_ONLY] to: [ColumnName:{DescID: 109, Name: randcol, ColumnID: 5}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 109, ColumnID: 5}, WRITE_ONLY] to: [ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 5}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents +- from: [Column:{DescID: 109, ColumnID: 5}, WRITE_ONLY] + to: [IndexColumn:{DescID: 109, ColumnID: 5, IndexID: 1}, ABSENT] + kind: Precedence + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 111, Name: customer_id, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 111, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 2}, WRITE_ONLY] to: [ColumnName:{DescID: 111, Name: carrier, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 2}, WRITE_ONLY] to: [ColumnType:{DescID: 111, ColumnFamilyID: 0, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 111, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 111, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 111, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 111, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [ColumnComment:{DescID: 109, ColumnID: 1, Comment: tracking_number is a must}, ABSENT] to: [Column:{DescID: 109, ColumnID: 1}, ABSENT] kind: Precedence rule: dependents removed before column +- from: [ColumnDefaultExpression:{DescID: 109, ColumnID: 1}, ABSENT] + to: [Column:{DescID: 109, ColumnID: 1}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [ColumnDefaultExpression:{DescID: 109, ColumnID: 1}, ABSENT] to: [ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: SameStagePrecedence rule: column type dependents removed right before column type +- from: [ColumnDefaultExpression:{DescID: 109, ColumnID: 5}, ABSENT] + to: [Column:{DescID: 109, ColumnID: 5}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [ColumnDefaultExpression:{DescID: 109, ColumnID: 5}, ABSENT] to: [ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 5}, ABSENT] kind: SameStagePrecedence @@ -702,34 +754,66 @@ DROP TABLE defaultdb.shipments CASCADE; to: [Column:{DescID: 111, ColumnID: 4294967295}, ABSENT] kind: Precedence rule: dependents removed before column +- from: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 1}, ABSENT] + to: [Column:{DescID: 109, ColumnID: 1}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, ABSENT] kind: Precedence rule: dependents removed before index +- from: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 2}, ABSENT] + to: [Column:{DescID: 109, ColumnID: 1}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 2}, ABSENT] to: [SecondaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 0}, ABSENT] kind: Precedence - rules: [secondary index columns removed before removing the index; dependents removed before index] + rule: dependents removed before index +- from: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 1}, ABSENT] + to: [Column:{DescID: 109, ColumnID: 2}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, ABSENT] kind: Precedence rule: dependents removed before index +- from: [IndexColumn:{DescID: 109, ColumnID: 3, IndexID: 1}, ABSENT] + to: [Column:{DescID: 109, ColumnID: 3}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 109, ColumnID: 3, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, ABSENT] kind: Precedence rule: dependents removed before index +- from: [IndexColumn:{DescID: 109, ColumnID: 3, IndexID: 2}, ABSENT] + to: [Column:{DescID: 109, ColumnID: 3}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 109, ColumnID: 3, IndexID: 2}, ABSENT] to: [SecondaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 0}, ABSENT] kind: Precedence - rules: [secondary index columns removed before removing the index; dependents removed before index] + rule: dependents removed before index +- from: [IndexColumn:{DescID: 109, ColumnID: 4, IndexID: 1}, ABSENT] + to: [Column:{DescID: 109, ColumnID: 4}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 109, ColumnID: 4, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, ABSENT] kind: Precedence rule: dependents removed before index +- from: [IndexColumn:{DescID: 109, ColumnID: 4, IndexID: 2}, ABSENT] + to: [Column:{DescID: 109, ColumnID: 4}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 109, ColumnID: 4, IndexID: 2}, ABSENT] to: [SecondaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 0}, ABSENT] kind: Precedence - rules: [secondary index columns removed before removing the index; dependents removed before index] + rule: dependents removed before index +- from: [IndexColumn:{DescID: 109, ColumnID: 5, IndexID: 1}, ABSENT] + to: [Column:{DescID: 109, ColumnID: 5}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [IndexColumn:{DescID: 109, ColumnID: 5, IndexID: 1}, ABSENT] to: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, ABSENT] kind: Precedence @@ -749,63 +833,51 @@ DROP TABLE defaultdb.shipments CASCADE; - from: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 109, ColumnID: 2, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 109, ColumnID: 3, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 109, ColumnID: 4, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexColumn:{DescID: 109, ColumnID: 5, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexComment:{DescID: 109, IndexID: 1, Comment: pkey is good}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, VALIDATED] to: [IndexName:{DescID: 109, Name: shipments_pkey, IndexID: 1}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed -- from: [SecondaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 0}, DELETE_ONLY] - to: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 2}, ABSENT] - kind: Precedence - rule: secondary index in DELETE_ONLY before removing columns -- from: [SecondaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 0}, DELETE_ONLY] - to: [IndexColumn:{DescID: 109, ColumnID: 3, IndexID: 2}, ABSENT] - kind: Precedence - rule: secondary index in DELETE_ONLY before removing columns -- from: [SecondaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 0}, DELETE_ONLY] - to: [IndexColumn:{DescID: 109, ColumnID: 4, IndexID: 2}, ABSENT] - kind: Precedence - rule: secondary index in DELETE_ONLY before removing columns + rule: index no longer public before dependents - from: [SecondaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 0}, VALIDATED] to: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 2}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [SecondaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 0}, VALIDATED] to: [IndexColumn:{DescID: 109, ColumnID: 3, IndexID: 2}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [SecondaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 0}, VALIDATED] to: [IndexColumn:{DescID: 109, ColumnID: 4, IndexID: 2}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [SecondaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 0}, VALIDATED] to: [IndexName:{DescID: 109, Name: partialidx, IndexID: 2}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [SecondaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 0}, VALIDATED] to: [SecondaryIndexPartial:{DescID: 109, IndexID: 2}, ABSENT] kind: Precedence - rule: index no longer public before dependents removed + rule: index no longer public before dependents - from: [SecondaryIndexPartial:{DescID: 109, IndexID: 2}, ABSENT] to: [SecondaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 0}, ABSENT] kind: Precedence @@ -834,6 +906,10 @@ DROP TABLE defaultdb.shipments CASCADE; to: [UserPrivileges:{DescID: 110, Name: root}, ABSENT] kind: SameStagePrecedence rule: descriptor drop right before dependent element removal +- from: [SequenceOwner:{DescID: 109, ColumnID: 2, ReferencedDescID: 110}, ABSENT] + to: [Column:{DescID: 109, ColumnID: 2}, ABSENT] + kind: Precedence + rule: dependents removed before column - from: [SequenceOwner:{DescID: 109, ColumnID: 2, ReferencedDescID: 110}, ABSENT] to: [ColumnType:{DescID: 109, ColumnFamilyID: 0, ColumnID: 2}, ABSENT] kind: SameStagePrecedence diff --git a/pkg/sql/schemachanger/scplan/testdata/drop_view b/pkg/sql/schemachanger/scplan/testdata/drop_view index 7a7124b25e83..97afffea117a 100644 --- a/pkg/sql/schemachanger/scplan/testdata/drop_view +++ b/pkg/sql/schemachanger/scplan/testdata/drop_view @@ -154,27 +154,27 @@ DROP VIEW defaultdb.v1 - from: [Column:{DescID: 105, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 105, Name: name, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 105, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 105, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 105, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 105, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 105, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 105, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 105, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 105, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 105, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 105, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [ColumnName:{DescID: 105, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] to: [Column:{DescID: 105, ColumnID: 4294967295}, ABSENT] kind: Precedence @@ -942,163 +942,163 @@ DROP VIEW defaultdb.v1 CASCADE - from: [Column:{DescID: 105, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 105, Name: name, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 105, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 105, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 105, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 105, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 105, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 105, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 105, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 105, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 105, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 105, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 106, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 106, Name: n1, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 106, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 106, ColumnID: 2}, WRITE_ONLY] to: [ColumnName:{DescID: 106, Name: n2, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 106, ColumnID: 2}, WRITE_ONLY] to: [ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 106, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 106, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 106, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 106, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 106, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 106, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 107, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 107, Name: name, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 107, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 107, ColumnID: 2}, WRITE_ONLY] to: [ColumnName:{DescID: 107, Name: n1, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 107, ColumnID: 2}, WRITE_ONLY] to: [ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 107, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 107, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 107, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 107, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 107, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 107, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 108, Name: n2, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 2}, WRITE_ONLY] to: [ColumnName:{DescID: 108, Name: n1, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 2}, WRITE_ONLY] to: [ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 108, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 108, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 108, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 1}, WRITE_ONLY] to: [ColumnName:{DescID: 111, Name: k, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 1}, WRITE_ONLY] to: [ColumnType:{DescID: 111, ColumnFamilyID: 0, ColumnID: 1}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 2}, WRITE_ONLY] to: [ColumnName:{DescID: 111, Name: n2, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 2}, WRITE_ONLY] to: [ColumnType:{DescID: 111, ColumnFamilyID: 0, ColumnID: 2}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 3}, WRITE_ONLY] to: [ColumnName:{DescID: 111, Name: n1, ColumnID: 3}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 3}, WRITE_ONLY] to: [ColumnType:{DescID: 111, ColumnFamilyID: 0, ColumnID: 3}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnName:{DescID: 111, Name: tableoid, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 4294967294}, WRITE_ONLY] to: [ColumnType:{DescID: 111, ColumnFamilyID: 0, ColumnID: 4294967294}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnName:{DescID: 111, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [Column:{DescID: 111, ColumnID: 4294967295}, WRITE_ONLY] to: [ColumnType:{DescID: 111, ColumnFamilyID: 0, ColumnID: 4294967295}, ABSENT] kind: Precedence - rule: column dependents removed after column no longer public + rule: column no longer public before dependents - from: [ColumnName:{DescID: 105, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295}, ABSENT] to: [Column:{DescID: 105, ColumnID: 4294967295}, ABSENT] kind: Precedence diff --git a/pkg/sql/schemachanger/testdata/end_to_end/add_column b/pkg/sql/schemachanger/testdata/end_to_end/add_column index a752a391828a..3560c9024fbe 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/add_column +++ b/pkg/sql/schemachanger/testdata/end_to_end/add_column @@ -278,7 +278,7 @@ begin transaction #9 validate forward indexes [2] in table #106 commit transaction #9 begin transaction #10 -## PostCommitNonRevertiblePhase stage 1 of 3 with 10 MutationType ops +## PostCommitNonRevertiblePhase stage 1 of 3 with 9 MutationType ops upsert descriptor #106 ... oid: 20 @@ -404,11 +404,11 @@ upsert descriptor #106 - version: "6" + version: "7" adding table for stats refresh: 106 -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 3 with 1 MutationType op pending" +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 3 with 3 MutationType ops pending" set schema change job #1 to non-cancellable commit transaction #10 begin transaction #11 -## PostCommitNonRevertiblePhase stage 2 of 3 with 3 MutationType ops +## PostCommitNonRevertiblePhase stage 2 of 3 with 5 MutationType ops upsert descriptor #106 ... formatVersion: 3 @@ -418,6 +418,36 @@ upsert descriptor #106 + modificationTime: {} mutations: - direction: DROP + index: + - constraintId: 3 + - createdExplicitly: true + - encodingType: 1 + - foreignKey: {} + - geoConfig: {} + - id: 3 + - interleave: {} + - keyColumnDirections: + - - ASC + - keyColumnIds: + - - 1 + - keyColumnNames: + - - i + - name: crdb_internal_index_3_name_placeholder + - partitioning: {} + - sharded: {} + - storeColumnIds: + - - 2 + - storeColumnNames: + - - j + - unique: true + - useDeletePreservingEncoding: true + - version: 4 + - mutationId: 1 + - state: DELETE_ONLY + - - direction: DROP + - index: + constraintId: 1 + createdAtNanos: "1640995200000000000" ... version: 4 mutationId: 1 @@ -430,10 +460,13 @@ upsert descriptor #106 unexposedParentSchemaId: 105 - version: "7" + version: "8" -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 3 with 4 MutationType ops pending" +create job #2 (non-cancelable: true): "GC for " + descriptor IDs: [106] +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 3 with 2 MutationType ops pending" commit transaction #11 +notified job registry to adopt jobs: [2] begin transaction #12 -## PostCommitNonRevertiblePhase stage 3 of 3 with 6 MutationType ops +## PostCommitNonRevertiblePhase stage 3 of 3 with 4 MutationType ops upsert descriptor #106 ... createAsOfTime: @@ -461,33 +494,6 @@ upsert descriptor #106 - mutations: - - direction: DROP - index: - - constraintId: 3 - - createdExplicitly: true - - encodingType: 1 - - foreignKey: {} - - geoConfig: {} - - id: 3 - - interleave: {} - - keyColumnDirections: - - - ASC - - keyColumnIds: - - - 1 - - keyColumnNames: - - - i - - name: crdb_internal_index_3_name_placeholder - - partitioning: {} - - sharded: {} - - storeColumnIds: - - - 2 - - storeColumnNames: - - - j - - unique: true - - useDeletePreservingEncoding: true - - version: 4 - - mutationId: 1 - - state: DELETE_ONLY - - - direction: DROP - - index: - constraintId: 1 - createdAtNanos: "1640995200000000000" - encodingType: 1 @@ -518,9 +524,9 @@ upsert descriptor #106 - version: "8" + version: "9" write *eventpb.FinishSchemaChange to event log for descriptor 106 -create job #2 (non-cancelable: true): "GC for ALTER TABLE db.public.tbl ADD COLUMN j INT8 NOT NULL DEFAULT 42" +create job #3 (non-cancelable: true): "GC for ALTER TABLE db.public.tbl ADD COLUMN j INT8 NOT NULL DEFAULT 42" descriptor IDs: [106] update progress of schema change job #1: "all stages completed" commit transaction #12 -notified job registry to adopt jobs: [2] +notified job registry to adopt jobs: [3] # end PostCommitPhase diff --git a/pkg/sql/schemachanger/testdata/end_to_end/add_column_default_seq b/pkg/sql/schemachanger/testdata/end_to_end/add_column_default_seq index be65dce56d8f..d4e231990169 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/add_column_default_seq +++ b/pkg/sql/schemachanger/testdata/end_to_end/add_column_default_seq @@ -379,7 +379,7 @@ begin transaction #9 validate forward indexes [2] in table #106 commit transaction #9 begin transaction #10 -## PostCommitNonRevertiblePhase stage 1 of 3 with 11 MutationType ops +## PostCommitNonRevertiblePhase stage 1 of 3 with 10 MutationType ops upsert descriptor #106 ... oid: 20 @@ -529,11 +529,11 @@ upsert descriptor #107 - version: "6" + version: "7" adding table for stats refresh: 106 -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 3 with 1 MutationType op pending" +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 3 with 3 MutationType ops pending" set schema change job #1 to non-cancellable commit transaction #10 begin transaction #11 -## PostCommitNonRevertiblePhase stage 2 of 3 with 4 MutationType ops +## PostCommitNonRevertiblePhase stage 2 of 3 with 6 MutationType ops upsert descriptor #106 ... formatVersion: 3 @@ -543,6 +543,36 @@ upsert descriptor #106 + modificationTime: {} mutations: - direction: DROP + index: + - constraintId: 3 + - createdExplicitly: true + - encodingType: 1 + - foreignKey: {} + - geoConfig: {} + - id: 3 + - interleave: {} + - keyColumnDirections: + - - ASC + - keyColumnIds: + - - 1 + - keyColumnNames: + - - i + - name: crdb_internal_index_3_name_placeholder + - partitioning: {} + - sharded: {} + - storeColumnIds: + - - 2 + - storeColumnNames: + - - l + - unique: true + - useDeletePreservingEncoding: true + - version: 4 + - mutationId: 1 + - state: DELETE_ONLY + - - direction: DROP + - index: + constraintId: 1 + createdAtNanos: "1640995200000000000" ... version: 4 mutationId: 1 @@ -569,10 +599,13 @@ upsert descriptor #107 unexposedParentSchemaId: 105 - version: "7" + version: "8" -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 3 with 4 MutationType ops pending" +create job #2 (non-cancelable: true): "GC for " + descriptor IDs: [106] +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 3 with 2 MutationType ops pending" commit transaction #11 +notified job registry to adopt jobs: [2] begin transaction #12 -## PostCommitNonRevertiblePhase stage 3 of 3 with 7 MutationType ops +## PostCommitNonRevertiblePhase stage 3 of 3 with 5 MutationType ops upsert descriptor #106 ... createAsOfTime: @@ -600,33 +633,6 @@ upsert descriptor #106 - mutations: - - direction: DROP - index: - - constraintId: 3 - - createdExplicitly: true - - encodingType: 1 - - foreignKey: {} - - geoConfig: {} - - id: 3 - - interleave: {} - - keyColumnDirections: - - - ASC - - keyColumnIds: - - - 1 - - keyColumnNames: - - - i - - name: crdb_internal_index_3_name_placeholder - - partitioning: {} - - sharded: {} - - storeColumnIds: - - - 2 - - storeColumnNames: - - - l - - unique: true - - useDeletePreservingEncoding: true - - version: 4 - - mutationId: 1 - - state: DELETE_ONLY - - - direction: DROP - - index: - constraintId: 1 - createdAtNanos: "1640995200000000000" - encodingType: 1 @@ -680,9 +686,9 @@ upsert descriptor #107 - version: "8" + version: "9" write *eventpb.FinishSchemaChange to event log for descriptor 106 -create job #2 (non-cancelable: true): "GC for ALTER TABLE db.public.tbl ADD COLUMN l INT8 NOT NULL DEFAULT nextval('db.public.sq1')" +create job #3 (non-cancelable: true): "GC for ALTER TABLE db.public.tbl ADD COLUMN l INT8 NOT NULL DEFAULT nextval('db.public.sq1')" descriptor IDs: [106] update progress of schema change job #1: "all stages completed" commit transaction #12 -notified job registry to adopt jobs: [2] +notified job registry to adopt jobs: [3] # end PostCommitPhase diff --git a/pkg/sql/schemachanger/testdata/end_to_end/alter_table_alter_primary_key_vanilla b/pkg/sql/schemachanger/testdata/end_to_end/alter_table_alter_primary_key_vanilla index d4a99c7beaf4..2feb9c47d9f6 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/alter_table_alter_primary_key_vanilla +++ b/pkg/sql/schemachanger/testdata/end_to_end/alter_table_alter_primary_key_vanilla @@ -319,7 +319,7 @@ validate forward indexes [2] in table #104 validate forward indexes [4] in table #104 commit transaction #9 begin transaction #10 -## PostCommitNonRevertiblePhase stage 1 of 3 with 12 MutationType ops +## PostCommitNonRevertiblePhase stage 1 of 3 with 10 MutationType ops upsert descriptor #104 ... statement: ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (j) @@ -486,11 +486,11 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "6" + version: "7" -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 3 with 1 MutationType op pending" +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 3 MutationType ops +## PostCommitNonRevertiblePhase stage 2 of 3 with 7 MutationType ops upsert descriptor #104 ... unique: true @@ -500,49 +500,7 @@ upsert descriptor #104 + modificationTime: {} mutations: - direction: DROP - ... - version: 4 - mutationId: 1 - - state: DELETE_AND_WRITE_ONLY - + state: DELETE_ONLY - name: t - nextColumnId: 3 - ... - time: {} - unexposedParentSchemaId: 101 - - version: "7" - + version: "8" -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 3 with 6 MutationType ops pending" -commit transaction #11 -begin transaction #12 -## PostCommitNonRevertiblePhase stage 3 of 3 with 8 MutationType ops -upsert descriptor #104 - ... - createAsOfTime: - wallTime: "1640995200000000000" - - declarativeSchemaChangerState: - - authorization: - - userName: root - - currentStatuses: - - jobId: "1" - - relevantStatements: - - - statement: - - redactedStatement: ALTER TABLE ‹defaultdb›.‹public›.‹t› ALTER PRIMARY KEY - - USING COLUMNS (‹j›) - - statement: ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (j) - - statementTag: ALTER TABLE - - targetRanks: - - targets: - families: - - columnIds: - ... - unique: true - version: 4 - - modificationTime: - - wallTime: "1640995200000000011" - - mutations: - - - direction: DROP - - index: + index: - constraintId: 3 - createdExplicitly: true - encodingType: 1 @@ -594,6 +552,54 @@ upsert descriptor #104 - mutationId: 1 - state: DELETE_ONLY - - direction: DROP + - index: + constraintId: 1 + createdAtNanos: "1640995200000000000" + ... + version: 4 + mutationId: 1 + - state: DELETE_AND_WRITE_ONLY + + state: DELETE_ONLY + name: t + nextColumnId: 3 + ... + time: {} + unexposedParentSchemaId: 101 + - version: "7" + + version: "8" +create job #2 (non-cancelable: true): "GC for " + descriptor IDs: [104] +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 3 with 2 MutationType ops pending" +commit transaction #11 +notified job registry to adopt jobs: [2] +begin transaction #12 +## PostCommitNonRevertiblePhase stage 3 of 3 with 4 MutationType ops +upsert descriptor #104 + ... + createAsOfTime: + wallTime: "1640995200000000000" + - declarativeSchemaChangerState: + - authorization: + - userName: root + - currentStatuses: + - jobId: "1" + - relevantStatements: + - - statement: + - redactedStatement: ALTER TABLE ‹defaultdb›.‹public›.‹t› ALTER PRIMARY KEY + - USING COLUMNS (‹j›) + - statement: ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (j) + - statementTag: ALTER TABLE + - targetRanks: + - targets: + families: + - columnIds: + ... + unique: true + version: 4 + - modificationTime: + - wallTime: "1640995200000000011" + - mutations: + - - direction: DROP - index: - constraintId: 1 - createdAtNanos: "1640995200000000000" @@ -629,9 +635,9 @@ upsert descriptor #104 - version: "8" + version: "9" write *eventpb.FinishSchemaChange to event log for descriptor 104 -create job #2 (non-cancelable: true): "GC for ALTER TABLE defaultdb.public.t ALTER PRIMARY KEY USING COLUMNS (j)" +create job #3 (non-cancelable: true): "GC for ALTER TABLE defaultdb.public.t ALTER PRIMARY KEY USING COLUMNS (j)" descriptor IDs: [104] update progress of schema change job #1: "all stages completed" commit transaction #12 -notified job registry to adopt jobs: [2] +notified job registry to adopt jobs: [3] # end PostCommitPhase diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_basic b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_basic index 34aa7d70e50b..b4b830814426 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_basic +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_basic @@ -271,7 +271,7 @@ begin transaction #9 validate forward indexes [2] in table #104 commit transaction #9 begin transaction #10 -## PostCommitNonRevertiblePhase stage 1 of 3 with 10 MutationType ops +## PostCommitNonRevertiblePhase stage 1 of 3 with 8 MutationType ops upsert descriptor #104 ... statement: ALTER TABLE t DROP COLUMN j @@ -378,11 +378,11 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "6" + version: "7" -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 3 with 1 MutationType op pending" +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 3 with 3 MutationType ops pending" set schema change job #1 to non-cancellable commit transaction #10 begin transaction #11 -## PostCommitNonRevertiblePhase stage 2 of 3 with 3 MutationType ops +## PostCommitNonRevertiblePhase stage 2 of 3 with 5 MutationType ops upsert descriptor #104 ... formatVersion: 3 @@ -392,6 +392,35 @@ upsert descriptor #104 + modificationTime: {} mutations: - column: + ... + - direction: DROP + index: + - constraintId: 3 + - 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 + - useDeletePreservingEncoding: true + - version: 4 + - mutationId: 1 + - state: DELETE_ONLY + - - direction: DROP + - index: + constraintId: 1 + createdAtNanos: "1640995200000000000" ... version: 4 mutationId: 1 @@ -404,10 +433,13 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "7" + version: "8" -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 3 with 5 MutationType ops pending" +create job #2 (non-cancelable: true): "GC for " + descriptor IDs: [104] +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 3 with 3 MutationType ops pending" commit transaction #11 +notified job registry to adopt jobs: [2] begin transaction #12 -## PostCommitNonRevertiblePhase stage 3 of 3 with 7 MutationType ops +## PostCommitNonRevertiblePhase stage 3 of 3 with 5 MutationType ops upsert descriptor #104 ... createAsOfTime: @@ -451,30 +483,6 @@ upsert descriptor #104 - state: DELETE_ONLY - - direction: DROP - index: - - constraintId: 3 - - 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 - - useDeletePreservingEncoding: true - - version: 4 - - mutationId: 1 - - state: DELETE_ONLY - - - direction: DROP - - index: - constraintId: 1 - createdAtNanos: "1640995200000000000" - encodingType: 1 @@ -509,9 +517,9 @@ upsert descriptor #104 - version: "8" + version: "9" write *eventpb.FinishSchemaChange to event log for descriptor 104 -create job #2 (non-cancelable: true): "GC for ALTER TABLE defaultdb.public.t DROP COLUMN j" +create job #3 (non-cancelable: true): "GC for ALTER TABLE defaultdb.public.t DROP COLUMN j" descriptor IDs: [104] update progress of schema change job #1: "all stages completed" commit transaction #12 -notified job registry to adopt jobs: [2] +notified job registry to adopt jobs: [3] # end PostCommitPhase diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index index 253d47fd8f3c..2c98d12fe148 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_computed_index @@ -79,20 +79,6 @@ upsert descriptor #104 + direction: DROP + mutationId: 1 + state: DELETE_AND_WRITE_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_AND_WRITE_ONLY + - direction: DROP + index: + createdAtNanos: "1640995200000000000" @@ -161,6 +147,20 @@ upsert descriptor #104 + version: 4 + 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_AND_WRITE_ONLY name: t nextColumnId: 4 - nextConstraintId: 2 @@ -238,8 +238,8 @@ upsert descriptor #104 mutationId: 1 - state: DELETE_ONLY + state: DELETE_AND_WRITE_ONLY - name: t - nextColumnId: 4 + - column: + computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 ... time: {} unexposedParentSchemaId: 101 @@ -335,7 +335,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 3 with 10 MutationType ops upsert descriptor #104 ... statement: ALTER TABLE t DROP COLUMN j CASCADE @@ -355,13 +355,6 @@ upsert descriptor #104 direction: DROP mutationId: 1 - state: DELETE_AND_WRITE_ONLY - + state: DELETE_ONLY - - column: - computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 - ... - direction: DROP - mutationId: 1 - - state: DELETE_AND_WRITE_ONLY + state: DELETE_ONLY - direction: DROP index: @@ -374,59 +367,68 @@ upsert descriptor #104 + - direction: DROP index: - constraintId: 2 - + constraintId: 3 - createdExplicitly: true - encodingType: 1 - foreignKey: {} - geoConfig: {} + - createdExplicitly: true + - encodingType: 1 + - foreignKey: {} + - geoConfig: {} - id: 3 - + id: 4 - interleave: {} - keyColumnDirections: - ... - keyColumnNames: - - i + - interleave: {} + - keyColumnDirections: + - - ASC + - keyColumnIds: + - - 1 + - keyColumnNames: + - - i - name: crdb_internal_index_3_name_placeholder - + name: crdb_internal_index_4_name_placeholder - partitioning: {} - sharded: {} - storeColumnNames: [] - unique: true - + useDeletePreservingEncoding: true + - partitioning: {} + - sharded: {} + - storeColumnNames: [] + - unique: true + - version: 4 + - mutationId: 1 + - state: DELETE_AND_WRITE_ONLY + - - direction: ADD + - index: + constraintId: 3 + createdExplicitly: true + ... version: 4 mutationId: 1 - state: DELETE_AND_WRITE_ONLY - - - direction: ADD + + state: DELETE_ONLY + - column: + computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 + ... + direction: DROP + mutationId: 1 + state: DELETE_ONLY + - direction: DROP - index: - - constraintId: 3 - - createdExplicitly: true + + index: + constraintId: 1 + createdAtNanos: "1640995200000000000" - encodingType: 1 - foreignKey: {} - geoConfig: {} - - id: 4 + + encodingType: 1 + + foreignKey: {} + + geoConfig: {} + 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: {} - - storeColumnNames: [] + + partitioning: {} + + sharded: {} + storeColumnIds: + - 2 + storeColumnNames: + - crdb_internal_column_2_name_placeholder - unique: true - - useDeletePreservingEncoding: true - version: 4 - mutationId: 1 + + unique: true + + version: 4 + + mutationId: 1 + state: DELETE_AND_WRITE_ONLY + name: t ... parentId: 100 primaryIndex: @@ -456,11 +458,11 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "6" + version: "7" -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 3 with 1 MutationType op pending" +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 3 with 7 MutationType ops pending" set schema change job #1 to non-cancellable commit transaction #10 begin transaction #11 -## PostCommitNonRevertiblePhase stage 2 of 3 with 3 MutationType ops +## PostCommitNonRevertiblePhase stage 2 of 3 with 9 MutationType ops upsert descriptor #104 ... id: 104 @@ -470,6 +472,70 @@ upsert descriptor #104 + modificationTime: {} mutations: - column: + ... + - 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 + - - 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: {} + - storeColumnNames: [] + - unique: true + - useDeletePreservingEncoding: true + - version: 4 + - 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 @@ -482,10 +548,14 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "7" + version: "8" -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 3 with 9 MutationType ops pending" +write *eventpb.DropIndex to event log for descriptor #104: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE +create job #2 (non-cancelable: true): "GC for ALTER TABLE defaultdb.public.t DROP COLUMN j CASCADE" + descriptor IDs: [104] +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 3 with 3 MutationType ops pending" commit transaction #11 +notified job registry to adopt jobs: [2] begin transaction #12 -## PostCommitNonRevertiblePhase stage 3 of 3 with 11 MutationType ops +## PostCommitNonRevertiblePhase stage 3 of 3 with 5 MutationType ops upsert descriptor #104 ... createAsOfTime: @@ -528,65 +598,6 @@ upsert descriptor #104 - direction: DROP - 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: - - 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: 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: {} - - storeColumnNames: [] - - unique: true - - useDeletePreservingEncoding: true - - version: 4 - - mutationId: 1 - - state: DELETE_ONLY - - direction: DROP - index: - constraintId: 1 @@ -622,10 +633,10 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "8" + version: "9" -write *eventpb.DropIndex to event log for descriptor #104: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE -create job #2 (non-cancelable: true): "GC for ALTER TABLE defaultdb.public.t DROP COLUMN j CASCADE" +write *eventpb.FinishSchemaChange to event log for descriptor 104 +create job #3 (non-cancelable: true): "GC for ALTER TABLE defaultdb.public.t DROP COLUMN j CASCADE" descriptor IDs: [104] update progress of schema change job #1: "all stages completed" commit transaction #12 -notified job registry to adopt jobs: [2] +notified job registry to adopt jobs: [3] # end PostCommitPhase diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements index 961ecbdbb9d5..b5607cf1f15f 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_create_index_separate_statements @@ -88,20 +88,6 @@ upsert descriptor #104 + direction: DROP + mutationId: 1 + state: DELETE_AND_WRITE_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_AND_WRITE_ONLY + - direction: DROP + index: + createdAtNanos: "1640995200000000000" @@ -179,6 +165,20 @@ upsert descriptor #104 + version: 4 + 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_AND_WRITE_ONLY name: t nextColumnId: 5 - nextConstraintId: 2 @@ -262,8 +262,8 @@ upsert descriptor #104 mutationId: 1 - state: DELETE_ONLY + state: DELETE_AND_WRITE_ONLY - name: t - nextColumnId: 5 + - column: + computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 ... time: {} unexposedParentSchemaId: 101 @@ -397,6 +397,20 @@ upsert descriptor #104 mutationId: 1 state: DELETE_AND_WRITE_ONLY - - direction: ADD + + - 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_AND_WRITE_ONLY + - direction: DROP index: - constraintId: 3 @@ -428,6 +442,18 @@ upsert descriptor #104 version: 4 mutationId: 1 state: DELETE_AND_WRITE_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 + - direction: ADD + index: + constraintId: 4 @@ -450,7 +476,8 @@ upsert descriptor #104 + storeColumnNames: [] + unique: true + version: 4 - + mutationId: 1 + mutationId: 1 + - state: DELETE_AND_WRITE_ONLY + state: BACKFILLING + - direction: ADD + index: @@ -627,7 +654,7 @@ begin transaction #17 validate forward indexes [5] in table #104 commit transaction #17 begin transaction #18 -## PostCommitNonRevertiblePhase stage 1 of 2 with 16 MutationType ops +## PostCommitNonRevertiblePhase stage 1 of 2 with 10 MutationType ops upsert descriptor #104 ... statementTag: CREATE INDEX @@ -669,13 +696,6 @@ upsert descriptor #104 direction: DROP mutationId: 1 - state: DELETE_AND_WRITE_ONLY - + state: DELETE_ONLY - - column: - computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 - ... - direction: DROP - mutationId: 1 - - state: DELETE_AND_WRITE_ONLY + state: DELETE_ONLY - direction: DROP index: @@ -692,6 +712,13 @@ upsert descriptor #104 version: 4 mutationId: 1 - state: DELETE_AND_WRITE_ONLY + + state: DELETE_ONLY + - column: + computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 + ... + direction: DROP + mutationId: 1 + - state: DELETE_AND_WRITE_ONLY + state: DELETE_ONLY - direction: DROP index: @@ -798,20 +825,6 @@ upsert descriptor #104 - direction: DROP - 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: - createdAtNanos: "1640995200000000000" @@ -863,6 +876,20 @@ upsert descriptor #104 - version: 4 - 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 diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_unique_index b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_unique_index index 4402ad4685ca..0a828bf0e46b 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_unique_index +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_unique_index @@ -287,7 +287,7 @@ begin transaction #9 validate forward indexes [4] in table #106 commit transaction #9 begin transaction #10 -## PostCommitNonRevertiblePhase stage 1 of 3 with 12 MutationType ops +## PostCommitNonRevertiblePhase stage 1 of 3 with 8 MutationType ops upsert descriptor #106 ... statement: ALTER TABLE t.test DROP COLUMN pi @@ -398,11 +398,11 @@ upsert descriptor #106 unexposedParentSchemaId: 105 - version: "16" + version: "17" -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 3 with 1 MutationType op pending" +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 3 with 3 MutationType ops pending" set schema change job #1 to non-cancellable commit transaction #10 begin transaction #11 -## PostCommitNonRevertiblePhase stage 2 of 3 with 3 MutationType ops +## PostCommitNonRevertiblePhase stage 2 of 3 with 5 MutationType ops upsert descriptor #106 ... unique: true @@ -412,6 +412,40 @@ upsert descriptor #106 + modificationTime: {} mutations: - column: + ... + - direction: DROP + index: + - constraintId: 6 + - createdExplicitly: true + - encodingType: 1 + - foreignKey: {} + - geoConfig: {} + - id: 5 + - interleave: {} + - keyColumnDirections: + - - ASC + - keyColumnIds: + - - 1 + - keyColumnNames: + - - k + - name: crdb_internal_index_5_name_placeholder + - partitioning: {} + - sharded: {} + - storeColumnIds: + - - 2 + - - 4 + - storeColumnNames: + - - v + - - x + - unique: true + - useDeletePreservingEncoding: true + - version: 4 + - mutationId: 3 + - state: DELETE_ONLY + - - direction: DROP + - index: + constraintId: 1 + createdAtNanos: "1640995200000000000" ... version: 4 mutationId: 3 @@ -424,10 +458,13 @@ upsert descriptor #106 unexposedParentSchemaId: 105 - version: "17" + version: "18" -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 3 with 6 MutationType ops pending" +create job #2 (non-cancelable: true): "GC for " + descriptor IDs: [106] +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 3 with 4 MutationType ops pending" commit transaction #11 +notified job registry to adopt jobs: [2] begin transaction #12 -## PostCommitNonRevertiblePhase stage 3 of 3 with 8 MutationType ops +## PostCommitNonRevertiblePhase stage 3 of 3 with 6 MutationType ops upsert descriptor #106 ... createAsOfTime: @@ -475,35 +512,6 @@ upsert descriptor #106 - state: DELETE_ONLY - - direction: DROP - index: - - constraintId: 6 - - createdExplicitly: true - - encodingType: 1 - - foreignKey: {} - - geoConfig: {} - - id: 5 - - interleave: {} - - keyColumnDirections: - - - ASC - - keyColumnIds: - - - 1 - - keyColumnNames: - - - k - - name: crdb_internal_index_5_name_placeholder - - partitioning: {} - - sharded: {} - - storeColumnIds: - - - 2 - - - 4 - - storeColumnNames: - - - v - - - x - - unique: true - - useDeletePreservingEncoding: true - - version: 4 - - mutationId: 3 - - state: DELETE_ONLY - - - direction: DROP - - index: - constraintId: 1 - createdAtNanos: "1640995200000000000" - encodingType: 1 @@ -542,9 +550,9 @@ upsert descriptor #106 - version: "18" + version: "19" write *eventpb.FinishSchemaChange to event log for descriptor 106 -create job #2 (non-cancelable: true): "GC for ALTER TABLE t.public.test DROP COLUMN pi" +create job #3 (non-cancelable: true): "GC for ALTER TABLE t.public.test DROP COLUMN pi" descriptor IDs: [106] update progress of schema change job #1: "all stages completed" commit transaction #12 -notified job registry to adopt jobs: [2] +notified job registry to adopt jobs: [3] # end PostCommitPhase diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_with_index b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_with_index index a7030d7f0fd2..2ab29ed0eff1 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_with_index +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_with_index @@ -58,17 +58,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_AND_WRITE_ONLY + - direction: DROP + index: + createdAtNanos: "1640995200000000000" @@ -137,6 +126,17 @@ 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_AND_WRITE_ONLY name: t nextColumnId: 3 - nextConstraintId: 2 @@ -158,7 +158,6 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "1" + version: "2" -write *eventpb.AlterTable to event log for descriptor #104: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› # end StatementPhase # begin PreCommitPhase ## PreCommitPhase stage 1 of 1 with 2 MutationType ops @@ -188,7 +187,7 @@ upsert descriptor #104 + modificationTime: + wallTime: "1640995200000000001" mutations: - - column: + - direction: DROP ... create job #1 (non-cancelable: false): "ALTER TABLE defaultdb.public.t DROP COLUMN j" descriptor IDs: [104] @@ -208,14 +207,14 @@ upsert descriptor #104 - wallTime: "1640995200000000001" + modificationTime: {} mutations: - - column: + - direction: DROP ... version: 4 mutationId: 1 - state: DELETE_ONLY + state: DELETE_AND_WRITE_ONLY - name: t - nextColumnId: 3 + - column: + id: 2 ... time: {} unexposedParentSchemaId: 101 @@ -237,7 +236,7 @@ upsert descriptor #104 - wallTime: "1640995200000000003" + modificationTime: {} mutations: - - column: + - direction: DROP ... version: 4 mutationId: 1 @@ -262,7 +261,7 @@ upsert descriptor #104 - wallTime: "1640995200000000005" + modificationTime: {} mutations: - - column: + - direction: DROP ... version: 4 mutationId: 1 @@ -291,7 +290,7 @@ upsert descriptor #104 - wallTime: "1640995200000000006" + modificationTime: {} mutations: - - column: + - direction: DROP ... version: 4 mutationId: 1 @@ -311,7 +310,7 @@ begin transaction #9 validate forward indexes [3] in table #104 commit transaction #9 begin transaction #10 -## PostCommitNonRevertiblePhase stage 1 of 3 with 13 MutationType ops +## PostCommitNonRevertiblePhase stage 1 of 3 with 9 MutationType ops upsert descriptor #104 ... statement: ALTER TABLE t DROP COLUMN j @@ -326,14 +325,7 @@ upsert descriptor #104 - wallTime: "1640995200000000008" + modificationTime: {} mutations: - - column: - ... - direction: DROP - mutationId: 1 - - state: DELETE_AND_WRITE_ONLY - + state: DELETE_ONLY - direction: DROP - index: ... version: 3 mutationId: 1 @@ -367,6 +359,17 @@ upsert descriptor #104 - state: DELETE_AND_WRITE_ONLY - - direction: ADD + 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: DROP index: - constraintId: 3 @@ -396,6 +399,20 @@ upsert descriptor #104 - useDeletePreservingEncoding: true version: 4 mutationId: 1 + state: DELETE_AND_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: DELETE_AND_WRITE_ONLY + name: t + nextColumnId: 3 ... parentId: 100 primaryIndex: @@ -425,11 +442,11 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "6" + version: "7" -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 3 with 1 MutationType op pending" +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 3 with 6 MutationType ops pending" set schema change job #1 to non-cancellable commit transaction #10 begin transaction #11 -## PostCommitNonRevertiblePhase stage 2 of 3 with 3 MutationType ops +## PostCommitNonRevertiblePhase stage 2 of 3 with 8 MutationType ops upsert descriptor #104 ... id: 104 @@ -438,7 +455,53 @@ upsert descriptor #104 - wallTime: "1640995200000000010" + modificationTime: {} mutations: + - - direction: DROP + - index: + - createdAtNanos: "1640995200000000000" + - foreignKey: {} + - geoConfig: {} + - id: 2 + - interleave: {} + - keyColumnDirections: + - - ASC + - keyColumnIds: + - - 2 + - keyColumnNames: + - - crdb_internal_column_2_name_placeholder + - keySuffixColumnIds: + - - 1 + - name: crdb_internal_index_2_name_placeholder + - partitioning: {} + - sharded: {} + - version: 3 + - mutationId: 1 + - state: DELETE_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: {} + - storeColumnNames: [] + - unique: true + - useDeletePreservingEncoding: true + - version: 4 + - mutationId: 1 + - state: DELETE_ONLY - column: + id: 2 ... version: 4 mutationId: 1 @@ -451,10 +514,14 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "7" + version: "8" -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 3 with 8 MutationType ops pending" +write *eventpb.DropIndex to event log for descriptor #104: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› +create job #2 (non-cancelable: true): "GC for ALTER TABLE defaultdb.public.t DROP COLUMN j" + descriptor IDs: [104] +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 3 with 3 MutationType ops pending" commit transaction #11 +notified job registry to adopt jobs: [2] begin transaction #12 -## PostCommitNonRevertiblePhase stage 3 of 3 with 10 MutationType ops +## PostCommitNonRevertiblePhase stage 3 of 3 with 5 MutationType ops upsert descriptor #104 ... createAsOfTime: @@ -499,51 +566,6 @@ upsert descriptor #104 - state: DELETE_ONLY - - direction: DROP - index: - - createdAtNanos: "1640995200000000000" - - foreignKey: {} - - geoConfig: {} - - id: 2 - - interleave: {} - - keyColumnDirections: - - - ASC - - keyColumnIds: - - - 2 - - keyColumnNames: - - - crdb_internal_column_2_name_placeholder - - keySuffixColumnIds: - - - 1 - - name: crdb_internal_index_2_name_placeholder - - partitioning: {} - - sharded: {} - - version: 3 - - mutationId: 1 - - state: DELETE_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: {} - - storeColumnNames: [] - - unique: true - - useDeletePreservingEncoding: true - - version: 4 - - mutationId: 1 - - state: DELETE_ONLY - - - direction: DROP - - index: - constraintId: 1 - createdAtNanos: "1640995200000000000" - encodingType: 1 @@ -577,10 +599,10 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "8" + version: "9" -write *eventpb.DropIndex to event log for descriptor #104: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› -create job #2 (non-cancelable: true): "GC for ALTER TABLE defaultdb.public.t DROP COLUMN j" +write *eventpb.FinishSchemaChange to event log for descriptor 104 +create job #3 (non-cancelable: true): "GC for ALTER TABLE defaultdb.public.t DROP COLUMN j" descriptor IDs: [104] update progress of schema change job #1: "all stages completed" commit transaction #12 -notified job registry to adopt jobs: [2] +notified job registry to adopt jobs: [3] # end PostCommitPhase diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_index_hash_sharded_index b/pkg/sql/schemachanger/testdata/end_to_end/drop_index_hash_sharded_index index 513e5dd31e29..82e26b19d631 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_index_hash_sharded_index +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_index_hash_sharded_index @@ -67,19 +67,6 @@ upsert descriptor #104 + indexes: [] + modificationTime: {} + mutations: - + - column: - + computeExpr: mod(fnv32(crdb_internal.datums_to_bytes(j)), 16:::INT8) - + hidden: true - + id: 3 - + name: crdb_internal_column_3_name_placeholder - + type: - + family: IntFamily - + oid: 20 - + width: 64 - + virtual: true - + direction: DROP - + mutationId: 2 - + state: DELETE_AND_WRITE_ONLY + - direction: DROP + index: + createdAtNanos: "1640995200000000000" @@ -115,6 +102,19 @@ upsert descriptor #104 + shardBuckets: 16 + version: 3 + mutationId: 2 + + state: DELETE_AND_WRITE_ONLY + + - column: + + computeExpr: mod(fnv32(crdb_internal.datums_to_bytes(j)), 16:::INT8) + + hidden: true + + id: 3 + + name: crdb_internal_column_3_name_placeholder + + type: + + family: IntFamily + + oid: 20 + + width: 64 + + virtual: true + + direction: DROP + + mutationId: 2 + state: DELETE_AND_WRITE_ONLY name: t nextColumnId: 4 @@ -123,7 +123,6 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "8" + version: "9" -write *eventpb.AlterTable to event log for descriptor #104: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE # end StatementPhase # begin PreCommitPhase ## PreCommitPhase stage 1 of 1 with 2 MutationType ops @@ -152,7 +151,7 @@ upsert descriptor #104 + modificationTime: + wallTime: "1640995200000000001" mutations: - - column: + - direction: DROP ... create job #1 (non-cancelable: true): "DROP INDEX defaultdb.public.t@idx CASCADE" descriptor IDs: [104] @@ -163,7 +162,7 @@ notified job registry to adopt jobs: [1] begin transaction #2 commit transaction #2 begin transaction #3 -## PostCommitNonRevertiblePhase stage 1 of 2 with 9 MutationType ops +## PostCommitNonRevertiblePhase stage 1 of 2 with 6 MutationType ops upsert descriptor #104 table: - checks: @@ -185,16 +184,16 @@ upsert descriptor #104 - wallTime: "1640995200000000001" + modificationTime: {} mutations: - - column: + - direction: DROP ... - direction: DROP + version: 3 mutationId: 2 - state: DELETE_AND_WRITE_ONLY + state: DELETE_ONLY - - direction: DROP - index: + - column: + computeExpr: mod(fnv32(crdb_internal.datums_to_bytes(j)), 16:::INT8) ... - version: 3 + direction: DROP mutationId: 2 - state: DELETE_AND_WRITE_ONLY + state: DELETE_ONLY @@ -233,19 +232,6 @@ upsert descriptor #104 - modificationTime: - wallTime: "1640995200000000003" - mutations: - - - column: - - computeExpr: mod(fnv32(crdb_internal.datums_to_bytes(j)), 16:::INT8) - - hidden: true - - id: 3 - - name: crdb_internal_column_3_name_placeholder - - type: - - family: IntFamily - - oid: 20 - - width: 64 - - virtual: true - - direction: DROP - - mutationId: 2 - - state: DELETE_ONLY - - direction: DROP - index: - createdAtNanos: "1640995200000000000" @@ -276,6 +262,19 @@ upsert descriptor #104 - version: 3 - mutationId: 2 - state: DELETE_ONLY + - - column: + - computeExpr: mod(fnv32(crdb_internal.datums_to_bytes(j)), 16:::INT8) + - hidden: true + - id: 3 + - name: crdb_internal_column_3_name_placeholder + - type: + - family: IntFamily + - oid: 20 + - width: 64 + - virtual: true + - direction: DROP + - mutationId: 2 + - state: DELETE_ONLY + modificationTime: {} + mutations: [] name: t diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_index_partial_expression_index b/pkg/sql/schemachanger/testdata/end_to_end/drop_index_partial_expression_index index ee3ac7695a28..c9861f34895d 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_index_partial_expression_index +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_index_partial_expression_index @@ -56,19 +56,6 @@ upsert descriptor #104 + indexes: [] + modificationTime: {} + mutations: - + - column: - + computeExpr: lower(j) - + id: 3 - + inaccessible: true - + name: crdb_internal_column_3_name_placeholder - + nullable: true - + type: - + family: StringFamily - + oid: 25 - + virtual: true - + direction: DROP - + mutationId: 2 - + state: DELETE_AND_WRITE_ONLY + - direction: DROP + index: + createdAtNanos: "1640995200000000000" @@ -91,6 +78,19 @@ upsert descriptor #104 + sharded: {} + version: 3 + mutationId: 2 + + state: DELETE_AND_WRITE_ONLY + + - column: + + computeExpr: lower(j) + + id: 3 + + inaccessible: true + + name: crdb_internal_column_3_name_placeholder + + nullable: true + + type: + + family: StringFamily + + oid: 25 + + virtual: true + + direction: DROP + + mutationId: 2 + state: DELETE_AND_WRITE_ONLY name: t nextColumnId: 4 @@ -99,7 +99,6 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "7" + version: "8" -write *eventpb.AlterTable to event log for descriptor #104: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE # end StatementPhase # begin PreCommitPhase ## PreCommitPhase stage 1 of 1 with 2 MutationType ops @@ -128,7 +127,7 @@ upsert descriptor #104 + modificationTime: + wallTime: "1640995200000000001" mutations: - - column: + - direction: DROP ... create job #1 (non-cancelable: true): "DROP INDEX defaultdb.public.t@idx CASCADE" descriptor IDs: [104] @@ -139,7 +138,7 @@ notified job registry to adopt jobs: [1] begin transaction #2 commit transaction #2 begin transaction #3 -## PostCommitNonRevertiblePhase stage 1 of 2 with 6 MutationType ops +## PostCommitNonRevertiblePhase stage 1 of 2 with 4 MutationType ops upsert descriptor #104 ... id: 104 @@ -148,16 +147,16 @@ upsert descriptor #104 - wallTime: "1640995200000000001" + modificationTime: {} mutations: - - column: + - direction: DROP ... - direction: DROP + version: 3 mutationId: 2 - state: DELETE_AND_WRITE_ONLY + state: DELETE_ONLY - - direction: DROP - index: + - column: + computeExpr: lower(j) ... - version: 3 + direction: DROP mutationId: 2 - state: DELETE_AND_WRITE_ONLY + state: DELETE_ONLY @@ -196,19 +195,6 @@ upsert descriptor #104 - modificationTime: - wallTime: "1640995200000000003" - mutations: - - - column: - - computeExpr: lower(j) - - id: 3 - - inaccessible: true - - name: crdb_internal_column_3_name_placeholder - - nullable: true - - type: - - family: StringFamily - - oid: 25 - - virtual: true - - direction: DROP - - mutationId: 2 - - state: DELETE_ONLY - - direction: DROP - index: - createdAtNanos: "1640995200000000000" @@ -232,6 +218,19 @@ upsert descriptor #104 - version: 3 - mutationId: 2 - state: DELETE_ONLY + - - column: + - computeExpr: lower(j) + - id: 3 + - inaccessible: true + - name: crdb_internal_column_3_name_placeholder + - nullable: true + - type: + - family: StringFamily + - oid: 25 + - virtual: true + - direction: DROP + - mutationId: 2 + - state: DELETE_ONLY + modificationTime: {} + mutations: [] name: t diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_index_vanilla_index b/pkg/sql/schemachanger/testdata/end_to_end/drop_index_vanilla_index index 62bb79782a6a..ea53c50f3ee0 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_index_vanilla_index +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_index_vanilla_index @@ -109,7 +109,7 @@ notified job registry to adopt jobs: [1] begin transaction #2 commit transaction #2 begin transaction #3 -## PostCommitNonRevertiblePhase stage 1 of 2 with 5 MutationType ops +## PostCommitNonRevertiblePhase stage 1 of 2 with 3 MutationType ops upsert descriptor #104 ... id: 104 diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements index 7d604e9f9659..4f75c7622a08 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_multiple_columns_separate_statements @@ -88,20 +88,6 @@ upsert descriptor #104 + direction: DROP + mutationId: 1 + state: DELETE_AND_WRITE_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_AND_WRITE_ONLY + - direction: DROP + index: + createdAtNanos: "1640995200000000000" @@ -179,6 +165,20 @@ upsert descriptor #104 + version: 4 + 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_AND_WRITE_ONLY name: t nextColumnId: 5 - nextConstraintId: 2 @@ -257,7 +257,7 @@ upsert descriptor #104 useDeletePreservingEncoding: true ... mutationId: 1 - state: DELETE_ONLY + state: DELETE_AND_WRITE_ONLY + - column: + defaultExpr: 32:::INT8 + id: 3 @@ -334,7 +334,7 @@ upsert descriptor #104 - state: DELETE_ONLY + state: DELETE_AND_WRITE_ONLY - column: - defaultExpr: 32:::INT8 + computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 ... time: {} unexposedParentSchemaId: 101 @@ -430,7 +430,7 @@ begin transaction #9 validate forward indexes [3] in table #104 commit transaction #9 begin transaction #10 -## PostCommitNonRevertiblePhase stage 1 of 3 with 19 MutationType ops +## PostCommitNonRevertiblePhase stage 1 of 3 with 12 MutationType ops upsert descriptor #104 ... statementTag: ALTER TABLE @@ -450,13 +450,6 @@ upsert descriptor #104 direction: DROP mutationId: 1 - state: DELETE_AND_WRITE_ONLY - + state: DELETE_ONLY - - column: - computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 - ... - direction: DROP - mutationId: 1 - - state: DELETE_AND_WRITE_ONLY + state: DELETE_ONLY - direction: DROP index: @@ -469,94 +462,80 @@ upsert descriptor #104 + - direction: DROP index: - constraintId: 2 - + constraintId: 3 - createdExplicitly: true - encodingType: 1 - foreignKey: {} - geoConfig: {} + - createdExplicitly: true + - encodingType: 1 + - foreignKey: {} + - geoConfig: {} - id: 3 - + id: 4 - interleave: {} - keyColumnDirections: - ... - keyColumnNames: - - i + - interleave: {} + - keyColumnDirections: + - - ASC + - keyColumnIds: + - - 1 + - keyColumnNames: + - - i - name: crdb_internal_index_3_name_placeholder - + name: crdb_internal_index_4_name_placeholder - partitioning: {} - sharded: {} + - partitioning: {} + - sharded: {} - storeColumnIds: - - 3 - storeColumnNames: - - crdb_internal_column_3_name_placeholder - + storeColumnIds: [] - + storeColumnNames: [] - unique: true - + useDeletePreservingEncoding: true + - unique: true + - version: 4 + - mutationId: 1 + - state: DELETE_AND_WRITE_ONLY + - - direction: ADD + - index: + constraintId: 3 + createdExplicitly: true + ... version: 4 mutationId: 1 - state: DELETE_AND_WRITE_ONLY - - - direction: ADD + 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 + - column: + computeExpr: crdb_internal_column_2_name_placeholder + 1:::INT8 + ... + direction: DROP + mutationId: 1 + - state: DELETE_AND_WRITE_ONLY + + state: DELETE_ONLY + - column: + defaultExpr: 32:::INT8 + ... + direction: DROP + mutationId: 1 + state: DELETE_ONLY + - direction: DROP - index: - - constraintId: 3 - - createdExplicitly: true + + index: + constraintId: 1 + createdAtNanos: "1640995200000000000" - encodingType: 1 - foreignKey: {} - geoConfig: {} - - id: 4 + + encodingType: 1 + + foreignKey: {} + + geoConfig: {} + 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 - - crdb_internal_column_3_name_placeholder - unique: true - - useDeletePreservingEncoding: true - version: 4 - mutationId: 1 + + - crdb_internal_column_3_name_placeholder + + unique: true + + version: 4 + + mutationId: 1 state: DELETE_AND_WRITE_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_AND_WRITE_ONLY name: t - nextColumnId: 5 ... parentId: 100 primaryIndex: @@ -589,11 +568,11 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "6" + version: "7" -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 3 with 1 MutationType op pending" +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 3 with 7 MutationType ops pending" set schema change job #1 to non-cancellable commit transaction #10 begin transaction #11 -## PostCommitNonRevertiblePhase stage 2 of 3 with 3 MutationType ops +## PostCommitNonRevertiblePhase stage 2 of 3 with 9 MutationType ops upsert descriptor #104 ... id: 104 @@ -603,6 +582,77 @@ upsert descriptor #104 + modificationTime: {} mutations: - column: + ... + 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 + - - 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: 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: + - - crdb_internal_column_3_name_placeholder + - unique: true + - useDeletePreservingEncoding: true + - version: 4 + - 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 + - - column: + defaultExpr: 32:::INT8 + id: 3 ... version: 4 mutationId: 1 @@ -615,10 +665,14 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "7" + version: "8" -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 3 with 12 MutationType ops pending" +write *eventpb.DropIndex to event log for descriptor #104: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE +create job #2 (non-cancelable: true): "GC for ALTER TABLE defaultdb.public.t DROP COLUMN j CASCADE" + descriptor IDs: [104] +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 3 with 6 MutationType ops pending" commit transaction #11 +notified job registry to adopt jobs: [2] begin transaction #12 -## PostCommitNonRevertiblePhase stage 3 of 3 with 14 MutationType ops +## PostCommitNonRevertiblePhase stage 3 of 3 with 8 MutationType ops upsert descriptor #104 ... createAsOfTime: @@ -668,69 +722,6 @@ upsert descriptor #104 - 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: - - createdAtNanos: "1640995200000000000" - - foreignKey: {} - - geoConfig: {} - - id: 2 - - interleave: {} - - keyColumnDirections: - - - ASC - - - ASC - - keyColumnIds: - - - 4 - - - 3 - - keyColumnNames: - - - crdb_internal_column_4_name_placeholder - - - 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: 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: [] - - storeColumnNames: [] - - unique: true - - useDeletePreservingEncoding: true - - version: 4 - - mutationId: 1 - - state: DELETE_ONLY - - - column: - defaultExpr: 32:::INT8 - id: 3 - name: crdb_internal_column_3_name_placeholder @@ -780,11 +771,10 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "8" + version: "9" -write *eventpb.DropIndex to event log for descriptor #104: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE write *eventpb.FinishSchemaChange to event log for descriptor 104 -create job #2 (non-cancelable: true): "GC for ALTER TABLE defaultdb.public.t DROP COLUMN j CASCADE" +create job #3 (non-cancelable: true): "GC for ALTER TABLE defaultdb.public.t DROP COLUMN j CASCADE" descriptor IDs: [104] update progress of schema change job #1: "all stages completed" commit transaction #12 -notified job registry to adopt jobs: [2] +notified job registry to adopt jobs: [3] # end PostCommitPhase diff --git a/pkg/sql/schemachanger/testdata/explain/add_column b/pkg/sql/schemachanger/testdata/explain/add_column index 7544631f72dd..6333498041d6 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column +++ b/pkg/sql/schemachanger/testdata/explain/add_column @@ -9,18 +9,18 @@ EXPLAIN (ddl) ALTER TABLE db.public.tbl ADD COLUMN j INT NOT NULL DEFAULT 42; Schema change plan for ALTER TABLE ‹db›.‹public›.‹tbl› ADD COLUMN ‹j› INT8 NOT NULL DEFAULT ‹42›; ├── StatementPhase │ └── Stage 1 of 1 in StatementPhase - │ ├── 9 elements transitioning toward PUBLIC + │ ├── 7 elements transitioning toward PUBLIC │ │ ├── ABSENT → DELETE_ONLY Column:{DescID: 106, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 106, Name: j, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnDefaultExpression:{DescID: 106, ColumnID: 2} │ │ ├── ABSENT → BACKFILL_ONLY PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ ├── 3 elements transitioning toward TRANSIENT_ABSENT + │ │ ├── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ ├── 1 element transitioning toward TRANSIENT_ABSENT - │ │ └── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ └── 11 Mutation operations │ ├── MakeAddedColumnDeleteOnly {"Column":{"ColumnID":2,"PgAttributeNum":2,"TableID":106}} │ ├── LogEvent {"TargetStatus":2} @@ -95,14 +95,15 @@ Schema change plan for ALTER TABLE ‹db›.‹public›.‹tbl› ADD COLUMN │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 106, ColumnID: 2} │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 106, Name: tbl_pkey, IndexID: 2} - │ ├── 1 element transitioning toward TRANSIENT_ABSENT - │ │ └── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} - │ └── 10 Mutation operations + │ ├── 3 elements transitioning toward TRANSIENT_ABSENT + │ │ ├── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} + │ │ ├── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} + │ │ └── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} + │ └── 9 Mutation operations │ ├── MakeDroppedPrimaryIndexDeleteAndWriteOnly {"IndexID":1,"TableID":106} │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":106} │ ├── SetIndexName {"IndexID":2,"Name":"tbl_pkey","TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":1,"TableID":106} │ ├── MakeAddedPrimaryIndexPublic {"IndexID":2,"TableID":106} │ ├── MakeColumnPublic {"ColumnID":2,"TableID":106} │ ├── RefreshStats {"TableID":106} @@ -110,19 +111,19 @@ Schema change plan for ALTER TABLE ‹db›.‹public›.‹tbl› ADD COLUMN │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} ├── Stage 2 of 3 in PostCommitNonRevertiblePhase │ ├── 1 element transitioning toward ABSENT - │ │ └── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} - │ └── 3 Mutation operations + │ │ └── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} + │ ├── 1 element transitioning toward TRANSIENT_ABSENT + │ │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} + │ └── 5 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":1,"TableID":106} + │ ├── CreateGcJobForIndex {"IndexID":3,"TableID":106} + │ ├── MakeIndexAbsent {"IndexID":3,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 3 of 3 in PostCommitNonRevertiblePhase ├── 1 element transitioning toward ABSENT - │ └── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} - ├── 1 element transitioning toward TRANSIENT_ABSENT - │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} - └── 6 Mutation operations - ├── CreateGcJobForIndex {"IndexID":3,"TableID":106} - ├── MakeIndexAbsent {"IndexID":3,"TableID":106} + │ └── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} + └── 4 Mutation operations ├── CreateGcJobForIndex {"IndexID":1,"TableID":106} ├── MakeIndexAbsent {"IndexID":1,"TableID":106} ├── RemoveJobStateFromDescriptor {"DescriptorID":106} diff --git a/pkg/sql/schemachanger/testdata/explain/add_column.rollback_1_of_7 b/pkg/sql/schemachanger/testdata/explain/add_column.rollback_1_of_7 index 6d3bdf0588ef..9fcc38ef9c95 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column.rollback_1_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/add_column.rollback_1_of_7 @@ -21,12 +21,8 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - └── 13 Mutation operations + └── 9 Mutation operations ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":106} - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":106} - ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"Kind":2,"TableID":106} - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":106} - ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"Kind":2,"TableID":106} ├── CreateGcJobForIndex {"IndexID":2,"TableID":106} ├── MakeIndexAbsent {"IndexID":2,"TableID":106} ├── CreateGcJobForIndex {"IndexID":3,"TableID":106} diff --git a/pkg/sql/schemachanger/testdata/explain/add_column.rollback_2_of_7 b/pkg/sql/schemachanger/testdata/explain/add_column.rollback_2_of_7 index cc85b8543d1a..8c47ebd7e963 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column.rollback_2_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/add_column.rollback_2_of_7 @@ -19,14 +19,10 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ └── 11 Mutation operations + │ └── 7 Mutation operations │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":2,"TableID":106} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"Kind":2,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"Kind":2,"TableID":106} │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":106} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} diff --git a/pkg/sql/schemachanger/testdata/explain/add_column.rollback_3_of_7 b/pkg/sql/schemachanger/testdata/explain/add_column.rollback_3_of_7 index 360c67885690..0a19568d539a 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column.rollback_3_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/add_column.rollback_3_of_7 @@ -19,14 +19,10 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ └── 11 Mutation operations + │ └── 7 Mutation operations │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":2,"TableID":106} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"Kind":2,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"Kind":2,"TableID":106} │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":106} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} diff --git a/pkg/sql/schemachanger/testdata/explain/add_column.rollback_4_of_7 b/pkg/sql/schemachanger/testdata/explain/add_column.rollback_4_of_7 index 84fe46fe84c9..989f2e55c190 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column.rollback_4_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/add_column.rollback_4_of_7 @@ -19,14 +19,10 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ └── 11 Mutation operations + │ └── 7 Mutation operations │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":2,"TableID":106} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"Kind":2,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"Kind":2,"TableID":106} │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":106} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} diff --git a/pkg/sql/schemachanger/testdata/explain/add_column.rollback_5_of_7 b/pkg/sql/schemachanger/testdata/explain/add_column.rollback_5_of_7 index e8948119afc5..dcda26a91ca0 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column.rollback_5_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/add_column.rollback_5_of_7 @@ -19,14 +19,10 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ └── 10 Mutation operations + │ └── 6 Mutation operations │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":2,"TableID":106} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"Kind":2,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"Kind":2,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} diff --git a/pkg/sql/schemachanger/testdata/explain/add_column.rollback_6_of_7 b/pkg/sql/schemachanger/testdata/explain/add_column.rollback_6_of_7 index ed21792e315a..9ef86308f945 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column.rollback_6_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/add_column.rollback_6_of_7 @@ -19,14 +19,10 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ └── 10 Mutation operations + │ └── 6 Mutation operations │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":2,"TableID":106} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"Kind":2,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"Kind":2,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} diff --git a/pkg/sql/schemachanger/testdata/explain/add_column.rollback_7_of_7 b/pkg/sql/schemachanger/testdata/explain/add_column.rollback_7_of_7 index b717f5419300..7001fc6562c3 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column.rollback_7_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/add_column.rollback_7_of_7 @@ -19,15 +19,11 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ └── 10 Mutation operations + │ └── 6 Mutation operations │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":2,"TableID":106} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"Kind":2,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"Kind":2,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/explain/add_column_default_seq b/pkg/sql/schemachanger/testdata/explain/add_column_default_seq index d481020ba378..c142761d30ce 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column_default_seq +++ b/pkg/sql/schemachanger/testdata/explain/add_column_default_seq @@ -9,18 +9,18 @@ EXPLAIN (ddl) ALTER TABLE db.public.tbl ADD COLUMN l INT NOT NULL DEFAULT nextva Schema change plan for ALTER TABLE ‹db›.‹public›.‹tbl› ADD COLUMN ‹l› INT8 NOT NULL DEFAULT nextval(‹'db.public.sq1'›); ├── StatementPhase │ └── Stage 1 of 1 in StatementPhase - │ ├── 9 elements transitioning toward PUBLIC + │ ├── 7 elements transitioning toward PUBLIC │ │ ├── ABSENT → DELETE_ONLY Column:{DescID: 106, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 106, Name: l, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnDefaultExpression:{DescID: 106, ColumnID: 2} │ │ ├── ABSENT → BACKFILL_ONLY PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ ├── 3 elements transitioning toward TRANSIENT_ABSENT + │ │ ├── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ ├── 1 element transitioning toward TRANSIENT_ABSENT - │ │ └── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ └── 12 Mutation operations │ ├── MakeAddedColumnDeleteOnly {"Column":{"ColumnID":2,"PgAttributeNum":2,"TableID":106}} │ ├── LogEvent {"TargetStatus":2} @@ -101,14 +101,15 @@ Schema change plan for ALTER TABLE ‹db›.‹public›.‹tbl› ADD COLUMN │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 106, ColumnID: 2} │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 106, Name: tbl_pkey, IndexID: 2} - │ ├── 1 element transitioning toward TRANSIENT_ABSENT - │ │ └── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} - │ └── 11 Mutation operations + │ ├── 3 elements transitioning toward TRANSIENT_ABSENT + │ │ ├── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} + │ │ ├── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} + │ │ └── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} + │ └── 10 Mutation operations │ ├── MakeDroppedPrimaryIndexDeleteAndWriteOnly {"IndexID":1,"TableID":106} │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":106} │ ├── SetIndexName {"IndexID":2,"Name":"tbl_pkey","TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":1,"TableID":106} │ ├── MakeAddedPrimaryIndexPublic {"IndexID":2,"TableID":106} │ ├── MakeColumnPublic {"ColumnID":2,"TableID":106} │ ├── RefreshStats {"TableID":106} @@ -117,20 +118,20 @@ Schema change plan for ALTER TABLE ‹db›.‹public›.‹tbl› ADD COLUMN │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} ├── Stage 2 of 3 in PostCommitNonRevertiblePhase │ ├── 1 element transitioning toward ABSENT - │ │ └── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} - │ └── 4 Mutation operations + │ │ └── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} + │ ├── 1 element transitioning toward TRANSIENT_ABSENT + │ │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} + │ └── 6 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":1,"TableID":106} + │ ├── CreateGcJobForIndex {"IndexID":3,"TableID":106} + │ ├── MakeIndexAbsent {"IndexID":3,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":107} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 3 of 3 in PostCommitNonRevertiblePhase ├── 1 element transitioning toward ABSENT - │ └── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} - ├── 1 element transitioning toward TRANSIENT_ABSENT - │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} - └── 7 Mutation operations - ├── CreateGcJobForIndex {"IndexID":3,"TableID":106} - ├── MakeIndexAbsent {"IndexID":3,"TableID":106} + │ └── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} + └── 5 Mutation operations ├── CreateGcJobForIndex {"IndexID":1,"TableID":106} ├── MakeIndexAbsent {"IndexID":1,"TableID":106} ├── RemoveJobStateFromDescriptor {"DescriptorID":106} diff --git a/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_1_of_7 b/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_1_of_7 index a2ba784c6c8d..956b45abd38b 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_1_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_1_of_7 @@ -21,12 +21,8 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - └── 15 Mutation operations + └── 11 Mutation operations ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":106} - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":106} - ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"Kind":2,"TableID":106} - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":106} - ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"Kind":2,"TableID":106} ├── CreateGcJobForIndex {"IndexID":2,"TableID":106} ├── MakeIndexAbsent {"IndexID":2,"TableID":106} ├── CreateGcJobForIndex {"IndexID":3,"TableID":106} diff --git a/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_2_of_7 b/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_2_of_7 index 9f3ced40d0e6..7f7ebf49ab23 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_2_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_2_of_7 @@ -19,14 +19,10 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ └── 12 Mutation operations + │ └── 8 Mutation operations │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":2,"TableID":106} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"Kind":2,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"Kind":2,"TableID":106} │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":106} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} diff --git a/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_3_of_7 b/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_3_of_7 index 81fe955dbe79..b5cde4b28f7f 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_3_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_3_of_7 @@ -19,14 +19,10 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ └── 12 Mutation operations + │ └── 8 Mutation operations │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":2,"TableID":106} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"Kind":2,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"Kind":2,"TableID":106} │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":106} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} diff --git a/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_4_of_7 b/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_4_of_7 index d27f4f9908ac..446b4004875f 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_4_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_4_of_7 @@ -19,14 +19,10 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ └── 12 Mutation operations + │ └── 8 Mutation operations │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":2,"TableID":106} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"Kind":2,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"Kind":2,"TableID":106} │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":106} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} diff --git a/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_5_of_7 b/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_5_of_7 index d87f8c95006a..ee85ad0b8e76 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_5_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_5_of_7 @@ -19,14 +19,10 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ └── 11 Mutation operations + │ └── 7 Mutation operations │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":2,"TableID":106} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"Kind":2,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"Kind":2,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":107} diff --git a/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_6_of_7 b/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_6_of_7 index 6204d4bc7c20..f164087de2ea 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_6_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_6_of_7 @@ -19,14 +19,10 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ └── 11 Mutation operations + │ └── 7 Mutation operations │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":2,"TableID":106} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"Kind":2,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"Kind":2,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":107} diff --git a/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_7_of_7 b/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_7_of_7 index eb0f68197beb..9c8bc0b98e97 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_7_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/add_column_default_seq.rollback_7_of_7 @@ -19,15 +19,11 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ └── 11 Mutation operations + │ └── 7 Mutation operations │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":2,"TableID":106} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"Kind":2,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"Kind":2,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":107} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} diff --git a/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla b/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla index 3c3766267271..b3cd5c6552b4 100644 --- a/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla +++ b/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla @@ -7,19 +7,19 @@ EXPLAIN (ddl) ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (j); Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› ALTER PRIMARY KEY USING COLUMNS (‹j›); ├── StatementPhase │ └── Stage 1 of 1 in StatementPhase - │ ├── 10 elements transitioning toward PUBLIC + │ ├── 8 elements transitioning toward PUBLIC │ │ ├── ABSENT → BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} - │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── ABSENT → BACKFILL_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} - │ ├── 2 elements transitioning toward TRANSIENT_ABSENT + │ ├── 4 elements transitioning toward TRANSIENT_ABSENT │ │ ├── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} + │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} + │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ └── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1} │ └── 12 Mutation operations │ ├── MakeAddedIndexBackfilling {"Index":{"ConstraintID":2,"IndexID":2,"IsUnique":true,"SourceIndexID":1,"TableID":104,"TemporaryIndexID":3}} @@ -109,40 +109,40 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› ALTER PR │ │ ├── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 2} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} - │ ├── 2 elements transitioning toward TRANSIENT_ABSENT + │ ├── 4 elements transitioning toward TRANSIENT_ABSENT │ │ ├── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} + │ │ ├── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} + │ │ ├── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ └── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1} - │ └── 12 Mutation operations + │ └── 10 Mutation operations │ ├── MakeDroppedPrimaryIndexDeleteAndWriteOnly {"IndexID":1,"TableID":104} │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_pkey","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":5,"TableID":104} │ ├── SetIndexName {"IndexID":4,"Name":"t_i_key","TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":1,"Kind":2,"TableID":104} │ ├── MakeAddedPrimaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":4,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} ├── Stage 2 of 3 in PostCommitNonRevertiblePhase │ ├── 1 element transitioning toward ABSENT - │ │ └── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ └── 3 Mutation operations + │ │ └── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ ├── 2 elements transitioning toward TRANSIENT_ABSENT + │ │ ├── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} + │ │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1} + │ └── 7 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":1,"TableID":104} + │ ├── CreateGcJobForIndex {"IndexID":3,"TableID":104} + │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} + │ ├── CreateGcJobForIndex {"IndexID":5,"TableID":104} + │ ├── MakeIndexAbsent {"IndexID":5,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 3 of 3 in PostCommitNonRevertiblePhase ├── 1 element transitioning toward ABSENT - │ └── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - ├── 2 elements transitioning toward TRANSIENT_ABSENT - │ ├── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} - │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1} - └── 8 Mutation operations - ├── CreateGcJobForIndex {"IndexID":3,"TableID":104} - ├── MakeIndexAbsent {"IndexID":3,"TableID":104} - ├── CreateGcJobForIndex {"IndexID":5,"TableID":104} - ├── MakeIndexAbsent {"IndexID":5,"TableID":104} + │ └── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + └── 4 Mutation operations ├── CreateGcJobForIndex {"IndexID":1,"TableID":104} ├── MakeIndexAbsent {"IndexID":1,"TableID":104} ├── RemoveJobStateFromDescriptor {"DescriptorID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_1_of_7 b/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_1_of_7 index 43dfe794a583..0050550107ac 100644 --- a/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_1_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_1_of_7 @@ -21,15 +21,7 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› A │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} - └── 19 Mutation operations - ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"TableID":104} - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"Kind":2,"TableID":104} - ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"TableID":104} - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"Kind":2,"TableID":104} - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"TableID":104} - ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":4,"Kind":1,"TableID":104} - ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":5,"Kind":1,"TableID":104} + └── 11 Mutation operations ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} ├── MakeIndexAbsent {"IndexID":2,"TableID":104} ├── CreateGcJobForIndex {"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_2_of_7 b/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_2_of_7 index aad9e04f9b97..08741c5e1573 100644 --- a/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_2_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_2_of_7 @@ -21,17 +21,9 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› A │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} - │ └── 17 Mutation operations - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"Kind":2,"TableID":104} + │ └── 9 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"Kind":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":4,"Kind":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":5,"Kind":1,"TableID":104} │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} │ ├── LogEvent {"TargetStatus":1} diff --git a/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_3_of_7 b/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_3_of_7 index 87d26d726745..a477b89983cb 100644 --- a/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_3_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_3_of_7 @@ -21,17 +21,9 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› A │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} - │ └── 17 Mutation operations - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"Kind":2,"TableID":104} + │ └── 9 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"Kind":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":4,"Kind":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":5,"Kind":1,"TableID":104} │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} │ ├── LogEvent {"TargetStatus":1} diff --git a/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_4_of_7 b/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_4_of_7 index e68d93dcfdc9..3e97d46c591b 100644 --- a/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_4_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_4_of_7 @@ -21,17 +21,9 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› A │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} - │ └── 17 Mutation operations - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"Kind":2,"TableID":104} + │ └── 9 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"Kind":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":4,"Kind":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":5,"Kind":1,"TableID":104} │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} │ ├── LogEvent {"TargetStatus":1} diff --git a/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_5_of_7 b/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_5_of_7 index e7f8837e9a4b..d7d214061585 100644 --- a/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_5_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_5_of_7 @@ -21,19 +21,11 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› A │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} - │ └── 14 Mutation operations - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"Kind":2,"TableID":104} + │ └── 6 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"Kind":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":5,"Kind":1,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":4,"Kind":1,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_6_of_7 b/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_6_of_7 index 43c0c986396b..a0612068f966 100644 --- a/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_6_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_6_of_7 @@ -21,19 +21,11 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› A │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} - │ └── 14 Mutation operations - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"Kind":2,"TableID":104} + │ └── 6 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"Kind":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":5,"Kind":1,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":4,"Kind":1,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_7_of_7 b/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_7_of_7 index f7eed40e659f..0bbf403f591c 100644 --- a/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_7_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/alter_table_alter_primary_key_vanilla.rollback_7_of_7 @@ -21,19 +21,11 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› A │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} - │ └── 14 Mutation operations + │ └── 6 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"Kind":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"Kind":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":4,"Kind":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":5,"Kind":1,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/explain/create_index.rollback_1_of_7 b/pkg/sql/schemachanger/testdata/explain/create_index.rollback_1_of_7 index 965cdd95f67e..475b000a707a 100644 --- a/pkg/sql/schemachanger/testdata/explain/create_index.rollback_1_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/create_index.rollback_1_of_7 @@ -16,11 +16,7 @@ Schema change plan for rolling back CREATE INDEX ‹idx1› ON ‹defaultdb›.p │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 0, SourceIndexID: 1} │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - └── 11 Mutation operations - ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"TableID":106} - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"Kind":1,"TableID":106} - ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"TableID":106} - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"Kind":1,"TableID":106} + └── 7 Mutation operations ├── LogEvent {"TargetStatus":1} ├── CreateGcJobForIndex {"IndexID":2,"TableID":106} ├── MakeIndexAbsent {"IndexID":2,"TableID":106} diff --git a/pkg/sql/schemachanger/testdata/explain/create_index.rollback_2_of_7 b/pkg/sql/schemachanger/testdata/explain/create_index.rollback_2_of_7 index ca0ce448ea7c..061f15d2e6b3 100644 --- a/pkg/sql/schemachanger/testdata/explain/create_index.rollback_2_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/create_index.rollback_2_of_7 @@ -16,12 +16,8 @@ Schema change plan for rolling back CREATE INDEX ‹idx1› ON ‹defaultdb›.p │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 0, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ └── 10 Mutation operations + │ └── 6 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"Kind":1,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"Kind":1,"TableID":106} │ ├── LogEvent {"TargetStatus":1} │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":106} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":106} diff --git a/pkg/sql/schemachanger/testdata/explain/create_index.rollback_3_of_7 b/pkg/sql/schemachanger/testdata/explain/create_index.rollback_3_of_7 index f622fd30ad8d..518ff1d8e3a6 100644 --- a/pkg/sql/schemachanger/testdata/explain/create_index.rollback_3_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/create_index.rollback_3_of_7 @@ -16,12 +16,8 @@ Schema change plan for rolling back CREATE INDEX ‹idx1› ON ‹defaultdb›.p │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 0, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ └── 10 Mutation operations + │ └── 6 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"Kind":1,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"Kind":1,"TableID":106} │ ├── LogEvent {"TargetStatus":1} │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":106} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":106} diff --git a/pkg/sql/schemachanger/testdata/explain/create_index.rollback_4_of_7 b/pkg/sql/schemachanger/testdata/explain/create_index.rollback_4_of_7 index c954da978c74..4e86e70c0732 100644 --- a/pkg/sql/schemachanger/testdata/explain/create_index.rollback_4_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/create_index.rollback_4_of_7 @@ -16,15 +16,11 @@ Schema change plan for rolling back CREATE INDEX ‹idx1› ON ‹defaultdb›.p │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 0, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ └── 10 Mutation operations - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"Kind":1,"TableID":106} + │ └── 6 Mutation operations │ ├── LogEvent {"TargetStatus":1} │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":106} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"Kind":1,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/explain/create_index.rollback_5_of_7 b/pkg/sql/schemachanger/testdata/explain/create_index.rollback_5_of_7 index a265ab61810a..0e190f923859 100644 --- a/pkg/sql/schemachanger/testdata/explain/create_index.rollback_5_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/create_index.rollback_5_of_7 @@ -16,13 +16,9 @@ Schema change plan for rolling back CREATE INDEX ‹idx1› ON ‹defaultdb›.p │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 0, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ └── 8 Mutation operations + │ └── 4 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"Kind":1,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"Kind":1,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/explain/create_index.rollback_6_of_7 b/pkg/sql/schemachanger/testdata/explain/create_index.rollback_6_of_7 index 604ce83c2443..bec7a0c33b67 100644 --- a/pkg/sql/schemachanger/testdata/explain/create_index.rollback_6_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/create_index.rollback_6_of_7 @@ -16,13 +16,9 @@ Schema change plan for rolling back CREATE INDEX ‹idx1› ON ‹defaultdb›.p │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 0, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ └── 8 Mutation operations + │ └── 4 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"Kind":1,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"Kind":1,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/explain/create_index.rollback_7_of_7 b/pkg/sql/schemachanger/testdata/explain/create_index.rollback_7_of_7 index fe2c4441b96d..94cfaec315ae 100644 --- a/pkg/sql/schemachanger/testdata/explain/create_index.rollback_7_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/create_index.rollback_7_of_7 @@ -16,13 +16,9 @@ Schema change plan for rolling back CREATE INDEX ‹idx1› ON ‹defaultdb›.p │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 0, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ └── 8 Mutation operations + │ └── 4 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":3,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"Kind":1,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"Kind":1,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_basic b/pkg/sql/schemachanger/testdata/explain/drop_column_basic index c6ccc2985437..9191bf7214ce 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_basic +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_basic @@ -10,12 +10,12 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── 2 elements transitioning toward ABSENT │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104, ColumnID: 2} │ │ └── PUBLIC → ABSENT ColumnName:{DescID: 104, Name: j, ColumnID: 2} - │ ├── 3 elements transitioning toward PUBLIC + │ ├── 2 elements transitioning toward PUBLIC │ │ ├── ABSENT → BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ ├── 2 elements transitioning toward TRANSIENT_ABSENT + │ │ ├── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ ├── 1 element transitioning toward TRANSIENT_ABSENT - │ │ └── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ └── 7 Mutation operations │ ├── MakeDroppedColumnDeleteAndWriteOnly {"ColumnID":2,"TableID":104} │ ├── LogEvent {"TargetStatus":1} @@ -84,36 +84,35 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── 2 elements transitioning toward PUBLIC │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 2} - │ ├── 1 element transitioning toward TRANSIENT_ABSENT - │ │ └── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} - │ └── 10 Mutation operations + │ ├── 2 elements transitioning toward TRANSIENT_ABSENT + │ │ ├── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} + │ │ └── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} + │ └── 8 Mutation operations │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":2,"TableID":104} │ ├── MakeDroppedPrimaryIndexDeleteAndWriteOnly {"IndexID":1,"TableID":104} │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_pkey","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":1,"Kind":2,"TableID":104} │ ├── MakeAddedPrimaryIndexPublic {"IndexID":2,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} ├── Stage 2 of 3 in PostCommitNonRevertiblePhase │ ├── 1 element transitioning toward ABSENT - │ │ └── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ └── 3 Mutation operations + │ │ └── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ ├── 1 element transitioning toward TRANSIENT_ABSENT + │ │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} + │ └── 5 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":1,"TableID":104} + │ ├── CreateGcJobForIndex {"IndexID":3,"TableID":104} + │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 3 of 3 in PostCommitNonRevertiblePhase ├── 3 elements transitioning toward ABSENT - │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104, ColumnID: 2} - │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} - │ └── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - ├── 1 element transitioning toward TRANSIENT_ABSENT - │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} - └── 7 Mutation operations - ├── CreateGcJobForIndex {"IndexID":3,"TableID":104} - ├── MakeIndexAbsent {"IndexID":3,"TableID":104} + │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104, ColumnID: 2} + │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ └── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + └── 5 Mutation operations ├── CreateGcJobForIndex {"IndexID":1,"TableID":104} ├── MakeIndexAbsent {"IndexID":1,"TableID":104} ├── MakeColumnAbsent {"ColumnID":2,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_1_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_1_of_7 index 5ad493f33364..3a3643d03245 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_1_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_1_of_7 @@ -16,12 +16,10 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D ├── 2 elements transitioning toward PUBLIC │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} - └── 11 Mutation operations + └── 9 Mutation operations + ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} ├── MakeColumnPublic {"ColumnID":2,"TableID":104} ├── RefreshStats {"TableID":104} - ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":104} - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} ├── MakeIndexAbsent {"IndexID":2,"TableID":104} ├── CreateGcJobForIndex {"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_2_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_2_of_7 index 67848ad90c0b..b186f8147827 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_2_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_2_of_7 @@ -16,13 +16,11 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── 2 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} - │ └── 10 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 8 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_3_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_3_of_7 index 87c7cb445e7f..3564215441a9 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_3_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_3_of_7 @@ -16,13 +16,11 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── 2 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} - │ └── 10 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 8 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_4_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_4_of_7 index 0c29b888af7e..fada25d32582 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_4_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_4_of_7 @@ -16,13 +16,11 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── 2 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} - │ └── 10 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 8 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_5_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_5_of_7 index 31be2a859d05..2b3854b6a7b4 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_5_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_5_of_7 @@ -16,13 +16,11 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── 2 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} - │ └── 9 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 7 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_6_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_6_of_7 index 3a30cf9a8eea..800a1818fd39 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_6_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_6_of_7 @@ -16,13 +16,11 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── 2 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} - │ └── 9 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 7 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_7_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_7_of_7 index 9a3f7675ad3c..ed3dd8a6cc16 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_7_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_basic.rollback_7_of_7 @@ -16,14 +16,12 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── 2 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} - │ └── 9 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 7 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index b/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index index c48ed42b3d9f..4bf1f0a25b51 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index @@ -14,25 +14,25 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ ├── PUBLIC → VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} - │ ├── 3 elements transitioning toward PUBLIC + │ ├── 2 elements transitioning toward PUBLIC │ │ ├── ABSENT → BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} + │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} + │ ├── 2 elements transitioning toward TRANSIENT_ABSENT + │ │ ├── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ ├── 1 element transitioning toward TRANSIENT_ABSENT - │ │ └── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ └── 12 Mutation operations │ ├── MakeDroppedColumnDeleteAndWriteOnly {"ColumnID":2,"TableID":104} │ ├── LogEvent {"TargetStatus":1} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":104} - │ ├── MakeDroppedColumnDeleteAndWriteOnly {"ColumnID":3,"TableID":104} - │ ├── LogEvent {"TargetStatus":1} - │ ├── SetColumnName {"ColumnID":3,"Name":"crdb_internal_co...","TableID":104} │ ├── MakeDroppedNonPrimaryIndexDeleteAndWriteOnly {"IndexID":2,"TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeAddedIndexBackfilling {"Index":{"ConstraintID":2,"IndexID":3,"IsUnique":true,"SourceIndexID":1,"TableID":104,"TemporaryIndexID":4}} │ ├── AddColumnToIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── MakeAddedTempIndexDeleteOnly {"Index":{"ConstraintID":3,"IndexID":4,"IsUnique":true,"SourceIndexID":1,"TableID":104}} - │ └── AddColumnToIndex {"ColumnID":1,"IndexID":4,"TableID":104} + │ ├── AddColumnToIndex {"ColumnID":1,"IndexID":4,"TableID":104} + │ ├── MakeDroppedColumnDeleteAndWriteOnly {"ColumnID":3,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} + │ └── SetColumnName {"ColumnID":3,"Name":"crdb_internal_co...","TableID":104} ├── PreCommitPhase │ └── Stage 1 of 1 in PreCommitPhase │ └── 2 Mutation operations @@ -97,49 +97,46 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── 2 elements transitioning toward PUBLIC │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 3} - │ ├── 1 element transitioning toward TRANSIENT_ABSENT - │ │ └── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ └── 14 Mutation operations + │ ├── 2 elements transitioning toward TRANSIENT_ABSENT + │ │ ├── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} + │ │ └── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} + │ └── 10 Mutation operations │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":2,"TableID":104} │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":3,"TableID":104} │ ├── MakeDroppedPrimaryIndexDeleteAndWriteOnly {"IndexID":1,"TableID":104} │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":104} │ ├── SetIndexName {"IndexID":3,"Name":"t_pkey","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":1,"Kind":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":104} │ ├── MakeAddedPrimaryIndexPublic {"IndexID":3,"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 - │ ├── 1 element transitioning toward ABSENT - │ │ └── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ └── 3 Mutation operations + │ ├── 4 elements transitioning toward ABSENT + │ │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104, ColumnID: 3} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} + │ │ ├── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ ├── 1 element transitioning toward TRANSIENT_ABSENT + │ │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} + │ └── 9 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":1,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} + │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} + │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} + │ ├── CreateGcJobForIndex {"IndexID":4,"TableID":104} + │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} + │ ├── MakeColumnAbsent {"ColumnID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 3 of 3 in PostCommitNonRevertiblePhase - ├── 6 elements transitioning toward ABSENT - │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104, ColumnID: 2} - │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} - │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104, ColumnID: 3} - │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} - │ ├── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - ├── 1 element transitioning toward TRANSIENT_ABSENT - │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - └── 11 Mutation operations - ├── CreateGcJobForIndex {"IndexID":4,"TableID":104} - ├── MakeIndexAbsent {"IndexID":4,"TableID":104} + ├── 3 elements transitioning toward ABSENT + │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104, ColumnID: 2} + │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ └── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + └── 5 Mutation operations ├── CreateGcJobForIndex {"IndexID":1,"TableID":104} ├── MakeIndexAbsent {"IndexID":1,"TableID":104} - ├── LogEvent {"TargetStatus":1} - ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} - ├── MakeIndexAbsent {"IndexID":2,"TableID":104} ├── MakeColumnAbsent {"ColumnID":2,"TableID":104} - ├── MakeColumnAbsent {"ColumnID":3,"TableID":104} ├── RemoveJobStateFromDescriptor {"DescriptorID":104} └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"all stages compl..."} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_1_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_1_of_7 index 4648db6da18e..61a89e25d4db 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_1_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_1_of_7 @@ -20,16 +20,14 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} - └── 16 Mutation operations + └── 14 Mutation operations + ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} + ├── SetColumnName {"ColumnID":3,"Name":"crdb_internal_id...","TableID":104} + ├── SetIndexName {"IndexID":2,"Name":"t_expr_idx","TableID":104} ├── MakeColumnPublic {"ColumnID":2,"TableID":104} ├── RefreshStats {"TableID":104} - ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} ├── MakeColumnPublic {"ColumnID":3,"TableID":104} ├── RefreshStats {"TableID":104} - ├── SetColumnName {"ColumnID":3,"Name":"crdb_internal_id...","TableID":104} - ├── SetIndexName {"IndexID":2,"Name":"t_expr_idx","TableID":104} - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} ├── CreateGcJobForIndex {"IndexID":3,"TableID":104} ├── MakeIndexAbsent {"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_2_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_2_of_7 index ceb08cd849e4..fade3c656f29 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_2_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_2_of_7 @@ -20,17 +20,15 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} - │ └── 15 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 13 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── MakeColumnPublic {"ColumnID":3,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── SetColumnName {"ColumnID":3,"Name":"crdb_internal_id...","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_idx","TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":3,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── CreateGcJobForIndex {"IndexID":3,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_3_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_3_of_7 index 9da75177d2d0..98789b6951b4 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_3_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_3_of_7 @@ -20,17 +20,15 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} - │ └── 15 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 13 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── MakeColumnPublic {"ColumnID":3,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── SetColumnName {"ColumnID":3,"Name":"crdb_internal_id...","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_idx","TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":3,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── CreateGcJobForIndex {"IndexID":3,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_4_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_4_of_7 index 5965cac86300..a2c90d2aa915 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_4_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_4_of_7 @@ -20,17 +20,15 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} - │ └── 15 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 13 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── MakeColumnPublic {"ColumnID":3,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── SetColumnName {"ColumnID":3,"Name":"crdb_internal_id...","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_idx","TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":3,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── CreateGcJobForIndex {"IndexID":3,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_5_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_5_of_7 index 325c51c8c3c2..40b4ecd7191a 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_5_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_5_of_7 @@ -20,17 +20,15 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} - │ └── 14 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 12 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── MakeColumnPublic {"ColumnID":3,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── SetColumnName {"ColumnID":3,"Name":"crdb_internal_id...","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_idx","TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":3,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_6_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_6_of_7 index 7f6d85aaa9e7..4c9fd672dead 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_6_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_6_of_7 @@ -20,17 +20,15 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} - │ └── 14 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 12 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── MakeColumnPublic {"ColumnID":3,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── SetColumnName {"ColumnID":3,"Name":"crdb_internal_id...","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_idx","TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":3,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_7_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_7_of_7 index 83d3b3ba80a7..1291f5f8b041 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_7_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index.rollback_7_of_7 @@ -20,18 +20,16 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} - │ └── 14 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 12 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── MakeColumnPublic {"ColumnID":3,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── SetColumnName {"ColumnID":3,"Name":"crdb_internal_id...","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_idx","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":3,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_10_of_15 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_10_of_15 index 0fc7a4733838..e0aeec5611b8 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_10_of_15 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_10_of_15 @@ -32,14 +32,8 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ └── 27 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 19 Mutation operations │ ├── SetIndexName {"IndexID":1,"Name":"t_pkey","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} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_k_idx","TableID":104} @@ -47,14 +41,12 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── SetIndexName {"IndexID":3,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":6,"Kind":1,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedPrimaryIndexPublic {"IndexID":1,"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"Kind":1,"TableID":104} │ ├── LogEvent {"TargetStatus":1} │ ├── CreateGcJobForIndex {"IndexID":5,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":5,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_11_of_15 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_11_of_15 index 14583480b01e..6c67fafa30ca 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_11_of_15 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_11_of_15 @@ -32,14 +32,8 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ └── 27 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 19 Mutation operations │ ├── SetIndexName {"IndexID":1,"Name":"t_pkey","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} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_k_idx","TableID":104} @@ -47,14 +41,12 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── SetIndexName {"IndexID":3,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":6,"Kind":1,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedPrimaryIndexPublic {"IndexID":1,"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"Kind":1,"TableID":104} │ ├── LogEvent {"TargetStatus":1} │ ├── CreateGcJobForIndex {"IndexID":5,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":5,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_12_of_15 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_12_of_15 index 5a187aa35de0..10abeb6c1d4d 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_12_of_15 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_12_of_15 @@ -32,32 +32,24 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ └── 27 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 19 Mutation operations │ ├── SetIndexName {"IndexID":1,"Name":"t_pkey","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} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_k_idx","TableID":104} │ ├── MakeDroppedPrimaryIndexDeleteAndWriteOnly {"IndexID":3,"TableID":104} │ ├── SetIndexName {"IndexID":3,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"Kind":1,"TableID":104} │ ├── LogEvent {"TargetStatus":1} │ ├── CreateGcJobForIndex {"IndexID":5,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":5,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":6,"Kind":1,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedPrimaryIndexPublic {"IndexID":1,"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"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 2 of 3 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_13_of_15 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_13_of_15 index 5e1d58d22296..f4f834b277dd 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_13_of_15 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_13_of_15 @@ -32,14 +32,8 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ └── 25 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 17 Mutation operations │ ├── SetIndexName {"IndexID":1,"Name":"t_pkey","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} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_k_idx","TableID":104} @@ -47,15 +41,13 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── SetIndexName {"IndexID":3,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":6,"Kind":1,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedPrimaryIndexPublic {"IndexID":1,"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"Kind":1,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} ├── Stage 2 of 3 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_14_of_15 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_14_of_15 index c92cd656f219..a059869c7d00 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_14_of_15 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_14_of_15 @@ -32,14 +32,8 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ └── 25 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 17 Mutation operations │ ├── SetIndexName {"IndexID":1,"Name":"t_pkey","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} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_k_idx","TableID":104} @@ -47,15 +41,13 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── SetIndexName {"IndexID":3,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":6,"Kind":1,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedPrimaryIndexPublic {"IndexID":1,"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"Kind":1,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} ├── Stage 2 of 3 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_15_of_15 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_15_of_15 index fe0efa3274e7..1c7e9e571e6a 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_15_of_15 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_15_of_15 @@ -32,14 +32,8 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ └── 25 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 17 Mutation operations │ ├── SetIndexName {"IndexID":1,"Name":"t_pkey","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} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_k_idx","TableID":104} @@ -48,14 +42,12 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":5,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":6,"Kind":1,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedPrimaryIndexPublic {"IndexID":1,"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"Kind":1,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} ├── Stage 2 of 3 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_1_of_15 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_1_of_15 index a4fe6f4320ad..4038e58ef625 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_1_of_15 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_1_of_15 @@ -23,20 +23,16 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - └── 18 Mutation operations - ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - ├── RefreshStats {"TableID":104} - ├── MakeColumnPublic {"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} + └── 14 Mutation operations ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} ├── SetIndexName {"IndexID":2,"Name":"t_expr_k_idx","TableID":104} ├── CreateGcJobForIndex {"IndexID":4,"TableID":104} ├── MakeIndexAbsent {"IndexID":4,"TableID":104} + ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + ├── RefreshStats {"TableID":104} + ├── MakeColumnPublic {"ColumnID":4,"TableID":104} + ├── RefreshStats {"TableID":104} ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} ├── CreateGcJobForIndex {"IndexID":3,"TableID":104} ├── MakeIndexAbsent {"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_2_of_15 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_2_of_15 index 597fb7a85fcb..c1df9924429a 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_2_of_15 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_2_of_15 @@ -23,19 +23,15 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ └── 17 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeColumnPublic {"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} + │ └── 13 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_k_idx","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── CreateGcJobForIndex {"IndexID":3,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_3_of_15 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_3_of_15 index f93b66c30db3..90fa2bdcdd3b 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_3_of_15 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_3_of_15 @@ -23,19 +23,15 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ └── 17 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeColumnPublic {"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} + │ └── 13 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_k_idx","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── CreateGcJobForIndex {"IndexID":3,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_4_of_15 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_4_of_15 index 16711094d3e9..37823b8973cd 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_4_of_15 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_4_of_15 @@ -23,21 +23,17 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ └── 17 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeColumnPublic {"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} + │ └── 13 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_k_idx","TableID":104} │ ├── CreateGcJobForIndex {"IndexID":3,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_5_of_15 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_5_of_15 index f9aba90c3bc5..cff6470d1586 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_5_of_15 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_5_of_15 @@ -23,19 +23,15 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ └── 16 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeColumnPublic {"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} + │ └── 12 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_k_idx","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_6_of_15 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_6_of_15 index 28cfa4f93a3e..6d8b0b607f80 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_6_of_15 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_6_of_15 @@ -23,19 +23,15 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ └── 16 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeColumnPublic {"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} + │ └── 12 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_k_idx","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_7_of_15 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_7_of_15 index f28d6e70d861..343c3970c961 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_7_of_15 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_7_of_15 @@ -23,20 +23,16 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ └── 16 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeColumnPublic {"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} + │ └── 12 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_k_idx","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_8_of_15 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_8_of_15 index ed0e00c1f70e..2333970b0678 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_8_of_15 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_8_of_15 @@ -23,20 +23,16 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ └── 16 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeColumnPublic {"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} + │ └── 12 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_k_idx","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_9_of_15 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_9_of_15 index 4dd22c13aa5c..723c3cea9b08 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_9_of_15 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_9_of_15 @@ -32,28 +32,20 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ └── 28 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 20 Mutation operations │ ├── SetIndexName {"IndexID":1,"Name":"t_pkey","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} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_k_idx","TableID":104} │ ├── MakeDroppedPrimaryIndexDeleteAndWriteOnly {"IndexID":3,"TableID":104} │ ├── SetIndexName {"IndexID":3,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":6,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":6,"Kind":1,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedPrimaryIndexPublic {"IndexID":1,"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":5,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"Kind":1,"TableID":104} │ ├── LogEvent {"TargetStatus":1} │ ├── CreateGcJobForIndex {"IndexID":5,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":5,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.statement_1_of_2 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.statement_1_of_2 index f1f358206e85..4ca6238a76a2 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.statement_1_of_2 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.statement_1_of_2 @@ -14,21 +14,18 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ ├── PUBLIC → VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ ├── 5 elements transitioning toward PUBLIC + │ ├── 3 elements transitioning toward PUBLIC │ │ ├── ABSENT → BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} + │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} + │ ├── 3 elements transitioning toward TRANSIENT_ABSENT + │ │ ├── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} - │ ├── 1 element transitioning toward TRANSIENT_ABSENT - │ │ └── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ └── 14 Mutation operations │ ├── MakeDroppedColumnDeleteAndWriteOnly {"ColumnID":2,"TableID":104} │ ├── LogEvent {"TargetStatus":1} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":104} - │ ├── MakeDroppedColumnDeleteAndWriteOnly {"ColumnID":4,"TableID":104} - │ ├── LogEvent {"TargetStatus":1} - │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_co...","TableID":104} │ ├── MakeDroppedNonPrimaryIndexDeleteAndWriteOnly {"IndexID":2,"TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeAddedIndexBackfilling {"Index":{"ConstraintID":2,"IndexID":3,"IsUnique":true,"SourceIndexID":1,"TableID":104,"TemporaryIndexID":4}} @@ -36,7 +33,10 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── AddColumnToIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} │ ├── MakeAddedTempIndexDeleteOnly {"Index":{"ConstraintID":3,"IndexID":4,"IsUnique":true,"SourceIndexID":1,"TableID":104}} │ ├── AddColumnToIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ └── AddColumnToIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} + │ ├── AddColumnToIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} + │ ├── MakeDroppedColumnDeleteAndWriteOnly {"ColumnID":4,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} + │ └── SetColumnName {"ColumnID":4,"Name":"crdb_internal_co...","TableID":104} ├── PreCommitPhase │ └── Stage 1 of 1 in PreCommitPhase │ └── 2 Mutation operations @@ -103,51 +103,47 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── 2 elements transitioning toward PUBLIC │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 3} - │ ├── 1 element transitioning toward TRANSIENT_ABSENT - │ │ └── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ └── 16 Mutation operations + │ ├── 3 elements transitioning toward TRANSIENT_ABSENT + │ │ ├── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} + │ │ ├── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} + │ │ └── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} + │ └── 10 Mutation operations │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":2,"TableID":104} │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":4,"TableID":104} │ ├── MakeDroppedPrimaryIndexDeleteAndWriteOnly {"IndexID":1,"TableID":104} │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":104} │ ├── SetIndexName {"IndexID":3,"Name":"t_pkey","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"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} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":104} │ ├── MakeAddedPrimaryIndexPublic {"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 - │ ├── 1 element transitioning toward ABSENT - │ │ └── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ └── 3 Mutation operations + │ ├── 4 elements transitioning toward ABSENT + │ │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104, ColumnID: 4} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ ├── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ ├── 1 element transitioning toward TRANSIENT_ABSENT + │ │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} + │ └── 9 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":1,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} + │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} + │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} + │ ├── CreateGcJobForIndex {"IndexID":4,"TableID":104} + │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} + │ ├── MakeColumnAbsent {"ColumnID":4,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 3 of 3 in PostCommitNonRevertiblePhase - ├── 6 elements transitioning toward ABSENT - │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104, ColumnID: 2} - │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} - │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104, ColumnID: 4} - │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} - │ ├── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - ├── 1 element transitioning toward TRANSIENT_ABSENT - │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - └── 11 Mutation operations - ├── CreateGcJobForIndex {"IndexID":4,"TableID":104} - ├── MakeIndexAbsent {"IndexID":4,"TableID":104} + ├── 3 elements transitioning toward ABSENT + │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104, ColumnID: 2} + │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ └── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + └── 5 Mutation operations ├── CreateGcJobForIndex {"IndexID":1,"TableID":104} ├── MakeIndexAbsent {"IndexID":1,"TableID":104} - ├── LogEvent {"TargetStatus":1} - ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} - ├── MakeIndexAbsent {"IndexID":2,"TableID":104} ├── MakeColumnAbsent {"ColumnID":2,"TableID":104} - ├── MakeColumnAbsent {"ColumnID":4,"TableID":104} ├── RemoveJobStateFromDescriptor {"DescriptorID":104} └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"all stages compl..."} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.statement_2_of_2 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.statement_2_of_2 index cdfb6a119abb..a317fdec2cdb 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.statement_2_of_2 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.statement_2_of_2 @@ -141,24 +141,20 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── 2 elements transitioning toward PUBLIC │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: idx, IndexID: 5} - │ ├── 2 elements transitioning toward TRANSIENT_ABSENT + │ ├── 4 elements transitioning toward TRANSIENT_ABSENT + │ │ ├── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} + │ │ ├── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} │ │ ├── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ └── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 4, SourceIndexID: 3} - │ └── 16 Mutation operations + │ └── 10 Mutation operations │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":2,"TableID":104} │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":4,"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} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── SetIndexName {"IndexID":5,"Name":"idx","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":6,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":1,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":5,"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 @@ -173,15 +169,15 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 4, SourceIndexID: 3} └── 13 Mutation operations - ├── CreateGcJobForIndex {"IndexID":4,"TableID":104} - ├── MakeIndexAbsent {"IndexID":4,"TableID":104} - ├── CreateGcJobForIndex {"IndexID":6,"TableID":104} - ├── MakeIndexAbsent {"IndexID":6,"TableID":104} ├── CreateGcJobForIndex {"IndexID":1,"TableID":104} ├── MakeIndexAbsent {"IndexID":1,"TableID":104} ├── LogEvent {"TargetStatus":1} ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} ├── MakeIndexAbsent {"IndexID":2,"TableID":104} + ├── CreateGcJobForIndex {"IndexID":4,"TableID":104} + ├── MakeIndexAbsent {"IndexID":4,"TableID":104} + ├── CreateGcJobForIndex {"IndexID":6,"TableID":104} + ├── MakeIndexAbsent {"IndexID":6,"TableID":104} ├── MakeColumnAbsent {"ColumnID":2,"TableID":104} ├── MakeColumnAbsent {"ColumnID":4,"TableID":104} ├── RemoveJobStateFromDescriptor {"DescriptorID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index b/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index index 1b00f6681a83..af2234fa4ee0 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index @@ -13,16 +13,16 @@ Schema change plan for ALTER TABLE ‹t›.‹public›.‹test› DROP COLUMN │ ├── 2 elements transitioning toward ABSENT │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 106, ColumnID: 3} │ │ └── PUBLIC → ABSENT ColumnName:{DescID: 106, Name: pi, ColumnID: 3} - │ ├── 7 elements transitioning toward PUBLIC + │ ├── 4 elements transitioning toward PUBLIC │ │ ├── ABSENT → BACKFILL_ONLY PrimaryIndex:{DescID: 106, IndexID: 4, ConstraintID: 5, TemporaryIndexID: 5, SourceIndexID: 1} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 4} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 4} - │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 4} + │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 4} + │ ├── 4 elements transitioning toward TRANSIENT_ABSENT + │ │ ├── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 5} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 5} - │ ├── 1 element transitioning toward TRANSIENT_ABSENT - │ │ └── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} │ └── 11 Mutation operations │ ├── MakeDroppedColumnDeleteAndWriteOnly {"ColumnID":3,"TableID":106} │ ├── LogEvent {"TargetStatus":1} @@ -97,39 +97,38 @@ Schema change plan for ALTER TABLE ‹t›.‹public›.‹test› DROP COLUMN │ ├── 2 elements transitioning toward PUBLIC │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 106, IndexID: 4, ConstraintID: 5, TemporaryIndexID: 5, SourceIndexID: 1} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 106, Name: test_pkey, IndexID: 4} - │ ├── 1 element transitioning toward TRANSIENT_ABSENT - │ │ └── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} - │ └── 12 Mutation operations + │ ├── 4 elements transitioning toward TRANSIENT_ABSENT + │ │ ├── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} + │ │ ├── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 5} + │ │ ├── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} + │ │ └── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 5} + │ └── 8 Mutation operations │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":3,"TableID":106} │ ├── MakeDroppedPrimaryIndexDeleteAndWriteOnly {"IndexID":1,"TableID":106} │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":106} │ ├── SetIndexName {"IndexID":4,"Name":"test_pkey","TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":5,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":1,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":1,"Kind":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":1,"Kind":2,"Ordinal":1,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":4,"IndexID":1,"Kind":2,"Ordinal":2,"TableID":106} │ ├── MakeAddedPrimaryIndexPublic {"IndexID":4,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} ├── Stage 2 of 3 in PostCommitNonRevertiblePhase │ ├── 1 element transitioning toward ABSENT - │ │ └── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} - │ └── 3 Mutation operations + │ │ └── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} + │ ├── 1 element transitioning toward TRANSIENT_ABSENT + │ │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} + │ └── 5 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":1,"TableID":106} + │ ├── CreateGcJobForIndex {"IndexID":5,"TableID":106} + │ ├── MakeIndexAbsent {"IndexID":5,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 3 of 3 in PostCommitNonRevertiblePhase ├── 4 elements transitioning toward ABSENT - │ ├── DELETE_ONLY → ABSENT Column:{DescID: 106, ColumnID: 3} - │ ├── PUBLIC → ABSENT ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 3} - │ ├── PUBLIC → ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 3} - │ └── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} - ├── 1 element transitioning toward TRANSIENT_ABSENT - │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} - └── 8 Mutation operations - ├── CreateGcJobForIndex {"IndexID":5,"TableID":106} - ├── MakeIndexAbsent {"IndexID":5,"TableID":106} + │ ├── DELETE_ONLY → ABSENT Column:{DescID: 106, ColumnID: 3} + │ ├── PUBLIC → ABSENT ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 3} + │ ├── PUBLIC → ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 3} + │ └── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} + └── 6 Mutation operations ├── CreateGcJobForIndex {"IndexID":1,"TableID":106} ├── MakeIndexAbsent {"IndexID":1,"TableID":106} ├── RemoveColumnDefaultExpression {"ColumnID":3,"TableID":106} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_1_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_1_of_7 index 01c0c6936dd9..5073ab3745c0 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_1_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_1_of_7 @@ -23,16 +23,10 @@ Schema change plan for rolling back ALTER TABLE ‹t›.public.‹test› DROP C ├── 2 elements transitioning toward PUBLIC │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 106, ColumnID: 3} │ └── ABSENT → PUBLIC ColumnName:{DescID: 106, Name: pi, ColumnID: 3} - └── 15 Mutation operations + └── 9 Mutation operations + ├── SetColumnName {"ColumnID":3,"Name":"pi","TableID":106} ├── MakeColumnPublic {"ColumnID":3,"TableID":106} ├── RefreshStats {"TableID":106} - ├── SetColumnName {"ColumnID":3,"Name":"pi","TableID":106} - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":106} - ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":4,"Kind":2,"TableID":106} - ├── RemoveColumnFromIndex {"ColumnID":4,"IndexID":4,"Kind":2,"Ordinal":1,"TableID":106} - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"TableID":106} - ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":5,"Kind":2,"TableID":106} - ├── RemoveColumnFromIndex {"ColumnID":4,"IndexID":5,"Kind":2,"Ordinal":1,"TableID":106} ├── CreateGcJobForIndex {"IndexID":4,"TableID":106} ├── MakeIndexAbsent {"IndexID":4,"TableID":106} ├── CreateGcJobForIndex {"IndexID":5,"TableID":106} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_2_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_2_of_7 index 5c039f44e436..f100c22ccaf9 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_2_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_2_of_7 @@ -23,17 +23,11 @@ Schema change plan for rolling back ALTER TABLE ‹t›.public.‹test› DROP C │ ├── 2 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 106, ColumnID: 3} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 106, Name: pi, ColumnID: 3} - │ └── 14 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":3,"TableID":106} - │ ├── RefreshStats {"TableID":106} + │ └── 8 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"pi","TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":4,"Kind":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":4,"IndexID":4,"Kind":2,"Ordinal":1,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":5,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":5,"Kind":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":4,"IndexID":5,"Kind":2,"Ordinal":1,"TableID":106} + │ ├── MakeColumnPublic {"ColumnID":3,"TableID":106} + │ ├── RefreshStats {"TableID":106} │ ├── CreateGcJobForIndex {"IndexID":4,"TableID":106} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_3_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_3_of_7 index a53ab0db032e..c487400caa27 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_3_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_3_of_7 @@ -23,17 +23,11 @@ Schema change plan for rolling back ALTER TABLE ‹t›.public.‹test› DROP C │ ├── 2 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 106, ColumnID: 3} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 106, Name: pi, ColumnID: 3} - │ └── 14 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":3,"TableID":106} - │ ├── RefreshStats {"TableID":106} + │ └── 8 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"pi","TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":4,"Kind":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":4,"IndexID":4,"Kind":2,"Ordinal":1,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":5,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":5,"Kind":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":4,"IndexID":5,"Kind":2,"Ordinal":1,"TableID":106} + │ ├── MakeColumnPublic {"ColumnID":3,"TableID":106} + │ ├── RefreshStats {"TableID":106} │ ├── CreateGcJobForIndex {"IndexID":4,"TableID":106} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_4_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_4_of_7 index 9143ea853cfa..75174dec9c2f 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_4_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_4_of_7 @@ -23,17 +23,11 @@ Schema change plan for rolling back ALTER TABLE ‹t›.public.‹test› DROP C │ ├── 2 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 106, ColumnID: 3} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 106, Name: pi, ColumnID: 3} - │ └── 14 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":3,"TableID":106} - │ ├── RefreshStats {"TableID":106} + │ └── 8 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"pi","TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":4,"Kind":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":4,"IndexID":4,"Kind":2,"Ordinal":1,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":5,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":5,"Kind":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":4,"IndexID":5,"Kind":2,"Ordinal":1,"TableID":106} + │ ├── MakeColumnPublic {"ColumnID":3,"TableID":106} + │ ├── RefreshStats {"TableID":106} │ ├── CreateGcJobForIndex {"IndexID":4,"TableID":106} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_5_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_5_of_7 index f92a4de8288f..63581e07274e 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_5_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_5_of_7 @@ -23,17 +23,11 @@ Schema change plan for rolling back ALTER TABLE ‹t›.public.‹test› DROP C │ ├── 2 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 106, ColumnID: 3} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 106, Name: pi, ColumnID: 3} - │ └── 13 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":3,"TableID":106} - │ ├── RefreshStats {"TableID":106} + │ └── 7 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"pi","TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":4,"Kind":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":4,"IndexID":4,"Kind":2,"Ordinal":1,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":5,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":5,"Kind":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":4,"IndexID":5,"Kind":2,"Ordinal":1,"TableID":106} + │ ├── MakeColumnPublic {"ColumnID":3,"TableID":106} + │ ├── RefreshStats {"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_6_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_6_of_7 index 164709d00a89..3aaed05a4262 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_6_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_6_of_7 @@ -23,17 +23,11 @@ Schema change plan for rolling back ALTER TABLE ‹t›.public.‹test› DROP C │ ├── 2 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 106, ColumnID: 3} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 106, Name: pi, ColumnID: 3} - │ └── 13 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":3,"TableID":106} - │ ├── RefreshStats {"TableID":106} + │ └── 7 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"pi","TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":4,"Kind":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":4,"IndexID":4,"Kind":2,"Ordinal":1,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":5,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":5,"Kind":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":4,"IndexID":5,"Kind":2,"Ordinal":1,"TableID":106} + │ ├── MakeColumnPublic {"ColumnID":3,"TableID":106} + │ ├── RefreshStats {"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_7_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_7_of_7 index 9ecfd9b4477a..b7b4d3a04cb7 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_7_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_unique_index.rollback_7_of_7 @@ -23,18 +23,12 @@ Schema change plan for rolling back ALTER TABLE ‹t›.public.‹test› DROP C │ ├── 2 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 106, ColumnID: 3} │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 106, Name: pi, ColumnID: 3} - │ └── 13 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":3,"TableID":106} - │ ├── RefreshStats {"TableID":106} + │ └── 7 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"pi","TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":4,"Kind":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":4,"IndexID":4,"Kind":2,"Ordinal":1,"TableID":106} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":5,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":5,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":5,"Kind":2,"TableID":106} - │ ├── RemoveColumnFromIndex {"ColumnID":4,"IndexID":5,"Kind":2,"Ordinal":1,"TableID":106} + │ ├── MakeColumnPublic {"ColumnID":3,"TableID":106} + │ ├── RefreshStats {"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_with_index b/pkg/sql/schemachanger/testdata/explain/drop_column_with_index index dc2c5b8a453f..2d2feca31f96 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_with_index +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_with_index @@ -12,22 +12,22 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── PUBLIC → VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} - │ ├── 3 elements transitioning toward PUBLIC + │ ├── 2 elements transitioning toward PUBLIC │ │ ├── ABSENT → BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} + │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} + │ ├── 2 elements transitioning toward TRANSIENT_ABSENT + │ │ ├── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ ├── 1 element transitioning toward TRANSIENT_ABSENT - │ │ └── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ └── 9 Mutation operations - │ ├── MakeDroppedColumnDeleteAndWriteOnly {"ColumnID":2,"TableID":104} - │ ├── LogEvent {"TargetStatus":1} - │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":104} │ ├── MakeDroppedNonPrimaryIndexDeleteAndWriteOnly {"IndexID":2,"TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeAddedIndexBackfilling {"Index":{"ConstraintID":2,"IndexID":3,"IsUnique":true,"SourceIndexID":1,"TableID":104,"TemporaryIndexID":4}} │ ├── AddColumnToIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── MakeAddedTempIndexDeleteOnly {"Index":{"ConstraintID":3,"IndexID":4,"IsUnique":true,"SourceIndexID":1,"TableID":104}} - │ └── AddColumnToIndex {"ColumnID":1,"IndexID":4,"TableID":104} + │ ├── AddColumnToIndex {"ColumnID":1,"IndexID":4,"TableID":104} + │ ├── MakeDroppedColumnDeleteAndWriteOnly {"ColumnID":2,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} + │ └── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":104} ├── PreCommitPhase │ └── Stage 1 of 1 in PreCommitPhase │ └── 2 Mutation operations @@ -91,45 +91,42 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── 2 elements transitioning toward PUBLIC │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 3} - │ ├── 1 element transitioning toward TRANSIENT_ABSENT - │ │ └── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ └── 13 Mutation operations + │ ├── 2 elements transitioning toward TRANSIENT_ABSENT + │ │ ├── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} + │ │ └── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} + │ └── 9 Mutation operations │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":2,"TableID":104} │ ├── MakeDroppedPrimaryIndexDeleteAndWriteOnly {"IndexID":1,"TableID":104} │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":104} │ ├── SetIndexName {"IndexID":3,"Name":"t_pkey","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":1,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":1,"Kind":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":104} │ ├── MakeAddedPrimaryIndexPublic {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"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 - │ ├── 1 element transitioning toward ABSENT - │ │ └── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ └── 3 Mutation operations + │ ├── 2 elements transitioning toward ABSENT + │ │ ├── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ ├── 1 element transitioning toward TRANSIENT_ABSENT + │ │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} + │ └── 8 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":1,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} + │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} + │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} + │ ├── CreateGcJobForIndex {"IndexID":4,"TableID":104} + │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 3 of 3 in PostCommitNonRevertiblePhase - ├── 4 elements transitioning toward ABSENT - │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104, ColumnID: 2} - │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} - │ ├── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - ├── 1 element transitioning toward TRANSIENT_ABSENT - │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - └── 10 Mutation operations - ├── CreateGcJobForIndex {"IndexID":4,"TableID":104} - ├── MakeIndexAbsent {"IndexID":4,"TableID":104} + ├── 3 elements transitioning toward ABSENT + │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104, ColumnID: 2} + │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ └── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + └── 5 Mutation operations ├── CreateGcJobForIndex {"IndexID":1,"TableID":104} ├── MakeIndexAbsent {"IndexID":1,"TableID":104} - ├── LogEvent {"TargetStatus":1} - ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} - ├── MakeIndexAbsent {"IndexID":2,"TableID":104} ├── MakeColumnAbsent {"ColumnID":2,"TableID":104} ├── RemoveJobStateFromDescriptor {"DescriptorID":104} └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"all stages compl..."} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_1_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_1_of_7 index f87a200c0952..3aa981462041 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_1_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_1_of_7 @@ -18,13 +18,11 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} - └── 13 Mutation operations - ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - ├── RefreshStats {"TableID":104} + └── 11 Mutation operations ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} ├── SetIndexName {"IndexID":2,"Name":"t_j_idx","TableID":104} - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} + ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + ├── RefreshStats {"TableID":104} ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} ├── CreateGcJobForIndex {"IndexID":3,"TableID":104} ├── MakeIndexAbsent {"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_2_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_2_of_7 index a1516ba9bd2c..7e58176c74de 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_2_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_2_of_7 @@ -18,14 +18,12 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} - │ └── 12 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 10 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_j_idx","TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── CreateGcJobForIndex {"IndexID":3,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_3_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_3_of_7 index fbfa7cab71e7..c913887eba9a 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_3_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_3_of_7 @@ -18,14 +18,12 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} - │ └── 12 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 10 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_j_idx","TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── CreateGcJobForIndex {"IndexID":3,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_4_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_4_of_7 index df6613b08fca..5fb9f426ba75 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_4_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_4_of_7 @@ -18,14 +18,12 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} - │ └── 12 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 10 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_j_idx","TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── CreateGcJobForIndex {"IndexID":3,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_5_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_5_of_7 index ae20e0a88a5b..9a34edeb342a 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_5_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_5_of_7 @@ -18,14 +18,12 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} - │ └── 11 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 9 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_j_idx","TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_6_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_6_of_7 index 3b5a3faaefba..f9fef0bf8338 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_6_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_6_of_7 @@ -18,14 +18,12 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} - │ └── 11 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 9 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_j_idx","TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_7_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_7_of_7 index 2eca2a356898..1817b9bdffe3 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_7_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_with_index.rollback_7_of_7 @@ -18,15 +18,13 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} - │ └── 11 Mutation operations - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} + │ └── 9 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_j_idx","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_index_hash_sharded_index b/pkg/sql/schemachanger/testdata/explain/drop_index_hash_sharded_index index 102225f23ae5..55e12c246fd8 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_index_hash_sharded_index +++ b/pkg/sql/schemachanger/testdata/explain/drop_index_hash_sharded_index @@ -14,11 +14,11 @@ Schema change plan for DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› │ │ ├── PUBLIC → VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104, Name: idx, IndexID: 2} │ └── 5 Mutation operations + │ ├── MakeDroppedNonPrimaryIndexDeleteAndWriteOnly {"IndexID":2,"TableID":104} + │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeDroppedColumnDeleteAndWriteOnly {"ColumnID":3,"TableID":104} │ ├── LogEvent {"TargetStatus":1} - │ ├── SetColumnName {"ColumnID":3,"Name":"crdb_internal_co...","TableID":104} - │ ├── MakeDroppedNonPrimaryIndexDeleteAndWriteOnly {"IndexID":2,"TableID":104} - │ └── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} + │ └── SetColumnName {"ColumnID":3,"Name":"crdb_internal_co...","TableID":104} ├── PreCommitPhase │ └── Stage 1 of 1 in PreCommitPhase │ └── 2 Mutation operations @@ -34,14 +34,11 @@ Schema change plan for DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› │ │ ├── VALIDATED → DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ ├── PUBLIC → ABSENT CheckConstraint:{DescID: 104, ConstraintID: 2} │ │ └── PUBLIC → ABSENT ConstraintName:{DescID: 104, Name: check_crdb_internal_j_shard_16, ConstraintID: 2} - │ └── 9 Mutation operations + │ └── 6 Mutation operations │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":3,"TableID":104} │ ├── RemoveCheckConstraint {"ConstraintID":2,"TableID":104} │ ├── NotImplemented {"ElementType":"scpb.ConstraintN..."} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"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 diff --git a/pkg/sql/schemachanger/testdata/explain/drop_index_partial_expression_index b/pkg/sql/schemachanger/testdata/explain/drop_index_partial_expression_index index 2027f7193169..24d270085a1c 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_index_partial_expression_index +++ b/pkg/sql/schemachanger/testdata/explain/drop_index_partial_expression_index @@ -14,11 +14,11 @@ Schema change plan for DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› │ │ ├── PUBLIC → VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104, Name: idx, IndexID: 2} │ └── 5 Mutation operations + │ ├── MakeDroppedNonPrimaryIndexDeleteAndWriteOnly {"IndexID":2,"TableID":104} + │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeDroppedColumnDeleteAndWriteOnly {"ColumnID":3,"TableID":104} │ ├── LogEvent {"TargetStatus":1} - │ ├── SetColumnName {"ColumnID":3,"Name":"crdb_internal_co...","TableID":104} - │ ├── MakeDroppedNonPrimaryIndexDeleteAndWriteOnly {"IndexID":2,"TableID":104} - │ └── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} + │ └── SetColumnName {"ColumnID":3,"Name":"crdb_internal_co...","TableID":104} ├── PreCommitPhase │ └── Stage 1 of 1 in PreCommitPhase │ └── 2 Mutation operations @@ -31,11 +31,9 @@ Schema change plan for DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} │ │ └── VALIDATED → DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ └── 6 Mutation operations + │ └── 4 Mutation operations │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":3,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"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 2 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/explain/drop_index_vanilla_index b/pkg/sql/schemachanger/testdata/explain/drop_index_vanilla_index index 666df2c74309..b7da08ae6ea6 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_index_vanilla_index +++ b/pkg/sql/schemachanger/testdata/explain/drop_index_vanilla_index @@ -25,10 +25,8 @@ Schema change plan for DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} │ │ └── VALIDATED → DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ └── 5 Mutation operations + │ └── 3 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":2,"IndexID":2,"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 diff --git a/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_1_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_1_of_7 index 82f469d08bcf..fdcdae2e5819 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_1_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_1_of_7 @@ -23,23 +23,21 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - └── 19 Mutation operations + └── 17 Mutation operations ├── SetColumnName {"ColumnID":3,"Name":"k","TableID":104} - ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - ├── RefreshStats {"TableID":104} - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} ├── SetIndexName {"IndexID":2,"Name":"t_expr_k_idx","TableID":104} ├── CreateGcJobForIndex {"IndexID":4,"TableID":104} ├── MakeIndexAbsent {"IndexID":4,"TableID":104} - ├── MakeColumnPublic {"ColumnID":3,"TableID":104} - ├── RefreshStats {"TableID":104} - ├── MakeColumnPublic {"ColumnID":4,"TableID":104} + ├── MakeColumnPublic {"ColumnID":2,"TableID":104} ├── RefreshStats {"TableID":104} ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} ├── CreateGcJobForIndex {"IndexID":3,"TableID":104} ├── MakeIndexAbsent {"IndexID":3,"TableID":104} + ├── MakeColumnPublic {"ColumnID":3,"TableID":104} + ├── RefreshStats {"TableID":104} + ├── MakeColumnPublic {"ColumnID":4,"TableID":104} + ├── RefreshStats {"TableID":104} ├── RemoveJobStateFromDescriptor {"DescriptorID":104} └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"all stages compl..."} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_2_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_2_of_7 index 5f82fff0a54d..b8d5dad53ea5 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_2_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_2_of_7 @@ -23,23 +23,21 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ └── 18 Mutation operations + │ └── 16 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"k","TableID":104} - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_k_idx","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── MakeColumnPublic {"ColumnID":3,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── CreateGcJobForIndex {"IndexID":3,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":3,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_3_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_3_of_7 index 79c4f86b0d30..84d3aacf150f 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_3_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_3_of_7 @@ -23,23 +23,21 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ └── 18 Mutation operations + │ └── 16 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"k","TableID":104} - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_k_idx","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── MakeColumnPublic {"ColumnID":3,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── CreateGcJobForIndex {"IndexID":3,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":3,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_4_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_4_of_7 index c1d5e2480333..be6d464361e7 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_4_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_4_of_7 @@ -23,23 +23,21 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ └── 18 Mutation operations + │ └── 16 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"k","TableID":104} - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_k_idx","TableID":104} │ ├── CreateGcJobForIndex {"IndexID":3,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_5_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_5_of_7 index 3fe2bc327f3d..ca606b5d9cab 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_5_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_5_of_7 @@ -23,22 +23,20 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ └── 17 Mutation operations + │ └── 15 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"k","TableID":104} - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_k_idx","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} + │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── MakeColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} - │ ├── MakeDroppedIndexDeleteOnly {"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/explain/drop_multiple_columns_separate_statements.rollback_6_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_6_of_7 index 82dbc493606d..f5d3db3f31ba 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_6_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_6_of_7 @@ -23,22 +23,20 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ └── 17 Mutation operations + │ └── 15 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"k","TableID":104} - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_k_idx","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} + │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── MakeColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} - │ ├── MakeDroppedIndexDeleteOnly {"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/explain/drop_multiple_columns_separate_statements.rollback_7_of_7 b/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_7_of_7 index 5570af742360..bd510aa98094 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_7_of_7 +++ b/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.rollback_7_of_7 @@ -23,22 +23,20 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ └── 17 Mutation operations + │ └── 15 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"k","TableID":104} - │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":3,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":1,"IndexID":4,"TableID":104} │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_id...","TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"t_expr_k_idx","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── MakeColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── MakeAddedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase diff --git a/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.statement_1_of_2 b/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.statement_1_of_2 index f1f358206e85..4ca6238a76a2 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.statement_1_of_2 +++ b/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.statement_1_of_2 @@ -14,21 +14,18 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ ├── PUBLIC → VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ ├── 5 elements transitioning toward PUBLIC + │ ├── 3 elements transitioning toward PUBLIC │ │ ├── ABSENT → BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} + │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} + │ ├── 3 elements transitioning toward TRANSIENT_ABSENT + │ │ ├── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ ├── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} │ │ └── ABSENT → PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} - │ ├── 1 element transitioning toward TRANSIENT_ABSENT - │ │ └── ABSENT → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ └── 14 Mutation operations │ ├── MakeDroppedColumnDeleteAndWriteOnly {"ColumnID":2,"TableID":104} │ ├── LogEvent {"TargetStatus":1} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":104} - │ ├── MakeDroppedColumnDeleteAndWriteOnly {"ColumnID":4,"TableID":104} - │ ├── LogEvent {"TargetStatus":1} - │ ├── SetColumnName {"ColumnID":4,"Name":"crdb_internal_co...","TableID":104} │ ├── MakeDroppedNonPrimaryIndexDeleteAndWriteOnly {"IndexID":2,"TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeAddedIndexBackfilling {"Index":{"ConstraintID":2,"IndexID":3,"IsUnique":true,"SourceIndexID":1,"TableID":104,"TemporaryIndexID":4}} @@ -36,7 +33,10 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── AddColumnToIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} │ ├── MakeAddedTempIndexDeleteOnly {"Index":{"ConstraintID":3,"IndexID":4,"IsUnique":true,"SourceIndexID":1,"TableID":104}} │ ├── AddColumnToIndex {"ColumnID":1,"IndexID":4,"TableID":104} - │ └── AddColumnToIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} + │ ├── AddColumnToIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} + │ ├── MakeDroppedColumnDeleteAndWriteOnly {"ColumnID":4,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} + │ └── SetColumnName {"ColumnID":4,"Name":"crdb_internal_co...","TableID":104} ├── PreCommitPhase │ └── Stage 1 of 1 in PreCommitPhase │ └── 2 Mutation operations @@ -103,51 +103,47 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── 2 elements transitioning toward PUBLIC │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 3} - │ ├── 1 element transitioning toward TRANSIENT_ABSENT - │ │ └── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ └── 16 Mutation operations + │ ├── 3 elements transitioning toward TRANSIENT_ABSENT + │ │ ├── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} + │ │ ├── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} + │ │ └── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} + │ └── 10 Mutation operations │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":2,"TableID":104} │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":4,"TableID":104} │ ├── MakeDroppedPrimaryIndexDeleteAndWriteOnly {"IndexID":1,"TableID":104} │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":104} │ ├── SetIndexName {"IndexID":3,"Name":"t_pkey","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"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} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":104} │ ├── MakeAddedPrimaryIndexPublic {"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 - │ ├── 1 element transitioning toward ABSENT - │ │ └── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ └── 3 Mutation operations + │ ├── 4 elements transitioning toward ABSENT + │ │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104, ColumnID: 4} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ ├── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ ├── 1 element transitioning toward TRANSIENT_ABSENT + │ │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} + │ └── 9 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":1,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} + │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} + │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} + │ ├── CreateGcJobForIndex {"IndexID":4,"TableID":104} + │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} + │ ├── MakeColumnAbsent {"ColumnID":4,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 3 of 3 in PostCommitNonRevertiblePhase - ├── 6 elements transitioning toward ABSENT - │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104, ColumnID: 2} - │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} - │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104, ColumnID: 4} - │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} - │ ├── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - ├── 1 element transitioning toward TRANSIENT_ABSENT - │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - └── 11 Mutation operations - ├── CreateGcJobForIndex {"IndexID":4,"TableID":104} - ├── MakeIndexAbsent {"IndexID":4,"TableID":104} + ├── 3 elements transitioning toward ABSENT + │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104, ColumnID: 2} + │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ └── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + └── 5 Mutation operations ├── CreateGcJobForIndex {"IndexID":1,"TableID":104} ├── MakeIndexAbsent {"IndexID":1,"TableID":104} - ├── LogEvent {"TargetStatus":1} - ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} - ├── MakeIndexAbsent {"IndexID":2,"TableID":104} ├── MakeColumnAbsent {"ColumnID":2,"TableID":104} - ├── MakeColumnAbsent {"ColumnID":4,"TableID":104} ├── RemoveJobStateFromDescriptor {"DescriptorID":104} └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"all stages compl..."} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.statement_2_of_2 b/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.statement_2_of_2 index b3095250ad03..ac66bdc75b1b 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.statement_2_of_2 +++ b/pkg/sql/schemachanger/testdata/explain/drop_multiple_columns_separate_statements.statement_2_of_2 @@ -84,61 +84,55 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── 2 elements transitioning toward PUBLIC │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ └── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 3} - │ ├── 1 element transitioning toward TRANSIENT_ABSENT + │ ├── 2 elements transitioning toward TRANSIENT_ABSENT + │ │ ├── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} │ │ └── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ └── 19 Mutation operations + │ └── 12 Mutation operations │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":3,"TableID":104} │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":2,"TableID":104} │ ├── MakeDroppedColumnDeleteOnly {"ColumnID":4,"TableID":104} │ ├── MakeDroppedPrimaryIndexDeleteAndWriteOnly {"IndexID":1,"TableID":104} │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":104} │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} - │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":4,"Kind":2,"TableID":104} │ ├── SetIndexName {"IndexID":3,"Name":"t_pkey","TableID":104} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":4,"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} │ ├── MakeDroppedIndexDeleteOnly {"IndexID":2,"TableID":104} │ ├── MakeAddedPrimaryIndexPublic {"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 - │ ├── 1 element transitioning toward ABSENT - │ │ └── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ └── 3 Mutation operations + │ ├── 4 elements transitioning toward ABSENT + │ │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104, ColumnID: 4} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ ├── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ ├── 1 element transitioning toward TRANSIENT_ABSENT + │ │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} + │ └── 9 Mutation operations │ ├── MakeDroppedIndexDeleteOnly {"IndexID":1,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} + │ ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} + │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} + │ ├── CreateGcJobForIndex {"IndexID":4,"TableID":104} + │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} + │ ├── MakeColumnAbsent {"ColumnID":4,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 3 of 3 in PostCommitNonRevertiblePhase - ├── 10 elements transitioning toward ABSENT - │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104, ColumnID: 3} - │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} - │ ├── PUBLIC → ABSENT ColumnDefaultExpression:{DescID: 104, ColumnID: 3} - │ ├── PUBLIC → ABSENT ColumnOnUpdateExpression:{DescID: 104, ColumnID: 3} - │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104, ColumnID: 2} - │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} - │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104, ColumnID: 4} - │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} - │ ├── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - ├── 1 element transitioning toward TRANSIENT_ABSENT - │ └── TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - └── 14 Mutation operations - ├── CreateGcJobForIndex {"IndexID":4,"TableID":104} - ├── MakeIndexAbsent {"IndexID":4,"TableID":104} + ├── 7 elements transitioning toward ABSENT + │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104, ColumnID: 3} + │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} + │ ├── PUBLIC → ABSENT ColumnDefaultExpression:{DescID: 104, ColumnID: 3} + │ ├── PUBLIC → ABSENT ColumnOnUpdateExpression:{DescID: 104, ColumnID: 3} + │ ├── DELETE_ONLY → ABSENT Column:{DescID: 104, ColumnID: 2} + │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ └── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + └── 8 Mutation operations ├── CreateGcJobForIndex {"IndexID":1,"TableID":104} ├── MakeIndexAbsent {"IndexID":1,"TableID":104} - ├── LogEvent {"TargetStatus":1} - ├── CreateGcJobForIndex {"IndexID":2,"TableID":104} - ├── MakeIndexAbsent {"IndexID":2,"TableID":104} ├── RemoveColumnDefaultExpression {"ColumnID":3,"TableID":104} ├── RemoveColumnOnUpdateExpression {"ColumnID":3,"TableID":104} ├── MakeColumnAbsent {"ColumnID":2,"TableID":104} - ├── MakeColumnAbsent {"ColumnID":4,"TableID":104} ├── MakeColumnAbsent {"ColumnID":3,"TableID":104} ├── RemoveJobStateFromDescriptor {"DescriptorID":104} └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"all stages compl..."} diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column b/pkg/sql/schemachanger/testdata/explain_verbose/add_column index e6b821c3b41c..5223609af54d 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN j INT NOT NULL DEFAU │ │ │ └── • Stage 1 of 1 in StatementPhase │ │ -│ ├── • 9 elements transitioning toward PUBLIC +│ ├── • 7 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 106, ColumnID: 2} │ │ │ ABSENT → DELETE_ONLY @@ -21,14 +21,15 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN j INT NOT NULL DEFAU │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from DELETE_ONLY Column:{DescID: 106, ColumnID: 2} -│ │ │ rule: "column name set right after column existence" │ │ │ rule: "column existence precedes column dependents" +│ │ │ rule: "column name and type set right after column existence" │ │ │ │ │ ├── • ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} │ │ │ │ ABSENT → PUBLIC │ │ │ │ -│ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 106, Name: j, ColumnID: 2} -│ │ │ rule: "column named before column type becomes public" +│ │ │ └── • SameStagePrecedence dependency from DELETE_ONLY Column:{DescID: 106, ColumnID: 2} +│ │ │ rule: "column existence precedes column dependents" +│ │ │ rule: "column name and type set right after column existence" │ │ │ │ │ ├── • ColumnDefaultExpression:{DescID: 106, ColumnID: 2} │ │ │ │ ABSENT → PUBLIC @@ -46,29 +47,30 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN j INT NOT NULL DEFAU │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" +│ │ │ rule: "index existence precedes index dependents" │ │ │ -│ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} -│ │ │ │ ABSENT → PUBLIC -│ │ │ │ -│ │ │ ├── • Precedence dependency from DELETE_ONLY Column:{DescID: 106, ColumnID: 2} -│ │ │ │ rule: "column existence precedes column dependents" -│ │ │ │ -│ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 106, Name: j, ColumnID: 2} -│ │ │ │ rule: "column name and type to public after all index column to public" -│ │ │ │ -│ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} -│ │ │ │ rule: "column name and type to public after all index column to public" +│ │ └── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} +│ │ │ ABSENT → PUBLIC +│ │ │ +│ │ ├── • Precedence dependency from DELETE_ONLY Column:{DescID: 106, ColumnID: 2} +│ │ │ rule: "column existence precedes column dependents" +│ │ │ +│ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} +│ │ rule: "index existence precedes index dependents" +│ │ +│ ├── • 3 elements transitioning toward TRANSIENT_ABSENT +│ │ │ +│ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} +│ │ │ │ ABSENT → DELETE_ONLY │ │ │ │ -│ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" +│ │ │ └── • Precedence dependency from DELETE_ONLY Column:{DescID: 106, ColumnID: 2} +│ │ │ rule: "column existence precedes temp index existence" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} -│ │ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ │ rule: "index-column added to index after temp index exists" +│ │ │ rule: "temp index existence precedes index dependents" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} │ │ │ ABSENT → PUBLIC @@ -76,23 +78,8 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN j INT NOT NULL DEFAU │ │ ├── • Precedence dependency from DELETE_ONLY Column:{DescID: 106, ColumnID: 2} │ │ │ rule: "column existence precedes column dependents" │ │ │ -│ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 106, Name: j, ColumnID: 2} -│ │ │ rule: "column name and type to public after all index column to public" -│ │ │ -│ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} -│ │ │ rule: "column name and type to public after all index column to public" -│ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} -│ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ rule: "index-column added to index after temp index exists" -│ │ -│ ├── • 1 element transitioning toward TRANSIENT_ABSENT -│ │ │ -│ │ └── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} -│ │ │ ABSENT → DELETE_ONLY -│ │ │ -│ │ └── • Precedence dependency from DELETE_ONLY Column:{DescID: 106, ColumnID: 2} -│ │ rule: "column existence precedes temporary index existence" +│ │ rule: "temp index existence precedes index dependents" │ │ │ └── • 11 Mutation operations │ │ @@ -365,8 +352,11 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN j INT NOT NULL DEFAU │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} │ │ │ PUBLIC → WRITE_ONLY @@ -375,15 +365,30 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN j INT NOT NULL DEFAU │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} - │ │ rule: "index no longer public before dependents removed" + │ │ rule: "index no longer public before dependents" │ │ │ ├── • 3 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 106, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • Precedence dependency from PUBLIC PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "adding column depends on primary index" + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 106, Name: j, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnDefaultExpression:{DescID: 106, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ │ rule: "swapped primary index public before column" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ │ VALIDATED → PUBLIC @@ -391,21 +396,40 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN j INT NOT NULL DEFAU │ │ │ ├── • SameStagePrecedence dependency from VALIDATED PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} │ │ │ │ rule: "primary index swap" │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 106, Name: tbl_pkey, IndexID: 2} - │ │ │ rule: "index named right before index becomes public" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 106, Name: tbl_pkey, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ rule: "index named right before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 106, Name: tbl_pkey, IndexID: 2} │ │ │ ABSENT → PUBLIC │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "index existence precedes index name and comment" + │ │ rule: "index existence precedes index dependents" │ │ - │ ├── • 1 element transitioning toward TRANSIENT_ABSENT + │ ├── • 3 elements transitioning toward TRANSIENT_ABSENT │ │ │ - │ │ └── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} - │ │ WRITE_ONLY → TRANSIENT_DELETE_ONLY + │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} + │ │ │ WRITE_ONLY → TRANSIENT_DELETE_ONLY + │ │ │ + │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} + │ │ │ │ PUBLIC → TRANSIENT_ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" + │ │ │ + │ │ └── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} + │ │ │ PUBLIC → TRANSIENT_ABSENT + │ │ │ + │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 10 Mutation operations + │ └── • 9 Mutation operations │ │ │ ├── • MakeDroppedPrimaryIndexDeleteAndWriteOnly │ │ IndexID: 1 @@ -425,11 +449,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN j INT NOT NULL DEFAU │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 1 - │ │ TableID: 106 - │ │ │ ├── • MakeAddedPrimaryIndexPublic │ │ EventBase: │ │ Authorization: @@ -465,7 +484,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN j INT NOT NULL DEFAU │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 1 MutationType op pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 3 MutationType ops pending │ ├── • Stage 2 of 3 in PostCommitNonRevertiblePhase │ │ @@ -474,19 +493,38 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN j INT NOT NULL DEFAU │ │ └── • PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} │ │ WRITE_ONLY → DELETE_ONLY │ │ - │ └── • 3 Mutation operations + │ ├── • 1 element transitioning toward TRANSIENT_ABSENT + │ │ │ + │ │ └── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} + │ │ │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT + │ │ │ + │ │ ├── • Precedence dependency from TRANSIENT_ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} + │ │ │ rule: "dependents removed before index" + │ │ │ + │ │ └── • Precedence dependency from TRANSIENT_ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} + │ │ rule: "dependents removed before index" + │ │ + │ └── • 5 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 1 │ │ TableID: 106 │ │ + │ ├── • CreateGcJobForIndex + │ │ IndexID: 3 + │ │ TableID: 106 + │ │ + │ ├── • MakeIndexAbsent + │ │ IndexID: 3 + │ │ TableID: 106 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 106 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 3 of 3 with 4 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 3 of 3 with 2 MutationType ops pending │ └── • Stage 3 of 3 in PostCommitNonRevertiblePhase │ @@ -498,26 +536,10 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN j INT NOT NULL DEFAU │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 1} │ │ rule: "dependents removed before index" │ │ - │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 106, Name: tbl_pkey, IndexID: 1} - │ │ rule: "dependents removed before index" - │ │ - │ └── • SameStagePrecedence dependency from TRANSIENT_ABSENT TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} - │ rule: "temp indexes reach absent at the same time as other indexes" - │ - ├── • 1 element transitioning toward TRANSIENT_ABSENT - │ │ - │ └── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} - │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT + │ └── • Precedence dependency from ABSENT IndexName:{DescID: 106, Name: tbl_pkey, IndexID: 1} + │ rule: "dependents removed before index" │ - └── • 6 Mutation operations - │ - ├── • CreateGcJobForIndex - │ IndexID: 3 - │ TableID: 106 - │ - ├── • MakeIndexAbsent - │ IndexID: 3 - │ TableID: 106 + └── • 4 Mutation operations │ ├── • CreateGcJobForIndex │ IndexID: 1 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_1_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_1_of_7 index 4858f2fa5b9d..ee3b877fbdf9 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_1_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_1_of_7 @@ -25,8 +25,17 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ - │ │ └── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "indexes containing columns reach absent before column" + │ │ ├── • Precedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "indexes containing column reach absent before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} + │ │ rule: "dependents removed before column" │ │ │ ├── • ColumnName:{DescID: 106, Name: j, ColumnID: 2} │ │ PUBLIC → ABSENT @@ -53,10 +62,16 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ │ rule: "dependents removed before index" │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ DELETE_ONLY → ABSENT @@ -68,40 +83,24 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ │ rule: "dependents removed before index" │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ PUBLIC → ABSENT + │ │ PUBLIC → ABSENT + │ │ + │ └── • skip PUBLIC → ABSENT operations + │ rule: "skip index-column removal ops on index removal" │ - └── • 13 Mutation operations + └── • 9 Mutation operations │ ├── • SetColumnName │ ColumnID: 2 │ Name: crdb_internal_column_2_name_placeholder │ TableID: 106 │ - ├── • RemoveColumnFromIndex - │ ColumnID: 1 - │ IndexID: 2 - │ TableID: 106 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 2 - │ IndexID: 2 - │ Kind: 2 - │ TableID: 106 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 1 - │ IndexID: 3 - │ TableID: 106 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 2 - │ IndexID: 3 - │ Kind: 2 - │ TableID: 106 - │ ├── • CreateGcJobForIndex │ IndexID: 2 │ StatementForDropJob: diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_2_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_2_of_7 index bc3c7096fe87..35f9308c6b43 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_2_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_2_of_7 @@ -22,7 +22,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ │ BACKFILL_ONLY → ABSENT @@ -37,21 +37,39 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ rule: "column no longer public before dependents" + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 11 Mutation operations + │ └── • 7 Mutation operations │ │ │ ├── • MakeDroppedColumnDeleteOnly │ │ ColumnID: 2 @@ -62,32 +80,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ Name: crdb_internal_column_2_name_placeholder │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • CreateGcJobForIndex │ │ IndexID: 2 │ │ StatementForDropJob: @@ -129,20 +125,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ - │ │ └── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "indexes containing columns reach absent before column" + │ │ ├── • Precedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "indexes containing column reach absent before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} + │ │ rule: "dependents removed before column" │ │ │ ├── • ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} │ │ │ PUBLIC → ABSENT │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ └── • SameStagePrecedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} │ │ rule: "column type dependents removed right before column type" │ │ │ ├── • ColumnDefaultExpression:{DescID: 106, ColumnID: 2} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ rule: "column no longer public before dependents" │ │ │ └── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ DELETE_ONLY → ABSENT diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_3_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_3_of_7 index 277c5944ec23..bec277862d5d 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_3_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_3_of_7 @@ -22,7 +22,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ │ BACKFILL_ONLY → ABSENT @@ -37,21 +37,39 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ rule: "column no longer public before dependents" + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 11 Mutation operations + │ └── • 7 Mutation operations │ │ │ ├── • MakeDroppedColumnDeleteOnly │ │ ColumnID: 2 @@ -62,32 +80,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ Name: crdb_internal_column_2_name_placeholder │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • CreateGcJobForIndex │ │ IndexID: 2 │ │ StatementForDropJob: @@ -129,20 +125,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ - │ │ └── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "indexes containing columns reach absent before column" + │ │ ├── • Precedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "indexes containing column reach absent before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} + │ │ rule: "dependents removed before column" │ │ │ ├── • ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} │ │ │ PUBLIC → ABSENT │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ └── • SameStagePrecedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} │ │ rule: "column type dependents removed right before column type" │ │ │ ├── • ColumnDefaultExpression:{DescID: 106, ColumnID: 2} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ rule: "column no longer public before dependents" │ │ │ └── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ DELETE_ONLY → ABSENT diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_4_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_4_of_7 index 17f34a13430f..40f94e5ec9fa 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_4_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_4_of_7 @@ -22,7 +22,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ │ DELETE_ONLY → ABSENT @@ -37,21 +37,39 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ rule: "column no longer public before dependents" + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 11 Mutation operations + │ └── • 7 Mutation operations │ │ │ ├── • MakeDroppedColumnDeleteOnly │ │ ColumnID: 2 @@ -62,32 +80,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ Name: crdb_internal_column_2_name_placeholder │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • CreateGcJobForIndex │ │ IndexID: 2 │ │ StatementForDropJob: @@ -129,20 +125,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ - │ │ └── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "indexes containing columns reach absent before column" + │ │ ├── • Precedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "indexes containing column reach absent before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} + │ │ rule: "dependents removed before column" │ │ │ ├── • ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} │ │ │ PUBLIC → ABSENT │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ └── • SameStagePrecedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} │ │ rule: "column type dependents removed right before column type" │ │ │ ├── • ColumnDefaultExpression:{DescID: 106, ColumnID: 2} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ rule: "column no longer public before dependents" │ │ │ └── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ DELETE_ONLY → ABSENT diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_5_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_5_of_7 index 453203b1c1b5..12ce00a4c7e8 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_5_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_5_of_7 @@ -22,27 +22,45 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ MERGE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ rule: "column no longer public before dependents" + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 10 Mutation operations + │ └── • 6 Mutation operations │ │ │ ├── • MakeDroppedColumnDeleteOnly │ │ ColumnID: 2 @@ -53,32 +71,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ Name: crdb_internal_column_2_name_placeholder │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 106 @@ -105,20 +101,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ - │ │ └── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "indexes containing columns reach absent before column" + │ │ ├── • Precedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "indexes containing column reach absent before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} + │ │ rule: "dependents removed before column" │ │ │ ├── • ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} │ │ │ PUBLIC → ABSENT │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ └── • SameStagePrecedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} │ │ rule: "column type dependents removed right before column type" │ │ │ ├── • ColumnDefaultExpression:{DescID: 106, ColumnID: 2} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ rule: "column no longer public before dependents" │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ DELETE_ONLY → ABSENT diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_6_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_6_of_7 index 7de39cfc7d5c..67afd60894a1 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_6_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_6_of_7 @@ -22,27 +22,45 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ MERGE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ rule: "column no longer public before dependents" + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 10 Mutation operations + │ └── • 6 Mutation operations │ │ │ ├── • MakeDroppedColumnDeleteOnly │ │ ColumnID: 2 @@ -53,32 +71,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ Name: crdb_internal_column_2_name_placeholder │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 106 @@ -105,20 +101,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ - │ │ └── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "indexes containing columns reach absent before column" + │ │ ├── • Precedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "indexes containing column reach absent before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} + │ │ rule: "dependents removed before column" │ │ │ ├── • ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} │ │ │ PUBLIC → ABSENT │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ └── • SameStagePrecedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} │ │ rule: "column type dependents removed right before column type" │ │ │ ├── • ColumnDefaultExpression:{DescID: 106, ColumnID: 2} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ rule: "column no longer public before dependents" │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ DELETE_ONLY → ABSENT diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_7_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_7_of_7 index 95c0f6f58881..1fd8c4d71cf1 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_7_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column.rollback_7_of_7 @@ -22,27 +22,45 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ rule: "column no longer public before dependents" + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 10 Mutation operations + │ └── • 6 Mutation operations │ │ │ ├── • MakeDroppedColumnDeleteOnly │ │ ColumnID: 2 @@ -57,32 +75,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ IndexID: 2 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 106 │ │ @@ -105,20 +101,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ - │ │ └── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "indexes containing columns reach absent before column" + │ │ ├── • Precedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "indexes containing column reach absent before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} + │ │ rule: "dependents removed before column" │ │ │ ├── • ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} │ │ │ PUBLIC → ABSENT │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ └── • SameStagePrecedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} │ │ rule: "column type dependents removed right before column type" │ │ │ ├── • ColumnDefaultExpression:{DescID: 106, ColumnID: 2} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ rule: "column no longer public before dependents" │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ DELETE_ONLY → ABSENT diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq index 19526b3ae063..7f42f2e53628 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN l INT NOT NULL DEFAU │ │ │ └── • Stage 1 of 1 in StatementPhase │ │ -│ ├── • 9 elements transitioning toward PUBLIC +│ ├── • 7 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 106, ColumnID: 2} │ │ │ ABSENT → DELETE_ONLY @@ -21,14 +21,15 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN l INT NOT NULL DEFAU │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from DELETE_ONLY Column:{DescID: 106, ColumnID: 2} -│ │ │ rule: "column name set right after column existence" │ │ │ rule: "column existence precedes column dependents" +│ │ │ rule: "column name and type set right after column existence" │ │ │ │ │ ├── • ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} │ │ │ │ ABSENT → PUBLIC │ │ │ │ -│ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 106, Name: l, ColumnID: 2} -│ │ │ rule: "column named before column type becomes public" +│ │ │ └── • SameStagePrecedence dependency from DELETE_ONLY Column:{DescID: 106, ColumnID: 2} +│ │ │ rule: "column existence precedes column dependents" +│ │ │ rule: "column name and type set right after column existence" │ │ │ │ │ ├── • ColumnDefaultExpression:{DescID: 106, ColumnID: 2} │ │ │ │ ABSENT → PUBLIC @@ -46,29 +47,30 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN l INT NOT NULL DEFAU │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" +│ │ │ rule: "index existence precedes index dependents" │ │ │ -│ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} -│ │ │ │ ABSENT → PUBLIC -│ │ │ │ -│ │ │ ├── • Precedence dependency from DELETE_ONLY Column:{DescID: 106, ColumnID: 2} -│ │ │ │ rule: "column existence precedes column dependents" -│ │ │ │ -│ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 106, Name: l, ColumnID: 2} -│ │ │ │ rule: "column name and type to public after all index column to public" -│ │ │ │ -│ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} -│ │ │ │ rule: "column name and type to public after all index column to public" +│ │ └── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} +│ │ │ ABSENT → PUBLIC +│ │ │ +│ │ ├── • Precedence dependency from DELETE_ONLY Column:{DescID: 106, ColumnID: 2} +│ │ │ rule: "column existence precedes column dependents" +│ │ │ +│ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} +│ │ rule: "index existence precedes index dependents" +│ │ +│ ├── • 3 elements transitioning toward TRANSIENT_ABSENT +│ │ │ +│ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} +│ │ │ │ ABSENT → DELETE_ONLY │ │ │ │ -│ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" +│ │ │ └── • Precedence dependency from DELETE_ONLY Column:{DescID: 106, ColumnID: 2} +│ │ │ rule: "column existence precedes temp index existence" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} -│ │ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ │ rule: "index-column added to index after temp index exists" +│ │ │ rule: "temp index existence precedes index dependents" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} │ │ │ ABSENT → PUBLIC @@ -76,23 +78,8 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN l INT NOT NULL DEFAU │ │ ├── • Precedence dependency from DELETE_ONLY Column:{DescID: 106, ColumnID: 2} │ │ │ rule: "column existence precedes column dependents" │ │ │ -│ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 106, Name: l, ColumnID: 2} -│ │ │ rule: "column name and type to public after all index column to public" -│ │ │ -│ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} -│ │ │ rule: "column name and type to public after all index column to public" -│ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} -│ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ rule: "index-column added to index after temp index exists" -│ │ -│ ├── • 1 element transitioning toward TRANSIENT_ABSENT -│ │ │ -│ │ └── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} -│ │ │ ABSENT → DELETE_ONLY -│ │ │ -│ │ └── • Precedence dependency from DELETE_ONLY Column:{DescID: 106, ColumnID: 2} -│ │ rule: "column existence precedes temporary index existence" +│ │ rule: "temp index existence precedes index dependents" │ │ │ └── • 12 Mutation operations │ │ @@ -390,8 +377,11 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN l INT NOT NULL DEFAU │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} │ │ │ PUBLIC → WRITE_ONLY @@ -400,15 +390,30 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN l INT NOT NULL DEFAU │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} - │ │ rule: "index no longer public before dependents removed" + │ │ rule: "index no longer public before dependents" │ │ │ ├── • 3 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 106, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • Precedence dependency from PUBLIC PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "adding column depends on primary index" + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 106, Name: l, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnDefaultExpression:{DescID: 106, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ │ rule: "swapped primary index public before column" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ │ VALIDATED → PUBLIC @@ -416,21 +421,40 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN l INT NOT NULL DEFAU │ │ │ ├── • SameStagePrecedence dependency from VALIDATED PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} │ │ │ │ rule: "primary index swap" │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 106, Name: tbl_pkey, IndexID: 2} - │ │ │ rule: "index named right before index becomes public" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 106, Name: tbl_pkey, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ rule: "index named right before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 106, Name: tbl_pkey, IndexID: 2} │ │ │ ABSENT → PUBLIC │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "index existence precedes index name and comment" + │ │ rule: "index existence precedes index dependents" │ │ - │ ├── • 1 element transitioning toward TRANSIENT_ABSENT + │ ├── • 3 elements transitioning toward TRANSIENT_ABSENT │ │ │ - │ │ └── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} - │ │ WRITE_ONLY → TRANSIENT_DELETE_ONLY + │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} + │ │ │ WRITE_ONLY → TRANSIENT_DELETE_ONLY + │ │ │ + │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} + │ │ │ │ PUBLIC → TRANSIENT_ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" + │ │ │ + │ │ └── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} + │ │ │ PUBLIC → TRANSIENT_ABSENT + │ │ │ + │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 11 Mutation operations + │ └── • 10 Mutation operations │ │ │ ├── • MakeDroppedPrimaryIndexDeleteAndWriteOnly │ │ IndexID: 1 @@ -450,11 +474,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN l INT NOT NULL DEFAU │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 1 - │ │ TableID: 106 - │ │ │ ├── • MakeAddedPrimaryIndexPublic │ │ EventBase: │ │ Authorization: @@ -493,7 +512,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN l INT NOT NULL DEFAU │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 1 MutationType op pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 3 MutationType ops pending │ ├── • Stage 2 of 3 in PostCommitNonRevertiblePhase │ │ @@ -502,12 +521,31 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN l INT NOT NULL DEFAU │ │ └── • PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} │ │ WRITE_ONLY → DELETE_ONLY │ │ - │ └── • 4 Mutation operations + │ ├── • 1 element transitioning toward TRANSIENT_ABSENT + │ │ │ + │ │ └── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} + │ │ │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT + │ │ │ + │ │ ├── • Precedence dependency from TRANSIENT_ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} + │ │ │ rule: "dependents removed before index" + │ │ │ + │ │ └── • Precedence dependency from TRANSIENT_ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} + │ │ rule: "dependents removed before index" + │ │ + │ └── • 6 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 1 │ │ TableID: 106 │ │ + │ ├── • CreateGcJobForIndex + │ │ IndexID: 3 + │ │ TableID: 106 + │ │ + │ ├── • MakeIndexAbsent + │ │ IndexID: 3 + │ │ TableID: 106 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 106 │ │ @@ -517,7 +555,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN l INT NOT NULL DEFAU │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 3 of 3 with 4 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 3 of 3 with 2 MutationType ops pending │ └── • Stage 3 of 3 in PostCommitNonRevertiblePhase │ @@ -529,26 +567,10 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN l INT NOT NULL DEFAU │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 1} │ │ rule: "dependents removed before index" │ │ - │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 106, Name: tbl_pkey, IndexID: 1} - │ │ rule: "dependents removed before index" - │ │ - │ └── • SameStagePrecedence dependency from TRANSIENT_ABSENT TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} - │ rule: "temp indexes reach absent at the same time as other indexes" - │ - ├── • 1 element transitioning toward TRANSIENT_ABSENT - │ │ - │ └── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} - │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT + │ └── • Precedence dependency from ABSENT IndexName:{DescID: 106, Name: tbl_pkey, IndexID: 1} + │ rule: "dependents removed before index" │ - └── • 7 Mutation operations - │ - ├── • CreateGcJobForIndex - │ IndexID: 3 - │ TableID: 106 - │ - ├── • MakeIndexAbsent - │ IndexID: 3 - │ TableID: 106 + └── • 5 Mutation operations │ ├── • CreateGcJobForIndex │ IndexID: 1 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_1_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_1_of_7 index c14cc9845d23..31daede302cf 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_1_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_1_of_7 @@ -25,8 +25,17 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ - │ │ └── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "indexes containing columns reach absent before column" + │ │ ├── • Precedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "indexes containing column reach absent before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} + │ │ rule: "dependents removed before column" │ │ │ ├── • ColumnName:{DescID: 106, Name: l, ColumnID: 2} │ │ PUBLIC → ABSENT @@ -53,10 +62,16 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ │ rule: "dependents removed before index" │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ DELETE_ONLY → ABSENT @@ -68,40 +83,24 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ │ rule: "dependents removed before index" │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ PUBLIC → ABSENT + │ │ PUBLIC → ABSENT + │ │ + │ └── • skip PUBLIC → ABSENT operations + │ rule: "skip index-column removal ops on index removal" │ - └── • 15 Mutation operations + └── • 11 Mutation operations │ ├── • SetColumnName │ ColumnID: 2 │ Name: crdb_internal_column_2_name_placeholder │ TableID: 106 │ - ├── • RemoveColumnFromIndex - │ ColumnID: 1 - │ IndexID: 2 - │ TableID: 106 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 2 - │ IndexID: 2 - │ Kind: 2 - │ TableID: 106 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 1 - │ IndexID: 3 - │ TableID: 106 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 2 - │ IndexID: 3 - │ Kind: 2 - │ TableID: 106 - │ ├── • CreateGcJobForIndex │ IndexID: 2 │ StatementForDropJob: diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_2_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_2_of_7 index 034a0e39c6bc..67fb00c90418 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_2_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_2_of_7 @@ -22,7 +22,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ │ BACKFILL_ONLY → ABSENT @@ -37,21 +37,39 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ rule: "column no longer public before dependents" + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 12 Mutation operations + │ └── • 8 Mutation operations │ │ │ ├── • MakeDroppedColumnDeleteOnly │ │ ColumnID: 2 @@ -62,32 +80,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ Name: crdb_internal_column_2_name_placeholder │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • CreateGcJobForIndex │ │ IndexID: 2 │ │ StatementForDropJob: @@ -132,20 +128,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ - │ │ └── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "indexes containing columns reach absent before column" + │ │ ├── • Precedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "indexes containing column reach absent before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} + │ │ rule: "dependents removed before column" │ │ │ ├── • ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} │ │ │ PUBLIC → ABSENT │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ └── • SameStagePrecedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} │ │ rule: "column type dependents removed right before column type" │ │ │ ├── • ColumnDefaultExpression:{DescID: 106, ColumnID: 2} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ rule: "column no longer public before dependents" │ │ │ └── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ DELETE_ONLY → ABSENT diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_3_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_3_of_7 index 7a53ae342bb0..3a5bb384f22d 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_3_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_3_of_7 @@ -22,7 +22,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ │ BACKFILL_ONLY → ABSENT @@ -37,21 +37,39 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ rule: "column no longer public before dependents" + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 12 Mutation operations + │ └── • 8 Mutation operations │ │ │ ├── • MakeDroppedColumnDeleteOnly │ │ ColumnID: 2 @@ -62,32 +80,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ Name: crdb_internal_column_2_name_placeholder │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • CreateGcJobForIndex │ │ IndexID: 2 │ │ StatementForDropJob: @@ -132,20 +128,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ - │ │ └── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "indexes containing columns reach absent before column" + │ │ ├── • Precedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "indexes containing column reach absent before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} + │ │ rule: "dependents removed before column" │ │ │ ├── • ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} │ │ │ PUBLIC → ABSENT │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ └── • SameStagePrecedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} │ │ rule: "column type dependents removed right before column type" │ │ │ ├── • ColumnDefaultExpression:{DescID: 106, ColumnID: 2} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ rule: "column no longer public before dependents" │ │ │ └── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ DELETE_ONLY → ABSENT diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_4_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_4_of_7 index 7c14d74ce904..3e88d9d61e59 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_4_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_4_of_7 @@ -22,7 +22,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ │ DELETE_ONLY → ABSENT @@ -37,21 +37,39 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ rule: "column no longer public before dependents" + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 12 Mutation operations + │ └── • 8 Mutation operations │ │ │ ├── • MakeDroppedColumnDeleteOnly │ │ ColumnID: 2 @@ -62,32 +80,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ Name: crdb_internal_column_2_name_placeholder │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • CreateGcJobForIndex │ │ IndexID: 2 │ │ StatementForDropJob: @@ -132,20 +128,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ - │ │ └── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "indexes containing columns reach absent before column" + │ │ ├── • Precedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "indexes containing column reach absent before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} + │ │ rule: "dependents removed before column" │ │ │ ├── • ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} │ │ │ PUBLIC → ABSENT │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ └── • SameStagePrecedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} │ │ rule: "column type dependents removed right before column type" │ │ │ ├── • ColumnDefaultExpression:{DescID: 106, ColumnID: 2} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ rule: "column no longer public before dependents" │ │ │ └── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ DELETE_ONLY → ABSENT diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_5_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_5_of_7 index a37bbc1525ba..24cd5ffd6919 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_5_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_5_of_7 @@ -22,27 +22,45 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ MERGE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ rule: "column no longer public before dependents" + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 11 Mutation operations + │ └── • 7 Mutation operations │ │ │ ├── • MakeDroppedColumnDeleteOnly │ │ ColumnID: 2 @@ -53,32 +71,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ Name: crdb_internal_column_2_name_placeholder │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 106 @@ -108,20 +104,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ - │ │ └── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "indexes containing columns reach absent before column" + │ │ ├── • Precedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "indexes containing column reach absent before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} + │ │ rule: "dependents removed before column" │ │ │ ├── • ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} │ │ │ PUBLIC → ABSENT │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ └── • SameStagePrecedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} │ │ rule: "column type dependents removed right before column type" │ │ │ ├── • ColumnDefaultExpression:{DescID: 106, ColumnID: 2} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ rule: "column no longer public before dependents" │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ DELETE_ONLY → ABSENT diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_6_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_6_of_7 index 7a65fb28d9d6..5d54fe2e19b2 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_6_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_6_of_7 @@ -22,27 +22,45 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ MERGE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ rule: "column no longer public before dependents" + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 11 Mutation operations + │ └── • 7 Mutation operations │ │ │ ├── • MakeDroppedColumnDeleteOnly │ │ ColumnID: 2 @@ -53,32 +71,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ Name: crdb_internal_column_2_name_placeholder │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 106 @@ -108,20 +104,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ - │ │ └── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "indexes containing columns reach absent before column" + │ │ ├── • Precedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "indexes containing column reach absent before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} + │ │ rule: "dependents removed before column" │ │ │ ├── • ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} │ │ │ PUBLIC → ABSENT │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ └── • SameStagePrecedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} │ │ rule: "column type dependents removed right before column type" │ │ │ ├── • ColumnDefaultExpression:{DescID: 106, ColumnID: 2} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ rule: "column no longer public before dependents" │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ DELETE_ONLY → ABSENT diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_7_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_7_of_7 index f8210b2ec8ba..50bc4c0a2e3b 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_7_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_seq.rollback_7_of_7 @@ -22,27 +22,45 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ │ rule: "column no longer public before dependents" + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 11 Mutation operations + │ └── • 7 Mutation operations │ │ │ ├── • MakeDroppedColumnDeleteOnly │ │ ColumnID: 2 @@ -57,32 +75,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ IndexID: 2 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 106 │ │ @@ -108,20 +104,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ - │ │ └── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "indexes containing columns reach absent before column" + │ │ ├── • Precedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "indexes containing column reach absent before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} + │ │ rule: "dependents removed before column" │ │ │ ├── • ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} │ │ │ PUBLIC → ABSENT │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ └── • SameStagePrecedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 2} │ │ rule: "column type dependents removed right before column type" │ │ │ ├── • ColumnDefaultExpression:{DescID: 106, ColumnID: 2} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ rule: "column no longer public before dependents" │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ DELETE_ONLY → ABSENT diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_no_default b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_no_default index 40a2113bdbe9..6bbcb661f867 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_no_default +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_no_default @@ -20,26 +20,21 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN j INT; │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from DELETE_ONLY Column:{DescID: 106, ColumnID: 2} -│ │ │ rule: "column name set right after column existence" │ │ │ rule: "column existence precedes column dependents" +│ │ │ rule: "column name and type set right after column existence" │ │ │ │ │ ├── • ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} │ │ │ │ ABSENT → PUBLIC │ │ │ │ -│ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 106, Name: j, ColumnID: 2} -│ │ │ rule: "column named before column type becomes public" +│ │ │ └── • SameStagePrecedence dependency from DELETE_ONLY Column:{DescID: 106, ColumnID: 2} +│ │ │ rule: "column existence precedes column dependents" +│ │ │ rule: "column name and type set right after column existence" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 1} │ │ │ ABSENT → PUBLIC │ │ │ -│ │ ├── • Precedence dependency from DELETE_ONLY Column:{DescID: 106, ColumnID: 2} -│ │ │ rule: "column existence precedes column dependents" -│ │ │ -│ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 106, Name: j, ColumnID: 2} -│ │ │ rule: "column name and type to public after all index column to public" -│ │ │ -│ │ └── • Precedence dependency from PUBLIC ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} -│ │ rule: "column name and type to public after all index column to public" +│ │ └── • Precedence dependency from DELETE_ONLY Column:{DescID: 106, ColumnID: 2} +│ │ rule: "column existence precedes column dependents" │ │ │ └── • 5 Mutation operations │ │ @@ -136,7 +131,16 @@ EXPLAIN (ddl, verbose) ALTER TABLE db.public.tbl ADD COLUMN j INT; ├── • 1 element transitioning toward PUBLIC │ │ │ └── • Column:{DescID: 106, ColumnID: 2} - │ WRITE_ONLY → PUBLIC + │ │ WRITE_ONLY → PUBLIC + │ │ + │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 106, Name: j, ColumnID: 2} + │ │ rule: "column dependents exist before column becomes public" + │ │ + │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} + │ │ rule: "column dependents exist before column becomes public" + │ │ + │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 1} + │ rule: "column dependents exist before column becomes public" │ └── • 4 Mutation operations │ diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_no_default.rollback_1_of_2 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_no_default.rollback_1_of_2 index 1193914bd295..4675d32c6441 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_no_default.rollback_1_of_2 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_no_default.rollback_1_of_2 @@ -20,9 +20,12 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 2; │ │ ├── • Precedence dependency from ABSENT ColumnName:{DescID: 106, Name: j, ColumnID: 2} │ │ │ rule: "dependents removed before column" │ │ │ - │ │ └── • SameStagePrecedence dependency from ABSENT ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} + │ │ ├── • SameStagePrecedence dependency from ABSENT ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ rule: "column type removed right before column when not dropping relation" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 1} │ │ rule: "dependents removed before column" - │ │ rule: "column type removed right before column when not dropping relation" │ │ │ ├── • ColumnName:{DescID: 106, Name: j, ColumnID: 2} │ │ PUBLIC → ABSENT diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_no_default.rollback_2_of_2 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_no_default.rollback_2_of_2 index 79f705c77ad0..d30edd7f7b93 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_no_default.rollback_2_of_2 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_no_default.rollback_2_of_2 @@ -21,10 +21,13 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 2; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 1} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} + │ │ rule: "column no longer public before dependents" │ │ │ └── • 5 Mutation operations │ │ @@ -61,15 +64,18 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 2; │ │ ├── • Precedence dependency from ABSENT ColumnName:{DescID: 106, Name: j, ColumnID: 2} │ │ │ rule: "dependents removed before column" │ │ │ - │ │ └── • SameStagePrecedence dependency from ABSENT ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} + │ │ ├── • SameStagePrecedence dependency from ABSENT ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ rule: "column type removed right before column when not dropping relation" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 1} │ │ rule: "dependents removed before column" - │ │ rule: "column type removed right before column when not dropping relation" │ │ │ └── • ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 2} │ │ PUBLIC → ABSENT │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 2} - │ rule: "column dependents removed after column no longer public" + │ rule: "column no longer public before dependents" │ └── • 3 Mutation operations │ diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla b/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla index d94dfa6478f6..c98e00852d1f 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla +++ b/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla @@ -10,7 +10,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (j); │ │ │ └── • Stage 1 of 1 in StatementPhase │ │ -│ ├── • 10 elements transitioning toward PUBLIC +│ ├── • 8 elements transitioning toward PUBLIC │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ ABSENT → BACKFILL_ONLY @@ -19,27 +19,13 @@ EXPLAIN (ddl, verbose) ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (j); │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" +│ │ │ rule: "index existence precedes index dependents" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" -│ │ │ -│ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} -│ │ │ │ ABSENT → PUBLIC -│ │ │ │ -│ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} -│ │ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ │ rule: "index-column added to index after temp index exists" -│ │ │ -│ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} -│ │ │ │ ABSENT → PUBLIC -│ │ │ │ -│ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} -│ │ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ │ rule: "index-column added to index after temp index exists" +│ │ │ rule: "index existence precedes index dependents" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} │ │ │ ABSENT → BACKFILL_ONLY @@ -48,33 +34,43 @@ EXPLAIN (ddl, verbose) ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (j); │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" +│ │ │ rule: "index existence precedes index dependents" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1} -│ │ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ │ rule: "index-column added to index after temp index exists" +│ │ │ rule: "temp index existence precedes index dependents" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" +│ │ │ rule: "index existence precedes index dependents" │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} │ │ │ ABSENT → PUBLIC │ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1} -│ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ rule: "index-column added to index after temp index exists" +│ │ rule: "temp index existence precedes index dependents" │ │ -│ ├── • 2 elements transitioning toward TRANSIENT_ABSENT +│ ├── • 4 elements transitioning toward TRANSIENT_ABSENT │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ ABSENT → DELETE_ONLY │ │ │ +│ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} +│ │ │ │ ABSENT → PUBLIC +│ │ │ │ +│ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} +│ │ │ rule: "temp index existence precedes index dependents" +│ │ │ +│ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} +│ │ │ │ ABSENT → PUBLIC +│ │ │ │ +│ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} +│ │ │ rule: "temp index existence precedes index dependents" +│ │ │ │ │ └── • TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1} │ │ ABSENT → DELETE_ONLY │ │ @@ -199,13 +195,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (j); │ │ │ │ rule: "index-column added to index before temp index receives writes" │ │ │ │ │ │ │ └── • TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1} -│ │ │ │ DELETE_ONLY → WRITE_ONLY -│ │ │ │ -│ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} -│ │ │ │ rule: "index-column added to index before temp index receives writes" -│ │ │ │ -│ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} -│ │ │ rule: "index-column added to index before temp index receives writes" +│ │ │ DELETE_ONLY → WRITE_ONLY │ │ │ │ │ └── • 4 Mutation operations │ │ │ @@ -396,14 +386,20 @@ EXPLAIN (ddl, verbose) ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (j); │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ PUBLIC → WRITE_ONLY @@ -412,7 +408,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (j); │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ rule: "index no longer public before dependents removed" + │ │ rule: "index no longer public before dependents" │ │ │ ├── • 4 elements transitioning toward PUBLIC │ │ │ @@ -422,36 +418,62 @@ EXPLAIN (ddl, verbose) ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (j); │ │ │ ├── • SameStagePrecedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ │ rule: "primary index swap" │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 2} - │ │ │ rule: "index named right before index becomes public" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ rule: "index named right before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ │ │ ├── • IndexName:{DescID: 104, Name: t_pkey, IndexID: 2} │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "index existence precedes index name and comment" + │ │ │ rule: "index existence precedes index dependents" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} │ │ │ ABSENT → PUBLIC │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} - │ │ rule: "index existence precedes index name and comment" + │ │ rule: "index existence precedes index dependents" │ │ - │ ├── • 2 elements transitioning toward TRANSIENT_ABSENT + │ ├── • 4 elements transitioning toward TRANSIENT_ABSENT │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → TRANSIENT_DELETE_ONLY │ │ │ + │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} + │ │ │ │ PUBLIC → TRANSIENT_ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" + │ │ │ + │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} + │ │ │ │ PUBLIC → TRANSIENT_ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" + │ │ │ │ │ └── • TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1} │ │ WRITE_ONLY → TRANSIENT_DELETE_ONLY │ │ - │ └── • 12 Mutation operations + │ └── • 10 Mutation operations │ │ │ ├── • MakeDroppedPrimaryIndexDeleteAndWriteOnly │ │ IndexID: 1 @@ -480,17 +502,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (j); │ │ Name: t_i_key │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 1 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeAddedPrimaryIndexPublic │ │ EventBase: │ │ Authorization: @@ -514,7 +525,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (j); │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 1 MutationType op pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 5 MutationType ops pending │ ├── • Stage 2 of 3 in PostCommitNonRevertiblePhase │ │ @@ -523,19 +534,49 @@ EXPLAIN (ddl, verbose) ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (j); │ │ └── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ WRITE_ONLY → DELETE_ONLY │ │ - │ └── • 3 Mutation operations + │ ├── • 2 elements transitioning toward TRANSIENT_ABSENT + │ │ │ + │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} + │ │ │ │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT + │ │ │ │ + │ │ │ ├── • Precedence dependency from TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} + │ │ │ │ rule: "dependents removed before index" + │ │ │ │ + │ │ │ └── • Precedence dependency from TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} + │ │ │ rule: "dependents removed before index" + │ │ │ + │ │ └── • TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1} + │ │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT + │ │ + │ └── • 7 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 1 │ │ TableID: 104 │ │ + │ ├── • CreateGcJobForIndex + │ │ IndexID: 3 + │ │ TableID: 104 + │ │ + │ ├── • MakeIndexAbsent + │ │ IndexID: 3 + │ │ TableID: 104 + │ │ + │ ├── • CreateGcJobForIndex + │ │ IndexID: 5 + │ │ TableID: 104 + │ │ + │ ├── • MakeIndexAbsent + │ │ IndexID: 5 + │ │ TableID: 104 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 3 of 3 with 6 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 3 of 3 with 2 MutationType ops pending │ └── • Stage 3 of 3 in PostCommitNonRevertiblePhase │ @@ -550,40 +591,10 @@ EXPLAIN (ddl, verbose) ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (j); │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} │ │ rule: "dependents removed before index" │ │ - │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} - │ │ rule: "dependents removed before index" - │ │ - │ ├── • SameStagePrecedence dependency from TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} - │ │ rule: "temp indexes reach absent at the same time as other indexes" - │ │ - │ └── • SameStagePrecedence dependency from TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1} - │ rule: "temp indexes reach absent at the same time as other indexes" - │ - ├── • 2 elements transitioning toward TRANSIENT_ABSENT - │ │ - │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} - │ │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT - │ │ - │ └── • TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1} - │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT + │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} + │ rule: "dependents removed before index" │ - └── • 8 Mutation operations - │ - ├── • CreateGcJobForIndex - │ IndexID: 3 - │ TableID: 104 - │ - ├── • MakeIndexAbsent - │ IndexID: 3 - │ TableID: 104 - │ - ├── • CreateGcJobForIndex - │ IndexID: 5 - │ TableID: 104 - │ - ├── • MakeIndexAbsent - │ IndexID: 5 - │ TableID: 104 + └── • 4 Mutation operations │ ├── • CreateGcJobForIndex │ IndexID: 1 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_1_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_1_of_7 index 79a01b86cd6c..cd38e997f066 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_1_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_1_of_7 @@ -26,10 +26,16 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ │ rule: "dependents removed before index" │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ DELETE_ONLY → ABSENT @@ -41,20 +47,24 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ │ rule: "dependents removed before index" │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} │ │ │ BACKFILL_ONLY → ABSENT │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} @@ -72,66 +82,28 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} │ │ │ PUBLIC → ABSENT │ │ │ - │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} - │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ │ │ PUBLIC → ABSENT │ │ │ - │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} - │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} - │ PUBLIC → ABSENT + │ │ PUBLIC → ABSENT + │ │ + │ └── • skip PUBLIC → ABSENT operations + │ rule: "skip index-column removal ops on index removal" │ - └── • 19 Mutation operations - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 2 - │ IndexID: 2 - │ TableID: 104 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 1 - │ IndexID: 2 - │ Kind: 2 - │ TableID: 104 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 2 - │ IndexID: 3 - │ TableID: 104 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 1 - │ IndexID: 3 - │ Kind: 2 - │ TableID: 104 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 1 - │ IndexID: 4 - │ TableID: 104 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 1 - │ IndexID: 5 - │ TableID: 104 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 2 - │ IndexID: 4 - │ Kind: 1 - │ TableID: 104 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 2 - │ IndexID: 5 - │ Kind: 1 - │ TableID: 104 + └── • 11 Mutation operations │ ├── • CreateGcJobForIndex │ IndexID: 2 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_2_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_2_of_7 index ecf60062c67b..eba28bee82bc 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_2_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_2_of_7 @@ -26,29 +26,39 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} │ │ │ │ BACKFILL_ONLY → ABSENT │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} @@ -60,75 +70,37 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 17 Mutation operations - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 104 + │ └── • 9 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 5 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 5 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 4 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 5 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ │ ├── • CreateGcJobForIndex │ │ IndexID: 2 │ │ StatementForDropJob: diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_3_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_3_of_7 index 3f2b53267fdc..fa5135e6c99a 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_3_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_3_of_7 @@ -26,29 +26,39 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} │ │ │ │ BACKFILL_ONLY → ABSENT │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} @@ -60,75 +70,37 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 17 Mutation operations - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 104 + │ └── • 9 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 5 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 5 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 4 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 5 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ │ ├── • CreateGcJobForIndex │ │ IndexID: 2 │ │ StatementForDropJob: diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_4_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_4_of_7 index 842c0dd08dc5..31d7d3a1921a 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_4_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_4_of_7 @@ -26,29 +26,39 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} │ │ │ │ DELETE_ONLY → ABSENT │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} @@ -60,75 +70,37 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 17 Mutation operations - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 104 + │ └── • 9 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 5 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 5 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 4 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 5 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ │ ├── • CreateGcJobForIndex │ │ IndexID: 2 │ │ StatementForDropJob: diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_5_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_5_of_7 index cf34a76d9d58..eaa5307cf2ae 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_5_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_5_of_7 @@ -17,19 +17,31 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ │ MERGE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} │ │ │ MERGE_ONLY → DELETE_ONLY @@ -40,64 +52,37 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 14 Mutation operations - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 104 + │ └── • 6 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 5 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 5 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 5 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 @@ -106,17 +91,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 4 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ @@ -154,11 +128,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ │ DELETE_ONLY → ABSENT │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_6_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_6_of_7 index 531cdae9705c..1a39e4f44031 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_6_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_6_of_7 @@ -17,19 +17,31 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ │ MERGE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} │ │ │ MERGE_ONLY → DELETE_ONLY @@ -40,64 +52,37 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 14 Mutation operations - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 104 + │ └── • 6 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 5 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 5 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 5 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 @@ -106,17 +91,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 4 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ @@ -154,11 +128,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ │ DELETE_ONLY → ABSENT │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_7_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_7_of_7 index fb74b088885b..950386ac0f40 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_7_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/alter_table_alter_primary_key_vanilla.rollback_7_of_7 @@ -17,19 +17,31 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY @@ -40,53 +52,37 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 14 Mutation operations + │ └── • 6 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 104 @@ -95,28 +91,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ IndexID: 5 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 5 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 4 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 5 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ @@ -154,11 +128,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ │ DELETE_ONLY → ABSENT │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/create_index b/pkg/sql/schemachanger/testdata/explain_verbose/create_index index 669dd5639bb7..42d2f5c5e10c 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/create_index +++ b/pkg/sql/schemachanger/testdata/explain_verbose/create_index @@ -17,13 +17,13 @@ EXPLAIN (ddl, verbose) CREATE INDEX idx1 ON t (v) WHERE (v = 'a'); │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" +│ │ │ rule: "index existence precedes index dependents" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" +│ │ │ rule: "index existence precedes index dependents" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ ABSENT → BACKFILL_ONLY @@ -32,15 +32,13 @@ EXPLAIN (ddl, verbose) CREATE INDEX idx1 ON t (v) WHERE (v = 'a'); │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 0, SourceIndexID: 1} -│ │ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ │ rule: "index-column added to index after temp index exists" +│ │ │ rule: "temp index existence precedes index dependents" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} │ │ │ ABSENT → PUBLIC │ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 0, SourceIndexID: 1} -│ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ rule: "index-column added to index after temp index exists" +│ │ rule: "temp index existence precedes index dependents" │ │ │ ├── • 1 element transitioning toward TRANSIENT_ABSENT │ │ │ @@ -116,13 +114,7 @@ EXPLAIN (ddl, verbose) CREATE INDEX idx1 ON t (v) WHERE (v = 'a'); │ │ ├── • 1 element transitioning toward TRANSIENT_ABSENT │ │ │ │ │ │ │ └── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 0, SourceIndexID: 1} -│ │ │ │ DELETE_ONLY → WRITE_ONLY -│ │ │ │ -│ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} -│ │ │ │ rule: "index-column added to index before temp index receives writes" -│ │ │ │ -│ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} -│ │ │ rule: "index-column added to index before temp index receives writes" +│ │ │ DELETE_ONLY → WRITE_ONLY │ │ │ │ │ └── • 3 Mutation operations │ │ │ @@ -256,14 +248,21 @@ EXPLAIN (ddl, verbose) CREATE INDEX idx1 ON t (v) WHERE (v = 'a'); │ │ ├── • SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 106, Name: idx1, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 106, Name: idx1, IndexID: 2} │ │ │ ABSENT → PUBLIC │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "index existence precedes index name and comment" + │ │ rule: "index existence precedes index dependents" │ │ │ ├── • 1 element transitioning toward TRANSIENT_ABSENT │ │ │ diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_1_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_1_of_7 index 81655b60d97b..00c008d0f250 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_1_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_1_of_7 @@ -17,24 +17,22 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} │ │ │ PUBLIC → ABSENT │ │ │ - │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} │ │ │ PUBLIC → ABSENT │ │ │ - │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ BACKFILL_ONLY → ABSENT │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 106, Name: idx1, IndexID: 2} @@ -50,34 +48,18 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ │ rule: "dependents removed before index" │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ PUBLIC → ABSENT + │ │ PUBLIC → ABSENT + │ │ + │ └── • skip PUBLIC → ABSENT operations + │ rule: "skip index-column removal ops on index removal" │ - └── • 11 Mutation operations - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 2 - │ IndexID: 3 - │ TableID: 106 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 1 - │ IndexID: 3 - │ Kind: 1 - │ TableID: 106 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 2 - │ IndexID: 2 - │ TableID: 106 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 1 - │ IndexID: 2 - │ Kind: 1 - │ TableID: 106 + └── • 7 Mutation operations │ ├── • LogEvent │ Element: diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_2_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_2_of_7 index e38a8c2f13a2..629600c4cfbc 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_2_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_2_of_7 @@ -17,24 +17,22 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ │ BACKFILL_ONLY → ABSENT │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 106, Name: idx1, IndexID: 2} @@ -44,39 +42,23 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 10 Mutation operations + │ └── • 6 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ Kind: 1 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ Kind: 1 - │ │ TableID: 106 - │ │ │ ├── • LogEvent │ │ Element: │ │ SecondaryIndex: diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_3_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_3_of_7 index c4afc09fe46e..9679554c49df 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_3_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_3_of_7 @@ -17,24 +17,22 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ │ BACKFILL_ONLY → ABSENT │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 106, Name: idx1, IndexID: 2} @@ -44,39 +42,23 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 10 Mutation operations + │ └── • 6 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ Kind: 1 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ Kind: 1 - │ │ TableID: 106 - │ │ │ ├── • LogEvent │ │ Element: │ │ SecondaryIndex: diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_4_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_4_of_7 index ad3109c3b835..88268e6dbbc4 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_4_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_4_of_7 @@ -17,24 +17,22 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ │ DELETE_ONLY → ABSENT │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 106, Name: idx1, IndexID: 2} @@ -44,23 +42,18 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 10 Mutation operations - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ Kind: 1 - │ │ TableID: 106 + │ └── • 6 Mutation operations │ │ │ ├── • LogEvent │ │ Element: @@ -94,17 +87,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ Kind: 1 - │ │ TableID: 106 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 106 │ │ diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_5_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_5_of_7 index d85fa15deae1..a3f9fe3e18bb 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_5_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_5_of_7 @@ -17,14 +17,14 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ MERGE_ONLY → DELETE_ONLY @@ -33,43 +33,27 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 8 Mutation operations + │ └── • 4 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ Kind: 1 - │ │ TableID: 106 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ Kind: 1 - │ │ TableID: 106 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 106 │ │ @@ -86,11 +70,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ │ DELETE_ONLY → ABSENT │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 106, Name: idx1, IndexID: 2} diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_6_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_6_of_7 index df57fe2831ae..2f8917697486 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_6_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_6_of_7 @@ -17,14 +17,14 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ MERGE_ONLY → DELETE_ONLY @@ -33,43 +33,27 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 8 Mutation operations + │ └── • 4 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ Kind: 1 - │ │ TableID: 106 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ Kind: 1 - │ │ TableID: 106 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 106 │ │ @@ -86,11 +70,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ │ DELETE_ONLY → ABSENT │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 106, Name: idx1, IndexID: 2} diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_7_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_7_of_7 index 758008b5f817..694b577d5c54 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_7_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/create_index.rollback_7_of_7 @@ -17,14 +17,14 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY @@ -33,12 +33,18 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 8 Mutation operations + │ └── • 4 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 2 @@ -48,28 +54,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 3 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ Kind: 1 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ Kind: 1 - │ │ TableID: 106 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 106 │ │ @@ -86,11 +70,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ │ DELETE_ONLY → ABSENT │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 2} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 2} - │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ rule: "dependents removed before index" │ │ │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 106, Name: idx1, IndexID: 2} diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic index 888abd1a1fc4..373e54cb12ef 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic @@ -19,30 +19,29 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 2} -│ │ rule: "column dependents removed after column no longer public" +│ │ rule: "column no longer public before dependents" │ │ -│ ├── • 3 elements transitioning toward PUBLIC +│ ├── • 2 elements transitioning toward PUBLIC │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} │ │ │ ABSENT → BACKFILL_ONLY │ │ │ -│ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} -│ │ │ │ ABSENT → PUBLIC -│ │ │ │ -│ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" +│ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} +│ │ │ ABSENT → PUBLIC +│ │ │ +│ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} +│ │ rule: "index existence precedes index dependents" +│ │ +│ ├── • 2 elements transitioning toward TRANSIENT_ABSENT +│ │ │ +│ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} +│ │ │ ABSENT → DELETE_ONLY │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ │ ABSENT → PUBLIC │ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} -│ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ rule: "index-column added to index after temp index exists" -│ │ -│ ├── • 1 element transitioning toward TRANSIENT_ABSENT -│ │ │ -│ │ └── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} -│ │ ABSENT → DELETE_ONLY +│ │ rule: "temp index existence precedes index dependents" │ │ │ └── • 7 Mutation operations │ │ @@ -264,14 +263,23 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ PUBLIC → WRITE_ONLY @@ -280,7 +288,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ rule: "index no longer public before dependents removed" + │ │ rule: "index no longer public before dependents" │ │ │ ├── • 2 elements transitioning toward PUBLIC │ │ │ @@ -290,21 +298,31 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ │ │ ├── • SameStagePrecedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ │ rule: "primary index swap" │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 2} - │ │ │ rule: "index named right before index becomes public" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ rule: "index named right before index becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_pkey, IndexID: 2} │ │ │ ABSENT → PUBLIC │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 2, TemporaryIndexID: 3, SourceIndexID: 1} - │ │ rule: "index existence precedes index name and comment" + │ │ rule: "index existence precedes index dependents" │ │ - │ ├── • 1 element transitioning toward TRANSIENT_ABSENT + │ ├── • 2 elements transitioning toward TRANSIENT_ABSENT │ │ │ - │ │ └── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} - │ │ WRITE_ONLY → TRANSIENT_DELETE_ONLY + │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} + │ │ │ WRITE_ONLY → TRANSIENT_DELETE_ONLY + │ │ │ + │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} + │ │ │ PUBLIC → TRANSIENT_ABSENT + │ │ │ + │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 10 Mutation operations + │ └── • 8 Mutation operations │ │ │ ├── • MakeDroppedColumnDeleteOnly │ │ ColumnID: 2 @@ -328,17 +346,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 1 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeAddedPrimaryIndexPublic │ │ EventBase: │ │ Authorization: @@ -357,7 +364,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 1 MutationType op pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 3 MutationType ops pending │ ├── • Stage 2 of 3 in PostCommitNonRevertiblePhase │ │ @@ -366,19 +373,35 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ │ └── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ WRITE_ONLY → DELETE_ONLY │ │ - │ └── • 3 Mutation operations + │ ├── • 1 element transitioning toward TRANSIENT_ABSENT + │ │ │ + │ │ └── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} + │ │ │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT + │ │ │ + │ │ └── • Precedence dependency from TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} + │ │ rule: "dependents removed before index" + │ │ + │ └── • 5 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 1 │ │ TableID: 104 │ │ + │ ├── • CreateGcJobForIndex + │ │ IndexID: 3 + │ │ TableID: 104 + │ │ + │ ├── • MakeIndexAbsent + │ │ IndexID: 3 + │ │ TableID: 104 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 3 of 3 with 5 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 3 of 3 with 3 MutationType ops pending │ └── • Stage 3 of 3 in PostCommitNonRevertiblePhase │ @@ -394,14 +417,17 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ rule: "dependents removed before column" + │ │ │ │ │ └── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ rule: "indexes containing columns reach absent before column" + │ │ rule: "indexes containing column reach absent before column" │ │ │ ├── • ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 2} - │ │ rule: "column dependents removed after column no longer public" + │ │ rule: "column no longer public before dependents" │ │ │ └── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ DELETE_ONLY → ABSENT @@ -412,26 +438,10 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} │ │ rule: "dependents removed before index" │ │ - │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} - │ │ rule: "dependents removed before index" - │ │ - │ └── • SameStagePrecedence dependency from TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} - │ rule: "temp indexes reach absent at the same time as other indexes" + │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} + │ rule: "dependents removed before index" │ - ├── • 1 element transitioning toward TRANSIENT_ABSENT - │ │ - │ └── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} - │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT - │ - └── • 7 Mutation operations - │ - ├── • CreateGcJobForIndex - │ IndexID: 3 - │ TableID: 104 - │ - ├── • MakeIndexAbsent - │ IndexID: 3 - │ TableID: 104 + └── • 5 Mutation operations │ ├── • CreateGcJobForIndex │ IndexID: 1 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_1_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_1_of_7 index ce4153389618..245daf91aed5 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_1_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_1_of_7 @@ -23,7 +23,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ │ rule: "dependents removed before index" │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ DELETE_ONLY → ABSENT @@ -32,17 +35,34 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ │ rule: "dependents removed before index" │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ PUBLIC → ABSENT + │ │ PUBLIC → ABSENT + │ │ + │ └── • skip PUBLIC → ABSENT operations + │ rule: "skip index-column removal ops on index removal" │ ├── • 2 elements transitioning toward PUBLIC │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ WRITE_ONLY → PUBLIC + │ │ │ WRITE_ONLY → PUBLIC + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ rule: "column dependents exist before column becomes public" │ │ │ └── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ ABSENT → PUBLIC │ - └── • 11 Mutation operations + └── • 9 Mutation operations + │ + ├── • SetColumnName + │ ColumnID: 2 + │ Name: j + │ TableID: 104 │ ├── • MakeColumnPublic │ ColumnID: 2 @@ -59,21 +79,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; ├── • RefreshStats │ TableID: 104 │ - ├── • SetColumnName - │ ColumnID: 2 - │ Name: j - │ TableID: 104 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 1 - │ IndexID: 2 - │ TableID: 104 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 1 - │ IndexID: 3 - │ TableID: 104 - │ ├── • CreateGcJobForIndex │ IndexID: 2 │ StatementForDropJob: diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_2_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_2_of_7 index e0f750ab30d4..aa29a0e6d909 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_2_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_2_of_7 @@ -23,23 +23,47 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 2 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ └── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 10 Mutation operations + │ └── • 8 Mutation operations + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 2 + │ │ Name: j + │ │ TableID: 104 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 3 + │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 2 @@ -56,25 +80,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 2 - │ │ Name: j - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ │ ├── • CreateGcJobForIndex │ │ IndexID: 2 │ │ StatementForDropJob: diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_3_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_3_of_7 index 1fb856f15d5e..5e9f38bdcc55 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_3_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_3_of_7 @@ -23,23 +23,47 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 2 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ └── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 10 Mutation operations + │ └── • 8 Mutation operations + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 2 + │ │ Name: j + │ │ TableID: 104 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 3 + │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 2 @@ -56,25 +80,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 2 - │ │ Name: j - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ │ ├── • CreateGcJobForIndex │ │ IndexID: 2 │ │ StatementForDropJob: diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_4_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_4_of_7 index 26988814c111..9181618deb1b 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_4_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_4_of_7 @@ -23,23 +23,47 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 2 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ └── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 10 Mutation operations + │ └── • 8 Mutation operations + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 2 + │ │ Name: j + │ │ TableID: 104 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 3 + │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 2 @@ -56,25 +80,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 2 - │ │ Name: j - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ │ ├── • CreateGcJobForIndex │ │ IndexID: 2 │ │ StatementForDropJob: diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_5_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_5_of_7 index 408f57e43996..c0c32aa8f125 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_5_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_5_of_7 @@ -17,23 +17,47 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ │ MERGE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 2 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ └── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 9 Mutation operations + │ └── • 7 Mutation operations + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 2 + │ │ Name: j + │ │ TableID: 104 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 3 + │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 2 @@ -50,25 +74,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 2 - │ │ Name: j - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_6_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_6_of_7 index 7911f9e062ca..c0998e2e2a28 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_6_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_6_of_7 @@ -17,23 +17,47 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ │ MERGE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 2 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ └── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 9 Mutation operations + │ └── • 7 Mutation operations + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 2 + │ │ Name: j + │ │ TableID: 104 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 3 + │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 2 @@ -50,25 +74,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 2 - │ │ Name: j - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_7_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_7_of_7 index d28b4ab0716f..051c4fb737e7 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_7_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_basic.rollback_7_of_7 @@ -17,38 +17,38 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 2 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ └── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 9 Mutation operations - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 2 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 + │ └── • 7 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 2 @@ -59,18 +59,23 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ IndexID: 2 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 + │ ├── • MakeColumnPublic + │ │ ColumnID: 2 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TableID: 104 + │ │ + │ ├── • RefreshStats │ │ TableID: 104 │ │ │ ├── • SetJobStateOnDescriptor diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index index 1a9ec05ec55a..997dc3ebe4d4 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index @@ -19,16 +19,19 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 2} -│ │ │ rule: "column dependents removed after column no longer public" +│ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 3} -│ │ │ PUBLIC → WRITE_ONLY +│ │ │ │ PUBLIC → WRITE_ONLY +│ │ │ │ +│ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} +│ │ │ rule: "secondary indexes containing column as key reach write-only before column" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 3} -│ │ │ rule: "column dependents removed after column no longer public" +│ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ PUBLIC → VALIDATED @@ -37,30 +40,29 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ rule: "index no longer public before dependents removed" +│ │ rule: "index no longer public before dependents" │ │ -│ ├── • 3 elements transitioning toward PUBLIC +│ ├── • 2 elements transitioning toward PUBLIC │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ ABSENT → BACKFILL_ONLY │ │ │ -│ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} -│ │ │ │ ABSENT → PUBLIC -│ │ │ │ -│ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" +│ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} +│ │ │ ABSENT → PUBLIC +│ │ │ +│ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} +│ │ rule: "index existence precedes index dependents" +│ │ +│ ├── • 2 elements transitioning toward TRANSIENT_ABSENT +│ │ │ +│ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} +│ │ │ ABSENT → DELETE_ONLY │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} │ │ │ ABSENT → PUBLIC │ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} -│ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ rule: "index-column added to index after temp index exists" -│ │ -│ ├── • 1 element transitioning toward TRANSIENT_ABSENT -│ │ │ -│ │ └── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} -│ │ ABSENT → DELETE_ONLY +│ │ rule: "temp index existence precedes index dependents" │ │ │ └── • 12 Mutation operations │ │ @@ -89,32 +91,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ Name: crdb_internal_column_2_name_placeholder │ │ TableID: 104 │ │ -│ ├── • MakeDroppedColumnDeleteAndWriteOnly -│ │ ColumnID: 3 -│ │ TableID: 104 -│ │ -│ ├── • LogEvent -│ │ Element: -│ │ Column: -│ │ columnId: 3 -│ │ isInaccessible: true -│ │ pgAttributeNum: 3 -│ │ tableId: 104 -│ │ EventBase: -│ │ Authorization: -│ │ UserName: root -│ │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE -│ │ StatementTag: ALTER TABLE -│ │ TargetMetadata: -│ │ SourceElementID: 1 -│ │ SubWorkID: 1 -│ │ TargetStatus: 1 -│ │ -│ ├── • SetColumnName -│ │ ColumnID: 3 -│ │ Name: crdb_internal_column_3_name_placeholder -│ │ TableID: 104 -│ │ │ ├── • MakeDroppedNonPrimaryIndexDeleteAndWriteOnly │ │ IndexID: 2 │ │ TableID: 104 @@ -146,9 +122,35 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ SourceIndexID: 1 │ │ TableID: 104 │ │ -│ └── • AddColumnToIndex -│ ColumnID: 1 -│ IndexID: 4 +│ ├── • AddColumnToIndex +│ │ ColumnID: 1 +│ │ IndexID: 4 +│ │ TableID: 104 +│ │ +│ ├── • MakeDroppedColumnDeleteAndWriteOnly +│ │ ColumnID: 3 +│ │ TableID: 104 +│ │ +│ ├── • LogEvent +│ │ Element: +│ │ Column: +│ │ columnId: 3 +│ │ isInaccessible: true +│ │ pgAttributeNum: 3 +│ │ tableId: 104 +│ │ EventBase: +│ │ Authorization: +│ │ UserName: root +│ │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE +│ │ StatementTag: ALTER TABLE +│ │ TargetMetadata: +│ │ SourceElementID: 1 +│ │ SubWorkID: 1 +│ │ TargetStatus: 1 +│ │ +│ └── • SetColumnName +│ ColumnID: 3 +│ Name: crdb_internal_column_3_name_placeholder │ TableID: 104 │ ├── • PreCommitPhase @@ -320,14 +322,23 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ PUBLIC → WRITE_ONLY @@ -336,25 +347,28 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 3} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ VALIDATED → DELETE_ONLY @@ -367,21 +381,31 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ ├── • SameStagePrecedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ │ rule: "primary index swap" │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 3} - │ │ │ rule: "index named right before index becomes public" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 3} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ rule: "index named right before index becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_pkey, IndexID: 3} │ │ │ ABSENT → PUBLIC │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ rule: "index existence precedes index name and comment" + │ │ rule: "index existence precedes index dependents" │ │ - │ ├── • 1 element transitioning toward TRANSIENT_ABSENT + │ ├── • 2 elements transitioning toward TRANSIENT_ABSENT │ │ │ - │ │ └── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ │ WRITE_ONLY → TRANSIENT_DELETE_ONLY + │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} + │ │ │ WRITE_ONLY → TRANSIENT_DELETE_ONLY + │ │ │ + │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} + │ │ │ PUBLIC → TRANSIENT_ABSENT + │ │ │ + │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 14 Mutation operations + │ └── • 10 Mutation operations │ │ │ ├── • MakeDroppedColumnDeleteOnly │ │ ColumnID: 2 @@ -409,17 +433,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 1 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 @@ -436,49 +449,125 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 1 MutationType op pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 7 MutationType ops pending │ ├── • Stage 2 of 3 in PostCommitNonRevertiblePhase │ │ - │ ├── • 1 element transitioning toward ABSENT + │ ├── • 4 elements transitioning toward ABSENT + │ │ │ + │ │ ├── • Column:{DescID: 104, ColumnID: 3} + │ │ │ │ DELETE_ONLY → ABSENT + │ │ │ │ + │ │ │ ├── • Precedence dependency from ABSENT ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} + │ │ │ │ rule: "dependents removed before column" + │ │ │ │ + │ │ │ ├── • SameStagePrecedence dependency from ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ │ rule: "dependents removed before column" + │ │ │ │ rule: "column type removed right before column when not dropping relation" + │ │ │ │ + │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "dependents removed before column" + │ │ │ │ + │ │ │ └── • Precedence dependency from ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "indexes containing column reach absent before column" + │ │ │ + │ │ ├── • ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 3} + │ │ │ rule: "column no longer public before dependents" + │ │ │ + │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ WRITE_ONLY → DELETE_ONLY + │ │ │ + │ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ DELETE_ONLY → ABSENT + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ rule: "dependents removed before index" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ rule: "dependents removed before index" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} + │ │ rule: "dependents removed before index" + │ │ + │ ├── • 1 element transitioning toward TRANSIENT_ABSENT │ │ │ - │ │ └── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ WRITE_ONLY → DELETE_ONLY + │ │ └── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} + │ │ │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT + │ │ │ + │ │ └── • Precedence dependency from TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} + │ │ rule: "dependents removed before index" │ │ - │ └── • 3 Mutation operations + │ └── • 9 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 1 │ │ TableID: 104 │ │ + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ tableId: 104 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TargetStatus: 1 + │ │ + │ ├── • CreateGcJobForIndex + │ │ IndexID: 2 + │ │ StatementForDropJob: + │ │ Statement: ALTER TABLE defaultdb.public.t DROP COLUMN j CASCADE + │ │ TableID: 104 + │ │ + │ ├── • MakeIndexAbsent + │ │ IndexID: 2 + │ │ TableID: 104 + │ │ + │ ├── • CreateGcJobForIndex + │ │ IndexID: 4 + │ │ TableID: 104 + │ │ + │ ├── • MakeIndexAbsent + │ │ IndexID: 4 + │ │ TableID: 104 + │ │ + │ ├── • MakeColumnAbsent + │ │ ColumnID: 3 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TableID: 104 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 3 of 3 with 9 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 3 of 3 with 3 MutationType ops pending │ └── • Stage 3 of 3 in PostCommitNonRevertiblePhase │ - ├── • 6 elements transitioning toward ABSENT + ├── • 3 elements transitioning toward ABSENT │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ DELETE_ONLY → ABSENT @@ -490,80 +579,31 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ rule: "dependents removed before column" + │ │ │ │ │ └── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ rule: "indexes containing columns reach absent before column" + │ │ rule: "indexes containing column reach absent before column" │ │ │ ├── • ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 2} - │ │ rule: "column dependents removed after column no longer public" - │ │ - │ ├── • Column:{DescID: 104, ColumnID: 3} - │ │ │ DELETE_ONLY → ABSENT - │ │ │ - │ │ ├── • Precedence dependency from ABSENT ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} - │ │ │ rule: "dependents removed before column" - │ │ │ - │ │ ├── • SameStagePrecedence dependency from ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} - │ │ │ rule: "dependents removed before column" - │ │ │ rule: "column type removed right before column when not dropping relation" - │ │ │ - │ │ └── • Precedence dependency from ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ rule: "indexes containing columns reach absent before column" - │ │ - │ ├── • ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} - │ │ │ PUBLIC → ABSENT - │ │ │ - │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 3} - │ │ rule: "column dependents removed after column no longer public" + │ │ rule: "column no longer public before dependents" │ │ - │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ DELETE_ONLY → ABSENT - │ │ │ - │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} - │ │ │ rule: "dependents removed before index" - │ │ │ - │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} - │ │ │ rule: "dependents removed before index" - │ │ │ - │ │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} - │ │ │ rule: "dependents removed before index" - │ │ │ - │ │ └── • SameStagePrecedence dependency from TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ │ rule: "temp indexes reach absent at the same time as other indexes" - │ │ - │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ └── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ DELETE_ONLY → ABSENT │ │ - │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" - │ │ rule: "dependents removed before index" - │ │ - │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" + │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} │ │ rule: "dependents removed before index" │ │ - │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} + │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} │ │ rule: "dependents removed before index" │ │ - │ └── • SameStagePrecedence dependency from TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ rule: "temp indexes reach absent at the same time as other indexes" + │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} + │ rule: "dependents removed before index" │ - ├── • 1 element transitioning toward TRANSIENT_ABSENT - │ │ - │ └── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT - │ - └── • 11 Mutation operations - │ - ├── • CreateGcJobForIndex - │ IndexID: 4 - │ TableID: 104 - │ - ├── • MakeIndexAbsent - │ IndexID: 4 - │ TableID: 104 + └── • 5 Mutation operations │ ├── • CreateGcJobForIndex │ IndexID: 1 @@ -583,31 +623,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ IndexID: 1 │ TableID: 104 │ - ├── • LogEvent - │ Element: - │ SecondaryIndex: - │ indexId: 2 - │ tableId: 104 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE - │ StatementTag: ALTER TABLE - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TargetStatus: 1 - │ - ├── • CreateGcJobForIndex - │ IndexID: 2 - │ StatementForDropJob: - │ Statement: ALTER TABLE defaultdb.public.t DROP COLUMN j CASCADE - │ TableID: 104 - │ - ├── • MakeIndexAbsent - │ IndexID: 2 - │ TableID: 104 - │ ├── • MakeColumnAbsent │ ColumnID: 2 │ EventBase: @@ -620,18 +635,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ SubWorkID: 1 │ TableID: 104 │ - ├── • MakeColumnAbsent - │ ColumnID: 3 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE - │ StatementTag: ALTER TABLE - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TableID: 104 - │ ├── • RemoveJobStateFromDescriptor │ DescriptorID: 104 │ JobID: 1 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_1_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_1_of_7 index 44a5d865d574..bde234b00922 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_1_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_1_of_7 @@ -23,7 +23,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ │ rule: "dependents removed before index" │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ │ DELETE_ONLY → ABSENT @@ -32,12 +35,24 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ │ rule: "dependents removed before index" │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ PUBLIC → ABSENT + │ │ PUBLIC → ABSENT + │ │ + │ └── • skip PUBLIC → ABSENT operations + │ rule: "skip index-column removal ops on index removal" │ ├── • 6 elements transitioning toward PUBLIC │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ WRITE_ONLY → PUBLIC + │ │ │ WRITE_ONLY → PUBLIC + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ rule: "column dependents exist before column becomes public" │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ABSENT → PUBLIC @@ -45,8 +60,17 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ WRITE_ONLY → PUBLIC │ │ │ - │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ rule: "ensure columns are in increasing order" + │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ rule: "ensure columns are in increasing order" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ rule: "column dependents exist before column becomes public" │ │ │ ├── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ ABSENT → PUBLIC @@ -54,13 +78,35 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ VALIDATED → PUBLIC │ │ │ + │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} + │ │ rule: "index dependents exist before index becomes public" │ │ rule: "index named right before index becomes public" │ │ │ └── • IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} │ ABSENT → PUBLIC │ - └── • 16 Mutation operations + └── • 14 Mutation operations + │ + ├── • SetColumnName + │ ColumnID: 2 + │ Name: j + │ TableID: 104 + │ + ├── • SetColumnName + │ ColumnID: 3 + │ Name: crdb_internal_idx_expr + │ TableID: 104 + │ + ├── • SetIndexName + │ IndexID: 2 + │ Name: t_expr_idx + │ TableID: 104 │ ├── • MakeColumnPublic │ ColumnID: 2 @@ -77,11 +123,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; ├── • RefreshStats │ TableID: 104 │ - ├── • SetColumnName - │ ColumnID: 2 - │ Name: j - │ TableID: 104 - │ ├── • MakeColumnPublic │ ColumnID: 3 │ EventBase: @@ -97,26 +138,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; ├── • RefreshStats │ TableID: 104 │ - ├── • SetColumnName - │ ColumnID: 3 - │ Name: crdb_internal_idx_expr - │ TableID: 104 - │ - ├── • SetIndexName - │ IndexID: 2 - │ Name: t_expr_idx - │ TableID: 104 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 1 - │ IndexID: 3 - │ TableID: 104 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 1 - │ IndexID: 4 - │ TableID: 104 - │ ├── • MakeAddedSecondaryIndexPublic │ IndexID: 2 │ TableID: 104 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_2_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_2_of_7 index e3c8121a3e7e..4c0bf9dbbce7 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_2_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_2_of_7 @@ -23,18 +23,33 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 6 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ │ ABSENT → PUBLIC @@ -42,8 +57,17 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ │ ABSENT → PUBLIC @@ -51,13 +75,39 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 15 Mutation operations + │ └── • 13 Mutation operations + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 2 + │ │ Name: j + │ │ TableID: 104 + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 3 + │ │ Name: crdb_internal_idx_expr + │ │ TableID: 104 + │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: t_expr_idx + │ │ TableID: 104 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 4 + │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 2 @@ -74,11 +124,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 2 - │ │ Name: j - │ │ TableID: 104 - │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 3 │ │ EventBase: @@ -94,30 +139,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 3 - │ │ Name: crdb_internal_idx_expr - │ │ TableID: 104 - │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_idx - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ │ ├── • MakeAddedSecondaryIndexPublic │ │ IndexID: 2 │ │ TableID: 104 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_3_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_3_of_7 index 92a07179a31b..ff0b9d0fad27 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_3_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_3_of_7 @@ -23,18 +23,33 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 6 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ │ ABSENT → PUBLIC @@ -42,8 +57,17 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ │ ABSENT → PUBLIC @@ -51,13 +75,39 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 15 Mutation operations + │ └── • 13 Mutation operations + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 2 + │ │ Name: j + │ │ TableID: 104 + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 3 + │ │ Name: crdb_internal_idx_expr + │ │ TableID: 104 + │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: t_expr_idx + │ │ TableID: 104 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 4 + │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 2 @@ -74,11 +124,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 2 - │ │ Name: j - │ │ TableID: 104 - │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 3 │ │ EventBase: @@ -94,30 +139,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 3 - │ │ Name: crdb_internal_idx_expr - │ │ TableID: 104 - │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_idx - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ │ ├── • MakeAddedSecondaryIndexPublic │ │ IndexID: 2 │ │ TableID: 104 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_4_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_4_of_7 index 5c752366b74a..aaebf618a796 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_4_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_4_of_7 @@ -23,18 +23,33 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 6 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ │ ABSENT → PUBLIC @@ -42,8 +57,17 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ │ ABSENT → PUBLIC @@ -51,13 +75,39 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 15 Mutation operations + │ └── • 13 Mutation operations + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 2 + │ │ Name: j + │ │ TableID: 104 + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 3 + │ │ Name: crdb_internal_idx_expr + │ │ TableID: 104 + │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: t_expr_idx + │ │ TableID: 104 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 4 + │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 2 @@ -74,11 +124,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 2 - │ │ Name: j - │ │ TableID: 104 - │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 3 │ │ EventBase: @@ -94,30 +139,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 3 - │ │ Name: crdb_internal_idx_expr - │ │ TableID: 104 - │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_idx - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ │ ├── • MakeAddedSecondaryIndexPublic │ │ IndexID: 2 │ │ TableID: 104 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_5_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_5_of_7 index b4d07242f254..f8dbece8de40 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_5_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_5_of_7 @@ -17,18 +17,33 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ │ MERGE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 6 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ │ ABSENT → PUBLIC @@ -36,8 +51,17 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ │ ABSENT → PUBLIC @@ -45,13 +69,39 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 14 Mutation operations + │ └── • 12 Mutation operations + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 2 + │ │ Name: j + │ │ TableID: 104 + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 3 + │ │ Name: crdb_internal_idx_expr + │ │ TableID: 104 + │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: t_expr_idx + │ │ TableID: 104 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 4 + │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 2 @@ -68,11 +118,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 2 - │ │ Name: j - │ │ TableID: 104 - │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 3 │ │ EventBase: @@ -88,30 +133,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 3 - │ │ Name: crdb_internal_idx_expr - │ │ TableID: 104 - │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_idx - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ │ ├── • MakeAddedSecondaryIndexPublic │ │ IndexID: 2 │ │ TableID: 104 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_6_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_6_of_7 index 321b2d304be4..93c0e45a0a2d 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_6_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_6_of_7 @@ -17,18 +17,33 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ │ MERGE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 6 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ │ ABSENT → PUBLIC @@ -36,8 +51,17 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ │ ABSENT → PUBLIC @@ -45,13 +69,39 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 14 Mutation operations + │ └── • 12 Mutation operations + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 2 + │ │ Name: j + │ │ TableID: 104 + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 3 + │ │ Name: crdb_internal_idx_expr + │ │ TableID: 104 + │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: t_expr_idx + │ │ TableID: 104 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 4 + │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 2 @@ -68,11 +118,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 2 - │ │ Name: j - │ │ TableID: 104 - │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 3 │ │ EventBase: @@ -88,30 +133,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 3 - │ │ Name: crdb_internal_idx_expr - │ │ TableID: 104 - │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_idx - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ │ ├── • MakeAddedSecondaryIndexPublic │ │ IndexID: 2 │ │ TableID: 104 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_7_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_7_of_7 index 0ff4ee165299..abc74e749ce7 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_7_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index.rollback_7_of_7 @@ -17,18 +17,33 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 6 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ │ ABSENT → PUBLIC @@ -36,8 +51,17 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ │ ABSENT → PUBLIC @@ -45,13 +69,43 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 14 Mutation operations + │ └── • 12 Mutation operations + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 2 + │ │ Name: j + │ │ TableID: 104 + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 3 + │ │ Name: crdb_internal_idx_expr + │ │ TableID: 104 + │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: t_expr_idx + │ │ TableID: 104 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 3 + │ │ TableID: 104 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 4 + │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 2 @@ -68,11 +122,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 2 - │ │ Name: j - │ │ TableID: 104 - │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 3 │ │ EventBase: @@ -88,34 +137,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 3 - │ │ Name: crdb_internal_idx_expr - │ │ TableID: 104 - │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_idx - │ │ TableID: 104 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ │ ├── • MakeAddedSecondaryIndexPublic │ │ IndexID: 2 │ │ TableID: 104 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_10_of_15 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_10_of_15 index 264f031c2f60..f05213ca9cc3 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_10_of_15 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_10_of_15 @@ -17,20 +17,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 10 of 15; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ PUBLIC → WRITE_ONLY @@ -39,7 +51,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 10 of 15; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY @@ -47,24 +59,22 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 10 of 15; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 5} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} │ │ │ │ BACKFILL_ONLY → ABSENT │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 5} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: idx, IndexID: 5} @@ -74,26 +84,60 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 10 of 15; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 6} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 8 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ ├── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" │ │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} @@ -105,7 +149,17 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 10 of 15; │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} @@ -117,54 +171,13 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 10 of 15; │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 27 Mutation operations - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 2 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 4 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 + │ └── • 19 Mutation operations │ │ │ ├── • SetIndexName │ │ IndexID: 1 │ │ Name: t_pkey │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 4 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -197,18 +210,8 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 10 of 15; │ │ IndexID: 6 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 6 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 6 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ - │ ├── • MakeAddedPrimaryIndexPublic + │ ├── • MakeColumnPublic + │ │ ColumnID: 2 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -217,33 +220,40 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 10 of 15; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ IndexID: 1 │ │ TableID: 104 │ │ - │ ├── • MakeAddedSecondaryIndexPublic - │ │ IndexID: 2 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 + │ ├── • MakeColumnPublic + │ │ ColumnID: 4 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 3 - │ │ Kind: 2 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 5 + │ ├── • MakeAddedPrimaryIndexPublic + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ IndexID: 1 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 5 - │ │ Kind: 1 + │ ├── • MakeAddedSecondaryIndexPublic + │ │ IndexID: 2 │ │ TableID: 104 │ │ │ ├── • LogEvent diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_11_of_15 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_11_of_15 index 73eb7909bcb5..d8bf9dc7912e 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_11_of_15 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_11_of_15 @@ -17,20 +17,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 11 of 15; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ PUBLIC → WRITE_ONLY @@ -39,7 +51,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 11 of 15; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY @@ -47,24 +59,22 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 11 of 15; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 5} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} │ │ │ │ BACKFILL_ONLY → ABSENT │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 5} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: idx, IndexID: 5} @@ -74,26 +84,60 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 11 of 15; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 6} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 8 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ ├── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" │ │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} @@ -105,7 +149,17 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 11 of 15; │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} @@ -117,54 +171,13 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 11 of 15; │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 27 Mutation operations - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 2 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 4 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 + │ └── • 19 Mutation operations │ │ │ ├── • SetIndexName │ │ IndexID: 1 │ │ Name: t_pkey │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 4 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -197,18 +210,8 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 11 of 15; │ │ IndexID: 6 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 6 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 6 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ - │ ├── • MakeAddedPrimaryIndexPublic + │ ├── • MakeColumnPublic + │ │ ColumnID: 2 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -217,33 +220,40 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 11 of 15; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ IndexID: 1 │ │ TableID: 104 │ │ - │ ├── • MakeAddedSecondaryIndexPublic - │ │ IndexID: 2 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 + │ ├── • MakeColumnPublic + │ │ ColumnID: 4 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 3 - │ │ Kind: 2 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 5 + │ ├── • MakeAddedPrimaryIndexPublic + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ IndexID: 1 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 5 - │ │ Kind: 1 + │ ├── • MakeAddedSecondaryIndexPublic + │ │ IndexID: 2 │ │ TableID: 104 │ │ │ ├── • LogEvent diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_12_of_15 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_12_of_15 index 9190a7c8d0a9..5aefa606e47b 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_12_of_15 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_12_of_15 @@ -17,20 +17,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 12 of 15; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ PUBLIC → WRITE_ONLY @@ -39,7 +51,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 12 of 15; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY @@ -47,24 +59,22 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 12 of 15; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 5} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} │ │ │ │ DELETE_ONLY → ABSENT │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 5} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: idx, IndexID: 5} @@ -74,26 +84,60 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 12 of 15; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 6} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 8 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ ├── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" │ │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} @@ -105,7 +149,17 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 12 of 15; │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} @@ -117,54 +171,13 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 12 of 15; │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 27 Mutation operations - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 2 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 4 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 + │ └── • 19 Mutation operations │ │ │ ├── • SetIndexName │ │ IndexID: 1 │ │ Name: t_pkey │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 4 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -193,17 +206,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 12 of 15; │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 5 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 5 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ │ ├── • LogEvent │ │ Element: │ │ SecondaryIndex: @@ -240,18 +242,23 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 12 of 15; │ │ IndexID: 6 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 6 + │ ├── • MakeColumnPublic + │ │ ColumnID: 2 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 6 - │ │ Kind: 1 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • MakeAddedPrimaryIndexPublic + │ ├── • MakeColumnPublic + │ │ ColumnID: 4 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -260,22 +267,25 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 12 of 15; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ IndexID: 1 │ │ TableID: 104 │ │ - │ ├── • MakeAddedSecondaryIndexPublic - │ │ IndexID: 2 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 + │ ├── • MakeAddedPrimaryIndexPublic + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ IndexID: 1 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 3 - │ │ Kind: 2 + │ ├── • MakeAddedSecondaryIndexPublic + │ │ IndexID: 2 │ │ TableID: 104 │ │ │ ├── • SetJobStateOnDescriptor diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_13_of_15 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_13_of_15 index c80ada11802c..5cd1f482e48f 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_13_of_15 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_13_of_15 @@ -17,20 +17,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ PUBLIC → WRITE_ONLY @@ -39,7 +51,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY @@ -47,14 +59,14 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 5} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} │ │ │ MERGE_ONLY → DELETE_ONLY @@ -63,26 +75,60 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 6} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 8 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ ├── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" │ │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} @@ -94,7 +140,17 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} @@ -106,54 +162,13 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 25 Mutation operations - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 2 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 4 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 + │ └── • 17 Mutation operations │ │ │ ├── • SetIndexName │ │ IndexID: 1 │ │ Name: t_pkey │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 4 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -186,18 +201,23 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ │ IndexID: 6 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 6 + │ ├── • MakeColumnPublic + │ │ ColumnID: 2 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 6 - │ │ Kind: 1 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • MakeAddedPrimaryIndexPublic + │ ├── • MakeColumnPublic + │ │ ColumnID: 4 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -206,39 +226,31 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ IndexID: 1 │ │ TableID: 104 │ │ - │ ├── • MakeAddedSecondaryIndexPublic - │ │ IndexID: 2 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 + │ ├── • MakeAddedPrimaryIndexPublic + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ IndexID: 1 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 3 - │ │ Kind: 2 + │ ├── • MakeAddedSecondaryIndexPublic + │ │ IndexID: 2 │ │ TableID: 104 │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 5 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 5 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 5 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ @@ -267,11 +279,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ │ │ │ DELETE_ONLY → ABSENT │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 5} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: idx, IndexID: 5} diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_14_of_15 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_14_of_15 index 37f5ca1cccd6..07fcbfe44afe 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_14_of_15 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_14_of_15 @@ -17,20 +17,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ PUBLIC → WRITE_ONLY @@ -39,7 +51,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY @@ -47,14 +59,14 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 5} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} │ │ │ MERGE_ONLY → DELETE_ONLY @@ -63,26 +75,60 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 6} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 8 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ ├── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" │ │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} @@ -94,7 +140,17 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} @@ -106,54 +162,13 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 25 Mutation operations - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 2 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 4 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 + │ └── • 17 Mutation operations │ │ │ ├── • SetIndexName │ │ IndexID: 1 │ │ Name: t_pkey │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 4 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -186,18 +201,23 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ │ IndexID: 6 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 6 + │ ├── • MakeColumnPublic + │ │ ColumnID: 2 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 6 - │ │ Kind: 1 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • MakeAddedPrimaryIndexPublic + │ ├── • MakeColumnPublic + │ │ ColumnID: 4 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -206,39 +226,31 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ IndexID: 1 │ │ TableID: 104 │ │ - │ ├── • MakeAddedSecondaryIndexPublic - │ │ IndexID: 2 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 + │ ├── • MakeAddedPrimaryIndexPublic + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ IndexID: 1 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 3 - │ │ Kind: 2 + │ ├── • MakeAddedSecondaryIndexPublic + │ │ IndexID: 2 │ │ TableID: 104 │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 5 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 5 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 5 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ @@ -267,11 +279,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ │ │ │ DELETE_ONLY → ABSENT │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 5} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: idx, IndexID: 5} diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_15_of_15 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_15_of_15 index d2fbdd7c574f..31fd31cda1e1 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_15_of_15 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_15_of_15 @@ -17,20 +17,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 15 of 15; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ PUBLIC → WRITE_ONLY @@ -39,7 +51,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 15 of 15; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY @@ -47,14 +59,14 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 15 of 15; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 5} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} │ │ │ WRITE_ONLY → DELETE_ONLY @@ -63,26 +75,60 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 15 of 15; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 6} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 8 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ ├── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" │ │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} @@ -94,7 +140,17 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 15 of 15; │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} @@ -106,54 +162,13 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 15 of 15; │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 25 Mutation operations - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 2 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 4 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 + │ └── • 17 Mutation operations │ │ │ ├── • SetIndexName │ │ IndexID: 1 │ │ Name: t_pkey │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 4 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -190,18 +205,8 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 15 of 15; │ │ IndexID: 6 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 6 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 6 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ - │ ├── • MakeAddedPrimaryIndexPublic + │ ├── • MakeColumnPublic + │ │ ColumnID: 2 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -210,33 +215,40 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 15 of 15; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ IndexID: 1 │ │ TableID: 104 │ │ - │ ├── • MakeAddedSecondaryIndexPublic - │ │ IndexID: 2 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 + │ ├── • MakeColumnPublic + │ │ ColumnID: 4 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 3 - │ │ Kind: 2 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 5 + │ ├── • MakeAddedPrimaryIndexPublic + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ IndexID: 1 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 5 - │ │ Kind: 1 + │ ├── • MakeAddedSecondaryIndexPublic + │ │ IndexID: 2 │ │ TableID: 104 │ │ │ ├── • SetJobStateOnDescriptor @@ -267,11 +279,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 15 of 15; │ │ │ │ DELETE_ONLY → ABSENT │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 5} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: idx, IndexID: 5} diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_1_of_15 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_1_of_15 index 67bcf9ce4c0e..00caae4639f3 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_1_of_15 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_1_of_15 @@ -15,16 +15,28 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 15; ├── • 6 elements transitioning toward ABSENT │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ BACKFILL_ONLY → ABSENT @@ -50,18 +62,46 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 15; ├── • 6 elements transitioning toward PUBLIC │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ WRITE_ONLY → PUBLIC + │ │ │ WRITE_ONLY → PUBLIC + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ rule: "column dependents exist before column becomes public" │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ WRITE_ONLY → PUBLIC │ │ │ - │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ rule: "ensure columns are in increasing order" + │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ rule: "ensure columns are in increasing order" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ rule: "column dependents exist before column becomes public" │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ VALIDATED → PUBLIC │ │ │ + │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ rule: "index dependents exist before index becomes public" │ │ rule: "index named right before index becomes public" │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} @@ -73,7 +113,30 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 15; │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ ABSENT → PUBLIC │ - └── • 18 Mutation operations + └── • 14 Mutation operations + │ + ├── • SetColumnName + │ ColumnID: 2 + │ Name: j + │ TableID: 104 + │ + ├── • SetColumnName + │ ColumnID: 4 + │ Name: crdb_internal_idx_expr + │ TableID: 104 + │ + ├── • SetIndexName + │ IndexID: 2 + │ Name: t_expr_k_idx + │ TableID: 104 + │ + ├── • CreateGcJobForIndex + │ IndexID: 4 + │ TableID: 104 + │ + ├── • MakeIndexAbsent + │ IndexID: 4 + │ TableID: 104 │ ├── • MakeColumnPublic │ ColumnID: 2 @@ -105,51 +168,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 15; ├── • 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 - │ - ├── • SetColumnName - │ ColumnID: 2 - │ Name: j - │ TableID: 104 - │ - ├── • SetColumnName - │ ColumnID: 4 - │ Name: crdb_internal_idx_expr - │ TableID: 104 - │ - ├── • SetIndexName - │ IndexID: 2 - │ Name: t_expr_k_idx - │ TableID: 104 - │ - ├── • CreateGcJobForIndex - │ IndexID: 4 - │ TableID: 104 - │ - ├── • MakeIndexAbsent - │ IndexID: 4 - │ TableID: 104 - │ ├── • MakeAddedSecondaryIndexPublic │ IndexID: 2 │ TableID: 104 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_2_of_15 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_2_of_15 index 11e649928b2a..9341293d4412 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_2_of_15 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_2_of_15 @@ -15,16 +15,28 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 15; │ ├── • 6 elements transitioning toward ABSENT │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ │ BACKFILL_ONLY → ABSENT @@ -44,18 +56,46 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 15; │ ├── • 6 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} @@ -67,7 +107,26 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 15; │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 17 Mutation operations + │ └── • 13 Mutation operations + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 2 + │ │ Name: j + │ │ TableID: 104 + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 4 + │ │ Name: crdb_internal_idx_expr + │ │ TableID: 104 + │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: t_expr_k_idx + │ │ TableID: 104 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 4 + │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 2 @@ -99,47 +158,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 15; │ ├── • 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 - │ │ - │ ├── • SetColumnName - │ │ ColumnID: 2 - │ │ Name: j - │ │ TableID: 104 - │ │ - │ ├── • SetColumnName - │ │ ColumnID: 4 - │ │ Name: crdb_internal_idx_expr - │ │ TableID: 104 - │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ │ ├── • MakeAddedSecondaryIndexPublic │ │ IndexID: 2 │ │ TableID: 104 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_3_of_15 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_3_of_15 index b54cc72db84d..16274a9e8a14 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_3_of_15 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_3_of_15 @@ -15,16 +15,28 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 15; │ ├── • 6 elements transitioning toward ABSENT │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ │ BACKFILL_ONLY → ABSENT @@ -44,18 +56,46 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 15; │ ├── • 6 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} @@ -67,7 +107,26 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 15; │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 17 Mutation operations + │ └── • 13 Mutation operations + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 2 + │ │ Name: j + │ │ TableID: 104 + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 4 + │ │ Name: crdb_internal_idx_expr + │ │ TableID: 104 + │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: t_expr_k_idx + │ │ TableID: 104 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 4 + │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 2 @@ -99,47 +158,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 15; │ ├── • 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 - │ │ - │ ├── • SetColumnName - │ │ ColumnID: 2 - │ │ Name: j - │ │ TableID: 104 - │ │ - │ ├── • SetColumnName - │ │ ColumnID: 4 - │ │ Name: crdb_internal_idx_expr - │ │ TableID: 104 - │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ │ ├── • MakeAddedSecondaryIndexPublic │ │ IndexID: 2 │ │ TableID: 104 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_4_of_15 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_4_of_15 index fb15f940fc91..9d1dddf77714 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_4_of_15 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_4_of_15 @@ -15,16 +15,28 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 15; │ ├── • 6 elements transitioning toward ABSENT │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ │ DELETE_ONLY → ABSENT @@ -44,18 +56,46 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 15; │ ├── • 6 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} @@ -67,10 +107,31 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 15; │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 17 Mutation operations + │ └── • 13 Mutation operations │ │ - │ ├── • MakeColumnPublic + │ ├── • SetColumnName │ │ ColumnID: 2 + │ │ Name: j + │ │ TableID: 104 + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 4 + │ │ Name: crdb_internal_idx_expr + │ │ TableID: 104 + │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: t_expr_k_idx + │ │ TableID: 104 + │ │ + │ ├── • CreateGcJobForIndex + │ │ IndexID: 3 + │ │ StatementForDropJob: + │ │ Rollback: true + │ │ Statement: ALTER TABLE defaultdb.public.t DROP COLUMN j CASCADE + │ │ TableID: 104 + │ │ + │ ├── • MakeIndexAbsent │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -79,13 +140,15 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 15; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 + │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • RefreshStats + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 4 │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic - │ │ ColumnID: 4 + │ │ ColumnID: 2 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -99,51 +162,8 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 15; │ ├── • 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 - │ │ - │ ├── • SetColumnName - │ │ ColumnID: 2 - │ │ Name: j - │ │ TableID: 104 - │ │ - │ ├── • SetColumnName + │ ├── • MakeColumnPublic │ │ ColumnID: 4 - │ │ Name: crdb_internal_idx_expr - │ │ TableID: 104 - │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ - │ ├── • CreateGcJobForIndex - │ │ IndexID: 3 - │ │ StatementForDropJob: - │ │ Rollback: true - │ │ Statement: ALTER TABLE defaultdb.public.t DROP COLUMN j CASCADE - │ │ TableID: 104 - │ │ - │ ├── • MakeIndexAbsent │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -152,11 +172,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 15; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 4 + │ ├── • RefreshStats │ │ TableID: 104 │ │ │ ├── • MakeAddedSecondaryIndexPublic diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_5_of_15 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_5_of_15 index b863f0f7073e..0b9deb3eef5e 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_5_of_15 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_5_of_15 @@ -15,16 +15,28 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 15; │ ├── • 6 elements transitioning toward ABSENT │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ MERGE_ONLY → DELETE_ONLY @@ -35,18 +47,46 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 15; │ ├── • 6 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} @@ -58,7 +98,26 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 15; │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 16 Mutation operations + │ └── • 12 Mutation operations + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 2 + │ │ Name: j + │ │ TableID: 104 + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 4 + │ │ Name: crdb_internal_idx_expr + │ │ TableID: 104 + │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: t_expr_k_idx + │ │ TableID: 104 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 4 + │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 2 @@ -90,47 +149,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 15; │ ├── • 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 - │ │ - │ ├── • SetColumnName - │ │ ColumnID: 2 - │ │ Name: j - │ │ TableID: 104 - │ │ - │ ├── • SetColumnName - │ │ ColumnID: 4 - │ │ Name: crdb_internal_idx_expr - │ │ TableID: 104 - │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ │ ├── • MakeAddedSecondaryIndexPublic │ │ IndexID: 2 │ │ TableID: 104 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_6_of_15 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_6_of_15 index 0b3385b53a36..298708bb6371 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_6_of_15 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_6_of_15 @@ -15,16 +15,28 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 15; │ ├── • 6 elements transitioning toward ABSENT │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ MERGE_ONLY → DELETE_ONLY @@ -35,18 +47,46 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 15; │ ├── • 6 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} @@ -58,7 +98,26 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 15; │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 16 Mutation operations + │ └── • 12 Mutation operations + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 2 + │ │ Name: j + │ │ TableID: 104 + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 4 + │ │ Name: crdb_internal_idx_expr + │ │ TableID: 104 + │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: t_expr_k_idx + │ │ TableID: 104 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 4 + │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 2 @@ -90,47 +149,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 15; │ ├── • 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 - │ │ - │ ├── • SetColumnName - │ │ ColumnID: 2 - │ │ Name: j - │ │ TableID: 104 - │ │ - │ ├── • SetColumnName - │ │ ColumnID: 4 - │ │ Name: crdb_internal_idx_expr - │ │ TableID: 104 - │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ │ ├── • MakeAddedSecondaryIndexPublic │ │ IndexID: 2 │ │ TableID: 104 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_7_of_15 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_7_of_15 index 6468f442f99c..a2c1c6d9192c 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_7_of_15 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_7_of_15 @@ -15,16 +15,28 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 15; │ ├── • 6 elements transitioning toward ABSENT │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY @@ -35,18 +47,46 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 15; │ ├── • 6 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} @@ -58,7 +98,30 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 15; │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 16 Mutation operations + │ └── • 12 Mutation operations + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 2 + │ │ Name: j + │ │ TableID: 104 + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 4 + │ │ Name: crdb_internal_idx_expr + │ │ TableID: 104 + │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: t_expr_k_idx + │ │ TableID: 104 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 3 + │ │ TableID: 104 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 4 + │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 2 @@ -90,51 +153,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 15; │ ├── • 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 - │ │ - │ ├── • SetColumnName - │ │ ColumnID: 2 - │ │ Name: j - │ │ TableID: 104 - │ │ - │ ├── • SetColumnName - │ │ ColumnID: 4 - │ │ Name: crdb_internal_idx_expr - │ │ TableID: 104 - │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ │ ├── • MakeAddedSecondaryIndexPublic │ │ IndexID: 2 │ │ TableID: 104 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_8_of_15 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_8_of_15 index 3033a52ae2d1..81a068e0f6be 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_8_of_15 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_8_of_15 @@ -15,16 +15,28 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 8 of 15; │ ├── • 6 elements transitioning toward ABSENT │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY @@ -35,18 +47,46 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 8 of 15; │ ├── • 6 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} @@ -58,7 +98,30 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 8 of 15; │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 16 Mutation operations + │ └── • 12 Mutation operations + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 2 + │ │ Name: j + │ │ TableID: 104 + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 4 + │ │ Name: crdb_internal_idx_expr + │ │ TableID: 104 + │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: t_expr_k_idx + │ │ TableID: 104 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 3 + │ │ TableID: 104 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 4 + │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 2 @@ -90,51 +153,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 8 of 15; │ ├── • 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 - │ │ - │ ├── • SetColumnName - │ │ ColumnID: 2 - │ │ Name: j - │ │ TableID: 104 - │ │ - │ ├── • SetColumnName - │ │ ColumnID: 4 - │ │ Name: crdb_internal_idx_expr - │ │ TableID: 104 - │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ │ ├── • MakeAddedSecondaryIndexPublic │ │ IndexID: 2 │ │ TableID: 104 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_9_of_15 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_9_of_15 index e0e810ee23db..8116a9c38a85 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_9_of_15 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.rollback_9_of_15 @@ -17,20 +17,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 9 of 15; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ PUBLIC → WRITE_ONLY @@ -39,7 +51,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 9 of 15; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY @@ -47,24 +59,22 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 9 of 15; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 5} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} - │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} │ │ │ │ BACKFILL_ONLY → ABSENT │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 5} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} - │ │ │ │ rule: "secondary index columns removed before removing the index" │ │ │ │ rule: "dependents removed before index" │ │ │ │ │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: idx, IndexID: 5} @@ -80,26 +90,60 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 9 of 15; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 6} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 8 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ ├── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} + │ │ │ │ rule: "index dependents exist before index becomes public" │ │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} @@ -111,7 +155,17 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 9 of 15; │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} @@ -123,54 +177,13 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 9 of 15; │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 28 Mutation operations - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 2 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 4 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 + │ └── • 20 Mutation operations │ │ │ ├── • SetIndexName │ │ IndexID: 1 │ │ Name: t_pkey │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 4 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -199,18 +212,8 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 9 of 15; │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 6 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 6 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ - │ ├── • MakeAddedPrimaryIndexPublic + │ ├── • MakeColumnPublic + │ │ ColumnID: 2 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -219,33 +222,40 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 9 of 15; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ IndexID: 1 │ │ TableID: 104 │ │ - │ ├── • MakeAddedSecondaryIndexPublic - │ │ IndexID: 2 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 + │ ├── • MakeColumnPublic + │ │ ColumnID: 4 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 3 - │ │ Kind: 2 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 5 + │ ├── • MakeAddedPrimaryIndexPublic + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ IndexID: 1 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 5 - │ │ Kind: 1 + │ ├── • MakeAddedSecondaryIndexPublic + │ │ IndexID: 2 │ │ TableID: 104 │ │ │ ├── • LogEvent diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.statement_1_of_2 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.statement_1_of_2 index af7738e30e64..f35c6c887d52 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.statement_1_of_2 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.statement_1_of_2 @@ -19,16 +19,19 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 2} -│ │ │ rule: "column dependents removed after column no longer public" +│ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} -│ │ │ PUBLIC → WRITE_ONLY +│ │ │ │ PUBLIC → WRITE_ONLY +│ │ │ │ +│ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} +│ │ │ rule: "secondary indexes containing column as key reach write-only before column" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 4} -│ │ │ rule: "column dependents removed after column no longer public" +│ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ PUBLIC → VALIDATED @@ -37,9 +40,9 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ rule: "index no longer public before dependents removed" +│ │ rule: "index no longer public before dependents" │ │ -│ ├── • 5 elements transitioning toward PUBLIC +│ ├── • 3 elements transitioning toward PUBLIC │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ ABSENT → BACKFILL_ONLY @@ -48,32 +51,30 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" +│ │ │ rule: "index existence precedes index dependents" │ │ │ -│ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} -│ │ │ │ ABSENT → PUBLIC -│ │ │ │ -│ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" +│ │ └── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} +│ │ │ ABSENT → PUBLIC +│ │ │ +│ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} +│ │ rule: "index existence precedes index dependents" +│ │ +│ ├── • 3 elements transitioning toward TRANSIENT_ABSENT +│ │ │ +│ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} +│ │ │ ABSENT → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} -│ │ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ │ rule: "index-column added to index after temp index exists" +│ │ │ rule: "temp index existence precedes index dependents" │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} │ │ │ ABSENT → PUBLIC │ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} -│ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ rule: "index-column added to index after temp index exists" -│ │ -│ ├── • 1 element transitioning toward TRANSIENT_ABSENT -│ │ │ -│ │ └── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} -│ │ ABSENT → DELETE_ONLY +│ │ rule: "temp index existence precedes index dependents" │ │ │ └── • 14 Mutation operations │ │ @@ -102,32 +103,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ Name: crdb_internal_column_2_name_placeholder │ │ TableID: 104 │ │ -│ ├── • MakeDroppedColumnDeleteAndWriteOnly -│ │ ColumnID: 4 -│ │ TableID: 104 -│ │ -│ ├── • LogEvent -│ │ Element: -│ │ Column: -│ │ columnId: 4 -│ │ isInaccessible: true -│ │ pgAttributeNum: 4 -│ │ tableId: 104 -│ │ EventBase: -│ │ Authorization: -│ │ UserName: root -│ │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE -│ │ StatementTag: ALTER TABLE -│ │ TargetMetadata: -│ │ SourceElementID: 1 -│ │ SubWorkID: 1 -│ │ TargetStatus: 1 -│ │ -│ ├── • SetColumnName -│ │ ColumnID: 4 -│ │ Name: crdb_internal_column_4_name_placeholder -│ │ TableID: 104 -│ │ │ ├── • MakeDroppedNonPrimaryIndexDeleteAndWriteOnly │ │ IndexID: 2 │ │ TableID: 104 @@ -170,10 +145,36 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ IndexID: 4 │ │ TableID: 104 │ │ -│ └── • AddColumnToIndex -│ ColumnID: 3 -│ IndexID: 4 -│ Kind: 2 +│ ├── • AddColumnToIndex +│ │ ColumnID: 3 +│ │ IndexID: 4 +│ │ Kind: 2 +│ │ TableID: 104 +│ │ +│ ├── • MakeDroppedColumnDeleteAndWriteOnly +│ │ ColumnID: 4 +│ │ TableID: 104 +│ │ +│ ├── • LogEvent +│ │ Element: +│ │ Column: +│ │ columnId: 4 +│ │ isInaccessible: true +│ │ pgAttributeNum: 4 +│ │ tableId: 104 +│ │ EventBase: +│ │ Authorization: +│ │ UserName: root +│ │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE +│ │ StatementTag: ALTER TABLE +│ │ TargetMetadata: +│ │ SourceElementID: 1 +│ │ SubWorkID: 1 +│ │ TargetStatus: 1 +│ │ +│ └── • SetColumnName +│ ColumnID: 4 +│ Name: crdb_internal_column_4_name_placeholder │ TableID: 104 │ ├── • PreCommitPhase @@ -351,20 +352,32 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ PUBLIC → WRITE_ONLY @@ -373,34 +386,37 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 4} + │ │ │ │ rule: "column no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ VALIDATED → DELETE_ONLY @@ -413,21 +429,40 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ ├── • SameStagePrecedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ │ rule: "primary index swap" │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 3} - │ │ │ rule: "index named right before index becomes public" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 3} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ rule: "index named right before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_pkey, IndexID: 3} │ │ │ ABSENT → PUBLIC │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ rule: "index existence precedes index name and comment" + │ │ rule: "index existence precedes index dependents" │ │ - │ ├── • 1 element transitioning toward TRANSIENT_ABSENT + │ ├── • 3 elements transitioning toward TRANSIENT_ABSENT │ │ │ - │ │ └── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ │ WRITE_ONLY → TRANSIENT_DELETE_ONLY + │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} + │ │ │ WRITE_ONLY → TRANSIENT_DELETE_ONLY + │ │ │ + │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} + │ │ │ │ PUBLIC → TRANSIENT_ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" + │ │ │ + │ │ └── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} + │ │ │ PUBLIC → TRANSIENT_ABSENT + │ │ │ + │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 16 Mutation operations + │ └── • 10 Mutation operations │ │ │ ├── • MakeDroppedColumnDeleteOnly │ │ ColumnID: 2 @@ -455,24 +490,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ IndexID: 4 │ │ 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 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 @@ -489,55 +506,131 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ 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 │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 1 MutationType op pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 7 MutationType ops pending │ ├── • Stage 2 of 3 in PostCommitNonRevertiblePhase │ │ - │ ├── • 1 element transitioning toward ABSENT + │ ├── • 4 elements transitioning toward ABSENT + │ │ │ + │ │ ├── • Column:{DescID: 104, ColumnID: 4} + │ │ │ │ DELETE_ONLY → ABSENT + │ │ │ │ + │ │ │ ├── • Precedence dependency from ABSENT ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ │ rule: "dependents removed before column" + │ │ │ │ + │ │ │ ├── • SameStagePrecedence dependency from ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "dependents removed before column" + │ │ │ │ rule: "column type removed right before column when not dropping relation" + │ │ │ │ + │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "dependents removed before column" + │ │ │ │ + │ │ │ └── • Precedence dependency from ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "indexes containing column reach absent before column" + │ │ │ + │ │ ├── • ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 4} + │ │ │ rule: "column no longer public before dependents" + │ │ │ + │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ WRITE_ONLY → DELETE_ONLY + │ │ │ + │ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ DELETE_ONLY → ABSENT + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ rule: "dependents removed before index" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ rule: "dependents removed before index" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ rule: "dependents removed before index" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ rule: "dependents removed before index" + │ │ + │ ├── • 1 element transitioning toward TRANSIENT_ABSENT │ │ │ - │ │ └── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ WRITE_ONLY → DELETE_ONLY + │ │ └── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} + │ │ │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT + │ │ │ + │ │ ├── • Precedence dependency from TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} + │ │ │ rule: "dependents removed before index" + │ │ │ + │ │ └── • Precedence dependency from TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} + │ │ rule: "dependents removed before index" │ │ - │ └── • 3 Mutation operations + │ └── • 9 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 1 │ │ TableID: 104 │ │ + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ tableId: 104 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TargetStatus: 1 + │ │ + │ ├── • CreateGcJobForIndex + │ │ IndexID: 2 + │ │ StatementForDropJob: + │ │ Statement: ALTER TABLE defaultdb.public.t DROP COLUMN j CASCADE + │ │ TableID: 104 + │ │ + │ ├── • MakeIndexAbsent + │ │ IndexID: 2 + │ │ TableID: 104 + │ │ + │ ├── • CreateGcJobForIndex + │ │ IndexID: 4 + │ │ TableID: 104 + │ │ + │ ├── • MakeIndexAbsent + │ │ IndexID: 4 + │ │ TableID: 104 + │ │ + │ ├── • MakeColumnAbsent + │ │ ColumnID: 4 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TableID: 104 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 3 of 3 with 9 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 3 of 3 with 3 MutationType ops pending │ └── • Stage 3 of 3 in PostCommitNonRevertiblePhase │ - ├── • 6 elements transitioning toward ABSENT + ├── • 3 elements transitioning toward ABSENT │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ DELETE_ONLY → ABSENT @@ -549,87 +642,34 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ rule: "dependents removed before column" + │ │ │ │ │ └── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ rule: "indexes containing columns reach absent before column" + │ │ rule: "indexes containing column reach absent before column" │ │ │ ├── • ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 2} - │ │ rule: "column dependents removed after column no longer public" + │ │ rule: "column no longer public before dependents" │ │ - │ ├── • Column:{DescID: 104, ColumnID: 4} - │ │ │ DELETE_ONLY → ABSENT - │ │ │ - │ │ ├── • Precedence dependency from ABSENT ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} - │ │ │ rule: "dependents removed before column" - │ │ │ - │ │ ├── • SameStagePrecedence dependency from ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} - │ │ │ rule: "dependents removed before column" - │ │ │ rule: "column type removed right before column when not dropping relation" - │ │ │ - │ │ └── • Precedence dependency from ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ rule: "indexes containing columns reach absent before column" - │ │ - │ ├── • ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} - │ │ │ PUBLIC → ABSENT - │ │ │ - │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 4} - │ │ rule: "column dependents removed after column no longer public" - │ │ - │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ DELETE_ONLY → ABSENT - │ │ │ - │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} - │ │ │ rule: "dependents removed before index" - │ │ │ - │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} - │ │ │ rule: "dependents removed before index" - │ │ │ - │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} - │ │ │ rule: "dependents removed before index" - │ │ │ - │ │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} - │ │ │ rule: "dependents removed before index" - │ │ │ - │ │ └── • SameStagePrecedence dependency from TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ │ rule: "temp indexes reach absent at the same time as other indexes" - │ │ - │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ └── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ DELETE_ONLY → ABSENT │ │ - │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" - │ │ rule: "dependents removed before index" - │ │ - │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" + │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} │ │ rule: "dependents removed before index" │ │ - │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" + │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} │ │ rule: "dependents removed before index" │ │ - │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} │ │ rule: "dependents removed before index" │ │ - │ └── • SameStagePrecedence dependency from TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ rule: "temp indexes reach absent at the same time as other indexes" + │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} + │ rule: "dependents removed before index" │ - ├── • 1 element transitioning toward TRANSIENT_ABSENT - │ │ - │ └── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT - │ - └── • 11 Mutation operations - │ - ├── • CreateGcJobForIndex - │ IndexID: 4 - │ TableID: 104 - │ - ├── • MakeIndexAbsent - │ IndexID: 4 - │ TableID: 104 + └── • 5 Mutation operations │ ├── • CreateGcJobForIndex │ IndexID: 1 @@ -649,31 +689,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ IndexID: 1 │ TableID: 104 │ - ├── • LogEvent - │ Element: - │ SecondaryIndex: - │ indexId: 2 - │ tableId: 104 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE - │ StatementTag: ALTER TABLE - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TargetStatus: 1 - │ - ├── • CreateGcJobForIndex - │ IndexID: 2 - │ StatementForDropJob: - │ Statement: ALTER TABLE defaultdb.public.t DROP COLUMN j CASCADE - │ TableID: 104 - │ - ├── • MakeIndexAbsent - │ IndexID: 2 - │ TableID: 104 - │ ├── • MakeColumnAbsent │ ColumnID: 2 │ EventBase: @@ -686,18 +701,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ SubWorkID: 1 │ TableID: 104 │ - ├── • MakeColumnAbsent - │ ColumnID: 4 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE - │ StatementTag: ALTER TABLE - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TableID: 104 - │ ├── • RemoveJobStateFromDescriptor │ DescriptorID: 104 │ JobID: 1 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.statement_2_of_2 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.statement_2_of_2 index eea4b6333128..89f18b0e9cf9 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.statement_2_of_2 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_create_index_separate_statements.statement_2_of_2 @@ -181,7 +181,7 @@ EXPLAIN (ddl, verbose) CREATE UNIQUE INDEX idx ON t(k); │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} -│ │ │ rule: "index no longer public before dependents removed" +│ │ │ rule: "index no longer public before dependents" │ │ │ │ │ ├── • 7 elements transitioning toward PUBLIC │ │ │ │ @@ -191,26 +191,33 @@ EXPLAIN (ddl, verbose) CREATE UNIQUE INDEX idx ON t(k); │ │ │ │ ├── • SameStagePrecedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ │ │ rule: "primary index swap" │ │ │ │ │ +│ │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} +│ │ │ │ │ rule: "index dependents exist before index becomes public" +│ │ │ │ │ +│ │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} +│ │ │ │ │ rule: "index dependents exist before index becomes public" +│ │ │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 3} +│ │ │ │ rule: "index dependents exist before index becomes public" │ │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ │ │ ├── • IndexName:{DescID: 104, Name: t_pkey, IndexID: 3} │ │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} -│ │ │ │ rule: "index existence precedes index name and comment" +│ │ │ │ rule: "index existence precedes index dependents" │ │ │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 5} │ │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} -│ │ │ │ rule: "index-column added to index after index exists" +│ │ │ │ rule: "index existence precedes index dependents" │ │ │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} │ │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} -│ │ │ │ rule: "index-column added to index after index exists" +│ │ │ │ rule: "index existence precedes index dependents" │ │ │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} │ │ │ │ │ ABSENT → BACKFILL_ONLY @@ -222,15 +229,13 @@ EXPLAIN (ddl, verbose) CREATE UNIQUE INDEX idx ON t(k); │ │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 4, SourceIndexID: 3} -│ │ │ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ │ │ rule: "index-column added to index after temp index exists" +│ │ │ │ rule: "temp index existence precedes index dependents" │ │ │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6} │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 4, SourceIndexID: 3} -│ │ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ │ rule: "index-column added to index after temp index exists" +│ │ │ rule: "temp index existence precedes index dependents" │ │ │ │ │ ├── • 1 element transitioning toward TRANSIENT_ABSENT │ │ │ │ @@ -321,13 +326,7 @@ EXPLAIN (ddl, verbose) CREATE UNIQUE INDEX idx ON t(k); │ │ ├── • 1 element transitioning toward TRANSIENT_ABSENT │ │ │ │ │ │ │ └── • TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 4, SourceIndexID: 3} -│ │ │ │ DELETE_ONLY → WRITE_ONLY -│ │ │ │ -│ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 6} -│ │ │ │ rule: "index-column added to index before temp index receives writes" -│ │ │ │ -│ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6} -│ │ │ rule: "index-column added to index before temp index receives writes" +│ │ │ DELETE_ONLY → WRITE_ONLY │ │ │ │ │ └── • 3 Mutation operations │ │ │ @@ -467,20 +466,32 @@ EXPLAIN (ddl, verbose) CREATE UNIQUE INDEX idx ON t(k); │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ VALIDATED → DELETE_ONLY @@ -488,29 +499,32 @@ EXPLAIN (ddl, verbose) CREATE UNIQUE INDEX idx ON t(k); │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 4} + │ │ │ │ rule: "column no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ VALIDATED → DELETE_ONLY @@ -520,16 +534,35 @@ EXPLAIN (ddl, verbose) CREATE UNIQUE INDEX idx ON t(k); │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 5} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 5} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: idx, IndexID: 5} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: idx, IndexID: 5} │ │ │ ABSENT → PUBLIC │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} - │ │ rule: "index existence precedes index name and comment" + │ │ rule: "index existence precedes index dependents" │ │ - │ ├── • 2 elements transitioning toward TRANSIENT_ABSENT + │ ├── • 4 elements transitioning toward TRANSIENT_ABSENT + │ │ │ + │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} + │ │ │ │ PUBLIC → TRANSIENT_ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" + │ │ │ + │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} + │ │ │ │ PUBLIC → TRANSIENT_ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → TRANSIENT_DELETE_ONLY @@ -537,7 +570,7 @@ EXPLAIN (ddl, verbose) CREATE UNIQUE INDEX idx ON t(k); │ │ └── • TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 4, SourceIndexID: 3} │ │ WRITE_ONLY → TRANSIENT_DELETE_ONLY │ │ - │ └── • 16 Mutation operations + │ └── • 10 Mutation operations │ │ │ ├── • MakeDroppedColumnDeleteOnly │ │ ColumnID: 2 @@ -547,24 +580,6 @@ EXPLAIN (ddl, verbose) CREATE UNIQUE INDEX idx ON t(k); │ │ ColumnID: 4 │ │ 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 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 104 @@ -590,23 +605,6 @@ EXPLAIN (ddl, verbose) CREATE UNIQUE INDEX idx ON t(k); │ │ IndexID: 5 │ │ 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 │ │ @@ -627,8 +625,11 @@ EXPLAIN (ddl, verbose) CREATE UNIQUE INDEX idx ON t(k); │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ rule: "dependents removed before column" + │ │ │ │ │ ├── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "indexes containing columns reach absent before column" + │ │ │ rule: "indexes containing column reach absent before column" │ │ │ │ │ └── • Precedence dependency from ABSENT ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ rule: "dependents removed before column" @@ -637,7 +638,7 @@ EXPLAIN (ddl, verbose) CREATE UNIQUE INDEX idx ON t(k); │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 2} - │ │ rule: "column dependents removed after column no longer public" + │ │ rule: "column no longer public before dependents" │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ DELETE_ONLY → ABSENT @@ -646,8 +647,11 @@ EXPLAIN (ddl, verbose) CREATE UNIQUE INDEX idx ON t(k); │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ │ │ ├── • Precedence dependency from ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "indexes containing columns reach absent before column" + │ │ │ rule: "indexes containing column reach absent before column" │ │ │ │ │ └── • Precedence dependency from ABSENT ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ rule: "dependents removed before column" @@ -656,7 +660,7 @@ EXPLAIN (ddl, verbose) CREATE UNIQUE INDEX idx ON t(k); │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 4} - │ │ rule: "column dependents removed after column no longer public" + │ │ rule: "column no longer public before dependents" │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ DELETE_ONLY → ABSENT @@ -670,64 +674,39 @@ EXPLAIN (ddl, verbose) CREATE UNIQUE INDEX idx ON t(k); │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} │ │ │ rule: "dependents removed before index" │ │ │ - │ │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} - │ │ │ rule: "dependents removed before index" - │ │ │ - │ │ ├── • SameStagePrecedence dependency from TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ │ │ rule: "temp indexes reach absent at the same time as other indexes" - │ │ │ - │ │ └── • SameStagePrecedence dependency from TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 4, SourceIndexID: 3} - │ │ rule: "temp indexes reach absent at the same time as other indexes" + │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} + │ │ rule: "dependents removed before index" │ │ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ DELETE_ONLY → ABSENT │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" │ │ rule: "dependents removed before index" │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" │ │ rule: "dependents removed before index" │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" - │ │ rule: "dependents removed before index" - │ │ - │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ rule: "dependents removed before index" │ │ - │ ├── • SameStagePrecedence dependency from TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ │ rule: "temp indexes reach absent at the same time as other indexes" - │ │ - │ └── • SameStagePrecedence dependency from TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 4, SourceIndexID: 3} - │ rule: "temp indexes reach absent at the same time as other indexes" + │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ rule: "dependents removed before index" │ ├── • 2 elements transitioning toward TRANSIENT_ABSENT │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT + │ │ │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT + │ │ │ + │ │ ├── • Precedence dependency from TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} + │ │ │ rule: "dependents removed before index" + │ │ │ + │ │ └── • Precedence dependency from TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} + │ │ rule: "dependents removed before index" │ │ │ └── • TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 4, SourceIndexID: 3} │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT │ └── • 13 Mutation operations - │ - ├── • CreateGcJobForIndex - │ IndexID: 4 - │ TableID: 104 - │ - ├── • MakeIndexAbsent - │ IndexID: 4 - │ TableID: 104 - │ - ├── • CreateGcJobForIndex - │ IndexID: 6 - │ TableID: 104 - │ - ├── • MakeIndexAbsent - │ IndexID: 6 - │ TableID: 104 │ ├── • CreateGcJobForIndex │ IndexID: 1 @@ -772,6 +751,22 @@ EXPLAIN (ddl, verbose) CREATE UNIQUE INDEX idx ON t(k); │ IndexID: 2 │ TableID: 104 │ + ├── • CreateGcJobForIndex + │ IndexID: 4 + │ TableID: 104 + │ + ├── • MakeIndexAbsent + │ IndexID: 4 + │ TableID: 104 + │ + ├── • CreateGcJobForIndex + │ IndexID: 6 + │ TableID: 104 + │ + ├── • MakeIndexAbsent + │ IndexID: 6 + │ TableID: 104 + │ ├── • MakeColumnAbsent │ ColumnID: 2 │ EventBase: diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index index 14bab60532fc..5d0819b20b2b 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index @@ -22,9 +22,9 @@ EXPLAIN (ddl, verbose) ALTER TABLE t.test DROP pi; │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 3} -│ │ rule: "column dependents removed after column no longer public" +│ │ rule: "column no longer public before dependents" │ │ -│ ├── • 7 elements transitioning toward PUBLIC +│ ├── • 4 elements transitioning toward PUBLIC │ │ │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 4, ConstraintID: 5, TemporaryIndexID: 5, SourceIndexID: 1} │ │ │ ABSENT → BACKFILL_ONLY @@ -33,45 +33,42 @@ EXPLAIN (ddl, verbose) ALTER TABLE t.test DROP pi; │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 106, IndexID: 4, ConstraintID: 5, TemporaryIndexID: 5, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" +│ │ │ rule: "index existence precedes index dependents" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 4} │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 106, IndexID: 4, ConstraintID: 5, TemporaryIndexID: 5, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" +│ │ │ rule: "index existence precedes index dependents" │ │ │ -│ │ ├── • IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 4} -│ │ │ │ ABSENT → PUBLIC -│ │ │ │ -│ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 106, IndexID: 4, ConstraintID: 5, TemporaryIndexID: 5, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" +│ │ └── • IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 4} +│ │ │ ABSENT → PUBLIC +│ │ │ +│ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 106, IndexID: 4, ConstraintID: 5, TemporaryIndexID: 5, SourceIndexID: 1} +│ │ rule: "index existence precedes index dependents" +│ │ +│ ├── • 4 elements transitioning toward TRANSIENT_ABSENT +│ │ │ +│ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} +│ │ │ ABSENT → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 5} │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} -│ │ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ │ rule: "index-column added to index after temp index exists" +│ │ │ rule: "temp index existence precedes index dependents" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} -│ │ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ │ rule: "index-column added to index after temp index exists" +│ │ │ rule: "temp index existence precedes index dependents" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 5} │ │ │ ABSENT → PUBLIC │ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} -│ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ rule: "index-column added to index after temp index exists" -│ │ -│ ├── • 1 element transitioning toward TRANSIENT_ABSENT -│ │ │ -│ │ └── • TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} -│ │ ABSENT → DELETE_ONLY +│ │ rule: "temp index existence precedes index dependents" │ │ │ └── • 11 Mutation operations │ │ @@ -331,26 +328,41 @@ EXPLAIN (ddl, verbose) ALTER TABLE t.test DROP pi; │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 3, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 3} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} │ │ │ PUBLIC → WRITE_ONLY @@ -359,7 +371,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t.test DROP pi; │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} - │ │ rule: "index no longer public before dependents removed" + │ │ rule: "index no longer public before dependents" │ │ │ ├── • 2 elements transitioning toward PUBLIC │ │ │ @@ -369,21 +381,49 @@ EXPLAIN (ddl, verbose) ALTER TABLE t.test DROP pi; │ │ │ ├── • SameStagePrecedence dependency from VALIDATED PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} │ │ │ │ rule: "primary index swap" │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 106, Name: test_pkey, IndexID: 4} - │ │ │ rule: "index named right before index becomes public" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 106, Name: test_pkey, IndexID: 4} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ rule: "index named right before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 4} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 4} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 4} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 106, Name: test_pkey, IndexID: 4} │ │ │ ABSENT → PUBLIC │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 106, IndexID: 4, ConstraintID: 5, TemporaryIndexID: 5, SourceIndexID: 1} - │ │ rule: "index existence precedes index name and comment" + │ │ rule: "index existence precedes index dependents" │ │ - │ ├── • 1 element transitioning toward TRANSIENT_ABSENT + │ ├── • 4 elements transitioning toward TRANSIENT_ABSENT │ │ │ - │ │ └── • TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} - │ │ WRITE_ONLY → TRANSIENT_DELETE_ONLY + │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} + │ │ │ WRITE_ONLY → TRANSIENT_DELETE_ONLY + │ │ │ + │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 5} + │ │ │ │ PUBLIC → TRANSIENT_ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" + │ │ │ + │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} + │ │ │ │ PUBLIC → TRANSIENT_ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" + │ │ │ + │ │ └── • IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 5} + │ │ │ PUBLIC → TRANSIENT_ABSENT + │ │ │ + │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 12 Mutation operations + │ └── • 8 Mutation operations │ │ │ ├── • MakeDroppedColumnDeleteOnly │ │ ColumnID: 3 @@ -407,31 +447,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t.test DROP pi; │ │ IndexID: 5 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 1 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 1 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 1 - │ │ Kind: 2 - │ │ Ordinal: 1 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 4 - │ │ IndexID: 1 - │ │ Kind: 2 - │ │ Ordinal: 2 - │ │ TableID: 106 - │ │ │ ├── • MakeAddedPrimaryIndexPublic │ │ EventBase: │ │ Authorization: @@ -450,7 +465,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t.test DROP pi; │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 1 MutationType op pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 3 MutationType ops pending │ ├── • Stage 2 of 3 in PostCommitNonRevertiblePhase │ │ @@ -459,19 +474,41 @@ EXPLAIN (ddl, verbose) ALTER TABLE t.test DROP pi; │ │ └── • PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} │ │ WRITE_ONLY → DELETE_ONLY │ │ - │ └── • 3 Mutation operations + │ ├── • 1 element transitioning toward TRANSIENT_ABSENT + │ │ │ + │ │ └── • TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} + │ │ │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT + │ │ │ + │ │ ├── • Precedence dependency from TRANSIENT_ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 5} + │ │ │ rule: "dependents removed before index" + │ │ │ + │ │ ├── • Precedence dependency from TRANSIENT_ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} + │ │ │ rule: "dependents removed before index" + │ │ │ + │ │ └── • Precedence dependency from TRANSIENT_ABSENT IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 5} + │ │ rule: "dependents removed before index" + │ │ + │ └── • 5 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 1 │ │ TableID: 106 │ │ + │ ├── • CreateGcJobForIndex + │ │ IndexID: 5 + │ │ TableID: 106 + │ │ + │ ├── • MakeIndexAbsent + │ │ IndexID: 5 + │ │ TableID: 106 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 106 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 3 of 3 with 6 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 3 of 3 with 4 MutationType ops pending │ └── • Stage 3 of 3 in PostCommitNonRevertiblePhase │ @@ -487,20 +524,29 @@ EXPLAIN (ddl, verbose) ALTER TABLE t.test DROP pi; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ + │ │ ├── • Precedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 3} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 3, IndexID: 1} + │ │ │ rule: "dependents removed before column" + │ │ │ │ │ └── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} - │ │ rule: "indexes containing columns reach absent before column" + │ │ rule: "indexes containing column reach absent before column" │ │ │ ├── • ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 3} │ │ │ PUBLIC → ABSENT │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 3} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ └── • SameStagePrecedence dependency from ABSENT ColumnDefaultExpression:{DescID: 106, ColumnID: 3} │ │ rule: "column type dependents removed right before column type" │ │ │ ├── • ColumnDefaultExpression:{DescID: 106, ColumnID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 106, ColumnID: 3} + │ │ rule: "column no longer public before dependents" │ │ │ └── • PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1} │ │ DELETE_ONLY → ABSENT @@ -517,26 +563,10 @@ EXPLAIN (ddl, verbose) ALTER TABLE t.test DROP pi; │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 1} │ │ rule: "dependents removed before index" │ │ - │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 106, Name: test_pkey, IndexID: 1} - │ │ rule: "dependents removed before index" - │ │ - │ └── • SameStagePrecedence dependency from TRANSIENT_ABSENT TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} - │ rule: "temp indexes reach absent at the same time as other indexes" + │ └── • Precedence dependency from ABSENT IndexName:{DescID: 106, Name: test_pkey, IndexID: 1} + │ rule: "dependents removed before index" │ - ├── • 1 element transitioning toward TRANSIENT_ABSENT - │ │ - │ └── • TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} - │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT - │ - └── • 8 Mutation operations - │ - ├── • CreateGcJobForIndex - │ IndexID: 5 - │ TableID: 106 - │ - ├── • MakeIndexAbsent - │ IndexID: 5 - │ TableID: 106 + └── • 6 Mutation operations │ ├── • CreateGcJobForIndex │ IndexID: 1 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_1_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_1_of_7 index 7e3ce0e4c9d8..004496d3175e 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_1_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_1_of_7 @@ -32,13 +32,22 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ │ rule: "dependents removed before index" │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} │ │ │ DELETE_ONLY → ABSENT @@ -53,23 +62,49 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ │ rule: "dependents removed before index" │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 5} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 5} - │ PUBLIC → ABSENT + │ │ PUBLIC → ABSENT + │ │ + │ └── • skip PUBLIC → ABSENT operations + │ rule: "skip index-column removal ops on index removal" │ ├── • 2 elements transitioning toward PUBLIC │ │ │ ├── • Column:{DescID: 106, ColumnID: 3} - │ │ WRITE_ONLY → PUBLIC + │ │ │ WRITE_ONLY → PUBLIC + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 106, Name: pi, ColumnID: 3} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC ColumnDefaultExpression:{DescID: 106, ColumnID: 3} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 3, IndexID: 1} + │ │ rule: "column dependents exist before column becomes public" │ │ │ └── • ColumnName:{DescID: 106, Name: pi, ColumnID: 3} │ ABSENT → PUBLIC │ - └── • 15 Mutation operations + └── • 9 Mutation operations + │ + ├── • SetColumnName + │ ColumnID: 3 + │ Name: pi + │ TableID: 106 │ ├── • MakeColumnPublic │ ColumnID: 3 @@ -86,47 +121,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; ├── • RefreshStats │ TableID: 106 │ - ├── • SetColumnName - │ ColumnID: 3 - │ Name: pi - │ TableID: 106 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 1 - │ IndexID: 4 - │ TableID: 106 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 2 - │ IndexID: 4 - │ Kind: 2 - │ TableID: 106 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 4 - │ IndexID: 4 - │ Kind: 2 - │ Ordinal: 1 - │ TableID: 106 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 1 - │ IndexID: 5 - │ TableID: 106 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 2 - │ IndexID: 5 - │ Kind: 2 - │ TableID: 106 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 4 - │ IndexID: 5 - │ Kind: 2 - │ Ordinal: 1 - │ TableID: 106 - │ ├── • CreateGcJobForIndex │ IndexID: 4 │ StatementForDropJob: diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_2_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_2_of_7 index afe161d30b88..5f3f9104f38d 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_2_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_2_of_7 @@ -32,35 +32,74 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 5} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 2 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 106, ColumnID: 3} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 106, Name: pi, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnDefaultExpression:{DescID: 106, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 3, IndexID: 1} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ └── • ColumnName:{DescID: 106, Name: pi, ColumnID: 3} │ │ ABSENT → PUBLIC │ │ - │ └── • 14 Mutation operations + │ └── • 8 Mutation operations + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 3 + │ │ Name: pi + │ │ TableID: 106 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 5 + │ │ TableID: 106 │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 3 @@ -77,51 +116,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ ├── • RefreshStats │ │ TableID: 106 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 3 - │ │ Name: pi - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 4 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 4 - │ │ IndexID: 4 - │ │ Kind: 2 - │ │ Ordinal: 1 - │ │ TableID: 106 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 5 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 5 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 5 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 4 - │ │ IndexID: 5 - │ │ Kind: 2 - │ │ Ordinal: 1 - │ │ TableID: 106 - │ │ │ ├── • CreateGcJobForIndex │ │ IndexID: 4 │ │ StatementForDropJob: diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_3_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_3_of_7 index 1ef5a15d688b..e0606d4c2adc 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_3_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_3_of_7 @@ -32,35 +32,74 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 5} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 2 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 106, ColumnID: 3} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 106, Name: pi, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnDefaultExpression:{DescID: 106, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 3, IndexID: 1} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ └── • ColumnName:{DescID: 106, Name: pi, ColumnID: 3} │ │ ABSENT → PUBLIC │ │ - │ └── • 14 Mutation operations + │ └── • 8 Mutation operations + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 3 + │ │ Name: pi + │ │ TableID: 106 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 5 + │ │ TableID: 106 │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 3 @@ -77,51 +116,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ ├── • RefreshStats │ │ TableID: 106 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 3 - │ │ Name: pi - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 4 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 4 - │ │ IndexID: 4 - │ │ Kind: 2 - │ │ Ordinal: 1 - │ │ TableID: 106 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 5 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 5 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 5 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 4 - │ │ IndexID: 5 - │ │ Kind: 2 - │ │ Ordinal: 1 - │ │ TableID: 106 - │ │ │ ├── • CreateGcJobForIndex │ │ IndexID: 4 │ │ StatementForDropJob: diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_4_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_4_of_7 index 80947953c01e..fe1c100821c1 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_4_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_4_of_7 @@ -32,35 +32,74 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 5} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 2 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 106, ColumnID: 3} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 106, Name: pi, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnDefaultExpression:{DescID: 106, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 3, IndexID: 1} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ └── • ColumnName:{DescID: 106, Name: pi, ColumnID: 3} │ │ ABSENT → PUBLIC │ │ - │ └── • 14 Mutation operations + │ └── • 8 Mutation operations + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 3 + │ │ Name: pi + │ │ TableID: 106 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 5 + │ │ TableID: 106 │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 3 @@ -77,51 +116,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ ├── • RefreshStats │ │ TableID: 106 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 3 - │ │ Name: pi - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 4 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 4 - │ │ IndexID: 4 - │ │ Kind: 2 - │ │ Ordinal: 1 - │ │ TableID: 106 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 5 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 5 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 5 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 4 - │ │ IndexID: 5 - │ │ Kind: 2 - │ │ Ordinal: 1 - │ │ TableID: 106 - │ │ │ ├── • CreateGcJobForIndex │ │ IndexID: 4 │ │ StatementForDropJob: diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_5_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_5_of_7 index e79bc092c97c..aff17316dc89 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_5_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_5_of_7 @@ -20,35 +20,74 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ │ MERGE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 5} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 2 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 106, ColumnID: 3} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 106, Name: pi, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnDefaultExpression:{DescID: 106, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 3, IndexID: 1} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ └── • ColumnName:{DescID: 106, Name: pi, ColumnID: 3} │ │ ABSENT → PUBLIC │ │ - │ └── • 13 Mutation operations + │ └── • 7 Mutation operations + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 3 + │ │ Name: pi + │ │ TableID: 106 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 5 + │ │ TableID: 106 │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 3 @@ -65,51 +104,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ ├── • RefreshStats │ │ TableID: 106 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 3 - │ │ Name: pi - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 4 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 4 - │ │ IndexID: 4 - │ │ Kind: 2 - │ │ Ordinal: 1 - │ │ TableID: 106 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 5 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 5 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 5 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 4 - │ │ IndexID: 5 - │ │ Kind: 2 - │ │ Ordinal: 1 - │ │ TableID: 106 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 106 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_6_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_6_of_7 index 290cb187b856..5f4247e79190 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_6_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_6_of_7 @@ -20,35 +20,74 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ │ MERGE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 5} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 2 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 106, ColumnID: 3} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 106, Name: pi, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnDefaultExpression:{DescID: 106, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 3, IndexID: 1} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ └── • ColumnName:{DescID: 106, Name: pi, ColumnID: 3} │ │ ABSENT → PUBLIC │ │ - │ └── • 13 Mutation operations + │ └── • 7 Mutation operations + │ │ + │ ├── • SetColumnName + │ │ ColumnID: 3 + │ │ Name: pi + │ │ TableID: 106 + │ │ + │ ├── • MakeDroppedIndexDeleteOnly + │ │ IndexID: 5 + │ │ TableID: 106 │ │ │ ├── • MakeColumnPublic │ │ ColumnID: 3 @@ -65,51 +104,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ ├── • RefreshStats │ │ TableID: 106 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 3 - │ │ Name: pi - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 4 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 4 - │ │ IndexID: 4 - │ │ Kind: 2 - │ │ Ordinal: 1 - │ │ TableID: 106 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 5 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 5 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 5 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 4 - │ │ IndexID: 5 - │ │ Kind: 2 - │ │ Ordinal: 1 - │ │ TableID: 106 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 106 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_7_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_7_of_7 index c6b7706fdd51..0dc89d7e443f 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_7_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_unique_index.rollback_7_of_7 @@ -20,50 +20,65 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 6, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexColumn:{DescID: 106, ColumnID: 4, IndexID: 5} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 2 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 106, ColumnID: 3} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 106, Name: pi, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 106, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnDefaultExpression:{DescID: 106, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 106, ColumnID: 3, IndexID: 1} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ └── • ColumnName:{DescID: 106, Name: pi, ColumnID: 3} │ │ ABSENT → PUBLIC │ │ - │ └── • 13 Mutation operations - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 3 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹t›.public.‹test› DROP COLUMN ‹pi› - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 106 - │ │ - │ ├── • RefreshStats - │ │ TableID: 106 + │ └── • 7 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 3 @@ -74,44 +89,23 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ IndexID: 4 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 4 - │ │ Kind: 2 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 4 - │ │ IndexID: 4 - │ │ Kind: 2 - │ │ Ordinal: 1 - │ │ TableID: 106 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 5 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 5 - │ │ TableID: 106 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 5 - │ │ Kind: 2 + │ ├── • MakeColumnPublic + │ │ ColumnID: 3 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹t›.public.‹test› DROP COLUMN ‹pi› + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 │ │ TableID: 106 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 4 - │ │ IndexID: 5 - │ │ Kind: 2 - │ │ Ordinal: 1 + │ ├── • RefreshStats │ │ TableID: 106 │ │ │ ├── • SetJobStateOnDescriptor diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index index 01a367c0bc30..b41427f836b1 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index @@ -13,13 +13,16 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ ├── • 4 elements transitioning toward ABSENT │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} -│ │ │ PUBLIC → WRITE_ONLY +│ │ │ │ PUBLIC → WRITE_ONLY +│ │ │ │ +│ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} +│ │ │ rule: "secondary indexes containing column as key reach write-only before column" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 2} -│ │ │ rule: "column dependents removed after column no longer public" +│ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ PUBLIC → VALIDATED @@ -28,58 +31,32 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ rule: "index no longer public before dependents removed" +│ │ rule: "index no longer public before dependents" │ │ -│ ├── • 3 elements transitioning toward PUBLIC +│ ├── • 2 elements transitioning toward PUBLIC │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ ABSENT → BACKFILL_ONLY │ │ │ -│ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} -│ │ │ │ ABSENT → PUBLIC -│ │ │ │ -│ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" +│ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} +│ │ │ ABSENT → PUBLIC +│ │ │ +│ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} +│ │ rule: "index existence precedes index dependents" +│ │ +│ ├── • 2 elements transitioning toward TRANSIENT_ABSENT +│ │ │ +│ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} +│ │ │ ABSENT → DELETE_ONLY │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} │ │ │ ABSENT → PUBLIC │ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} -│ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ rule: "index-column added to index after temp index exists" -│ │ -│ ├── • 1 element transitioning toward TRANSIENT_ABSENT -│ │ │ -│ │ └── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} -│ │ ABSENT → DELETE_ONLY +│ │ rule: "temp index existence precedes index dependents" │ │ │ └── • 9 Mutation operations │ │ -│ ├── • MakeDroppedColumnDeleteAndWriteOnly -│ │ ColumnID: 2 -│ │ TableID: 104 -│ │ -│ ├── • LogEvent -│ │ Element: -│ │ Column: -│ │ columnId: 2 -│ │ pgAttributeNum: 2 -│ │ tableId: 104 -│ │ EventBase: -│ │ Authorization: -│ │ UserName: root -│ │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› -│ │ StatementTag: ALTER TABLE -│ │ TargetMetadata: -│ │ SourceElementID: 1 -│ │ SubWorkID: 1 -│ │ TargetStatus: 1 -│ │ -│ ├── • SetColumnName -│ │ ColumnID: 2 -│ │ Name: crdb_internal_column_2_name_placeholder -│ │ TableID: 104 -│ │ │ ├── • MakeDroppedNonPrimaryIndexDeleteAndWriteOnly │ │ IndexID: 2 │ │ TableID: 104 @@ -111,9 +88,34 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ │ SourceIndexID: 1 │ │ TableID: 104 │ │ -│ └── • AddColumnToIndex -│ ColumnID: 1 -│ IndexID: 4 +│ ├── • AddColumnToIndex +│ │ ColumnID: 1 +│ │ IndexID: 4 +│ │ TableID: 104 +│ │ +│ ├── • MakeDroppedColumnDeleteAndWriteOnly +│ │ ColumnID: 2 +│ │ TableID: 104 +│ │ +│ ├── • LogEvent +│ │ Element: +│ │ Column: +│ │ columnId: 2 +│ │ pgAttributeNum: 2 +│ │ tableId: 104 +│ │ EventBase: +│ │ Authorization: +│ │ UserName: root +│ │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› +│ │ StatementTag: ALTER TABLE +│ │ TargetMetadata: +│ │ SourceElementID: 1 +│ │ SubWorkID: 1 +│ │ TargetStatus: 1 +│ │ +│ └── • SetColumnName +│ ColumnID: 2 +│ Name: crdb_internal_column_2_name_placeholder │ TableID: 104 │ ├── • PreCommitPhase @@ -282,14 +284,23 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ PUBLIC → WRITE_ONLY @@ -298,25 +309,28 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "column no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ VALIDATED → DELETE_ONLY @@ -329,21 +343,31 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ │ │ ├── • SameStagePrecedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ │ rule: "primary index swap" │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 3} - │ │ │ rule: "index named right before index becomes public" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 3} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ rule: "index named right before index becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_pkey, IndexID: 3} │ │ │ ABSENT → PUBLIC │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ rule: "index existence precedes index name and comment" + │ │ rule: "index existence precedes index dependents" │ │ - │ ├── • 1 element transitioning toward TRANSIENT_ABSENT + │ ├── • 2 elements transitioning toward TRANSIENT_ABSENT │ │ │ - │ │ └── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ │ WRITE_ONLY → TRANSIENT_DELETE_ONLY + │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} + │ │ │ WRITE_ONLY → TRANSIENT_DELETE_ONLY + │ │ │ + │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} + │ │ │ PUBLIC → TRANSIENT_ABSENT + │ │ │ + │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 13 Mutation operations + │ └── • 9 Mutation operations │ │ │ ├── • MakeDroppedColumnDeleteOnly │ │ ColumnID: 2 @@ -367,17 +391,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 1 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 @@ -394,49 +407,91 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 1 MutationType op pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 6 MutationType ops pending │ ├── • Stage 2 of 3 in PostCommitNonRevertiblePhase │ │ - │ ├── • 1 element transitioning toward ABSENT + │ ├── • 2 elements transitioning toward ABSENT + │ │ │ + │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ - │ │ └── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ WRITE_ONLY → DELETE_ONLY + │ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ DELETE_ONLY → ABSENT + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} + │ │ │ rule: "dependents removed before index" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ rule: "dependents removed before index" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} + │ │ rule: "dependents removed before index" │ │ - │ └── • 3 Mutation operations + │ ├── • 1 element transitioning toward TRANSIENT_ABSENT + │ │ │ + │ │ └── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} + │ │ │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT + │ │ │ + │ │ └── • Precedence dependency from TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} + │ │ rule: "dependents removed before index" + │ │ + │ └── • 8 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 1 │ │ TableID: 104 │ │ + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ tableId: 104 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TargetStatus: 1 + │ │ + │ ├── • CreateGcJobForIndex + │ │ IndexID: 2 + │ │ StatementForDropJob: + │ │ Statement: ALTER TABLE defaultdb.public.t DROP COLUMN j + │ │ TableID: 104 + │ │ + │ ├── • MakeIndexAbsent + │ │ IndexID: 2 + │ │ TableID: 104 + │ │ + │ ├── • CreateGcJobForIndex + │ │ IndexID: 4 + │ │ TableID: 104 + │ │ + │ ├── • MakeIndexAbsent + │ │ IndexID: 4 + │ │ TableID: 104 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 3 of 3 with 8 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 3 of 3 with 3 MutationType ops pending │ └── • Stage 3 of 3 in PostCommitNonRevertiblePhase │ - ├── • 4 elements transitioning toward ABSENT + ├── • 3 elements transitioning toward ABSENT │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ DELETE_ONLY → ABSENT @@ -448,64 +503,37 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ rule: "dependents removed before column" + │ │ │ │ │ ├── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "indexes containing columns reach absent before column" + │ │ │ rule: "indexes containing column reach absent before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} + │ │ │ rule: "dependents removed before column" │ │ │ │ │ └── • Precedence dependency from ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ rule: "indexes containing columns reach absent before column" + │ │ rule: "indexes containing column reach absent before column" │ │ │ ├── • ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 2} - │ │ rule: "column dependents removed after column no longer public" + │ │ rule: "column no longer public before dependents" │ │ - │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ DELETE_ONLY → ABSENT - │ │ │ - │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} - │ │ │ rule: "dependents removed before index" - │ │ │ - │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} - │ │ │ rule: "dependents removed before index" - │ │ │ - │ │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} - │ │ │ rule: "dependents removed before index" - │ │ │ - │ │ └── • SameStagePrecedence dependency from TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ │ rule: "temp indexes reach absent at the same time as other indexes" - │ │ - │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ └── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ DELETE_ONLY → ABSENT │ │ - │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" - │ │ rule: "dependents removed before index" - │ │ - │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" + │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} │ │ rule: "dependents removed before index" │ │ - │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} + │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} │ │ rule: "dependents removed before index" │ │ - │ └── • SameStagePrecedence dependency from TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ rule: "temp indexes reach absent at the same time as other indexes" - │ - ├── • 1 element transitioning toward TRANSIENT_ABSENT - │ │ - │ └── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT + │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} + │ rule: "dependents removed before index" │ - └── • 10 Mutation operations - │ - ├── • CreateGcJobForIndex - │ IndexID: 4 - │ TableID: 104 - │ - ├── • MakeIndexAbsent - │ IndexID: 4 - │ TableID: 104 + └── • 5 Mutation operations │ ├── • CreateGcJobForIndex │ IndexID: 1 @@ -525,31 +553,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ IndexID: 1 │ TableID: 104 │ - ├── • LogEvent - │ Element: - │ SecondaryIndex: - │ indexId: 2 - │ tableId: 104 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› - │ StatementTag: ALTER TABLE - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TargetStatus: 1 - │ - ├── • CreateGcJobForIndex - │ IndexID: 2 - │ StatementForDropJob: - │ Statement: ALTER TABLE defaultdb.public.t DROP COLUMN j - │ TableID: 104 - │ - ├── • MakeIndexAbsent - │ IndexID: 2 - │ TableID: 104 - │ ├── • MakeColumnAbsent │ ColumnID: 2 │ EventBase: diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_1_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_1_of_7 index e12e80e5dff1..6f6b889b7440 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_1_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_1_of_7 @@ -23,7 +23,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ │ rule: "dependents removed before index" │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ │ DELETE_ONLY → ABSENT @@ -32,12 +35,27 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ │ rule: "dependents removed before index" │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ PUBLIC → ABSENT + │ │ PUBLIC → ABSENT + │ │ + │ └── • skip PUBLIC → ABSENT operations + │ rule: "skip index-column removal ops on index removal" │ ├── • 4 elements transitioning toward PUBLIC │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ WRITE_ONLY → PUBLIC + │ │ │ WRITE_ONLY → PUBLIC + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} + │ │ rule: "column dependents exist before column becomes public" │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ABSENT → PUBLIC @@ -45,13 +63,30 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ VALIDATED → PUBLIC │ │ │ + │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} + │ │ rule: "index dependents exist before index becomes public" │ │ rule: "index named right before index becomes public" │ │ │ └── • IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} │ ABSENT → PUBLIC │ - └── • 13 Mutation operations + └── • 11 Mutation operations + │ + ├── • SetColumnName + │ ColumnID: 2 + │ Name: j + │ TableID: 104 + │ + ├── • SetIndexName + │ IndexID: 2 + │ Name: t_j_idx + │ TableID: 104 │ ├── • MakeColumnPublic │ ColumnID: 2 @@ -68,26 +103,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; ├── • RefreshStats │ TableID: 104 │ - ├── • SetColumnName - │ ColumnID: 2 - │ Name: j - │ TableID: 104 - │ - ├── • SetIndexName - │ IndexID: 2 - │ Name: t_j_idx - │ TableID: 104 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 1 - │ IndexID: 3 - │ TableID: 104 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 1 - │ IndexID: 4 - │ TableID: 104 - │ ├── • MakeAddedSecondaryIndexPublic │ IndexID: 2 │ TableID: 104 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_2_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_2_of_7 index fe64de04fa21..82e4260ba635 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_2_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_2_of_7 @@ -23,18 +23,36 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 4 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ │ ABSENT → PUBLIC @@ -42,28 +60,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 12 Mutation operations - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 2 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 + │ └── • 10 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 2 @@ -75,18 +85,23 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ Name: t_j_idx │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 + │ ├── • MakeColumnPublic + │ │ ColumnID: 2 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TableID: 104 + │ │ + │ ├── • RefreshStats │ │ TableID: 104 │ │ │ ├── • MakeAddedSecondaryIndexPublic diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_3_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_3_of_7 index ba65d4816feb..36bb4b14306e 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_3_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_3_of_7 @@ -23,18 +23,36 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 4 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ │ ABSENT → PUBLIC @@ -42,28 +60,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 12 Mutation operations - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 2 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 + │ └── • 10 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 2 @@ -75,18 +85,23 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ Name: t_j_idx │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 + │ ├── • MakeColumnPublic + │ │ ColumnID: 2 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TableID: 104 + │ │ + │ ├── • RefreshStats │ │ TableID: 104 │ │ │ ├── • MakeAddedSecondaryIndexPublic diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_4_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_4_of_7 index 776127c202b5..6c3b6617fb3c 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_4_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_4_of_7 @@ -23,18 +23,36 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 4 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ │ ABSENT → PUBLIC @@ -42,28 +60,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 12 Mutation operations - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 2 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 + │ └── • 10 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 2 @@ -75,18 +85,23 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ Name: t_j_idx │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 + │ ├── • MakeColumnPublic + │ │ ColumnID: 2 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TableID: 104 + │ │ + │ ├── • RefreshStats │ │ TableID: 104 │ │ │ ├── • MakeAddedSecondaryIndexPublic diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_5_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_5_of_7 index fcc755d31382..bf419182fc97 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_5_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_5_of_7 @@ -17,18 +17,36 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ │ MERGE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 4 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ │ ABSENT → PUBLIC @@ -36,28 +54,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 11 Mutation operations - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 2 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 + │ └── • 9 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 2 @@ -69,18 +79,23 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ Name: t_j_idx │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 + │ ├── • MakeColumnPublic + │ │ ColumnID: 2 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TableID: 104 + │ │ + │ ├── • RefreshStats │ │ TableID: 104 │ │ │ ├── • MakeAddedSecondaryIndexPublic diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_6_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_6_of_7 index 93f81245432a..c3973d89c23d 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_6_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_6_of_7 @@ -17,18 +17,36 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ │ MERGE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 4 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ │ ABSENT → PUBLIC @@ -36,28 +54,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 11 Mutation operations - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 2 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 + │ └── • 9 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 2 @@ -69,18 +79,23 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ Name: t_j_idx │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 + │ ├── • MakeColumnPublic + │ │ ColumnID: 2 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TableID: 104 + │ │ + │ ├── • RefreshStats │ │ TableID: 104 │ │ │ ├── • MakeAddedSecondaryIndexPublic diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_7_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_7_of_7 index a4803d5a9167..b117b12c35da 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_7_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index.rollback_7_of_7 @@ -17,18 +17,36 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 4 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ │ ABSENT → PUBLIC @@ -36,28 +54,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 11 Mutation operations - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 2 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 + │ └── • 9 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 2 @@ -73,18 +83,23 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 + │ ├── • MakeColumnPublic + │ │ ColumnID: 2 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TableID: 104 + │ │ + │ ├── • RefreshStats │ │ TableID: 104 │ │ │ ├── • MakeAddedSecondaryIndexPublic diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_index_hash_sharded_index b/pkg/sql/schemachanger/testdata/explain_verbose/drop_index_hash_sharded_index index 0c01eace46c8..41a029039426 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_index_hash_sharded_index +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_index_hash_sharded_index @@ -14,13 +14,16 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ ├── • 4 elements transitioning toward ABSENT │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 3} -│ │ │ PUBLIC → WRITE_ONLY +│ │ │ │ PUBLIC → WRITE_ONLY +│ │ │ │ +│ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} +│ │ │ rule: "secondary indexes containing column as key reach write-only before column" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: crdb_internal_j_shard_16, ColumnID: 3} │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 3} -│ │ │ rule: "column dependents removed after column no longer public" +│ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ PUBLIC → VALIDATED @@ -29,10 +32,19 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ rule: "index no longer public before dependents removed" +│ │ rule: "index no longer public before dependents" │ │ │ └── • 5 Mutation operations │ │ +│ ├── • MakeDroppedNonPrimaryIndexDeleteAndWriteOnly +│ │ IndexID: 2 +│ │ TableID: 104 +│ │ +│ ├── • SetIndexName +│ │ IndexID: 2 +│ │ Name: crdb_internal_index_2_name_placeholder +│ │ TableID: 104 +│ │ │ ├── • MakeDroppedColumnDeleteAndWriteOnly │ │ ColumnID: 3 │ │ TableID: 104 @@ -54,18 +66,9 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ SubWorkID: 1 │ │ TargetStatus: 1 │ │ -│ ├── • SetColumnName -│ │ ColumnID: 3 -│ │ Name: crdb_internal_column_3_name_placeholder -│ │ TableID: 104 -│ │ -│ ├── • MakeDroppedNonPrimaryIndexDeleteAndWriteOnly -│ │ IndexID: 2 -│ │ TableID: 104 -│ │ -│ └── • SetIndexName -│ IndexID: 2 -│ Name: crdb_internal_index_2_name_placeholder +│ └── • SetColumnName +│ ColumnID: 3 +│ Name: crdb_internal_column_3_name_placeholder │ TableID: 104 │ ├── • PreCommitPhase @@ -85,7 +88,7 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ - 104 │ JobID: 1 │ NonCancelable: true -│ RunningStatus: PostCommitNonRevertiblePhase stage 1 of 2 with 7 MutationType ops pending +│ RunningStatus: PostCommitNonRevertiblePhase stage 1 of 2 with 4 MutationType ops pending │ Statements: │ - statement: DROP INDEX idx CASCADE │ redactedstatement: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE @@ -103,29 +106,32 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 3} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ VALIDATED → DELETE_ONLY @@ -136,7 +142,7 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ └── • ConstraintName:{DescID: 104, Name: check_crdb_internal_j_shard_16, ConstraintID: 2} │ │ PUBLIC → ABSENT │ │ - │ └── • 9 Mutation operations + │ └── • 6 Mutation operations │ │ │ ├── • MakeDroppedColumnDeleteOnly │ │ ColumnID: 3 @@ -153,23 +159,6 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ IndexID: 2 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ Ordinal: 1 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ @@ -192,28 +181,28 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ │ │ └── • Precedence dependency from ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ rule: "indexes containing columns reach absent before column" + │ │ rule: "indexes containing column reach absent before column" │ │ │ ├── • ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 3} - │ │ rule: "column dependents removed after column no longer public" + │ │ rule: "column no longer public before dependents" │ │ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ DELETE_ONLY → ABSENT │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" │ │ rule: "dependents removed before index" │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" │ │ rule: "dependents removed before index" │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" │ │ rule: "dependents removed before index" │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: idx, IndexID: 2} diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_index_partial_expression_index b/pkg/sql/schemachanger/testdata/explain_verbose/drop_index_partial_expression_index index a758463eaff7..f97757bb4e55 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_index_partial_expression_index +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_index_partial_expression_index @@ -14,13 +14,16 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ ├── • 4 elements transitioning toward ABSENT │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 3} -│ │ │ PUBLIC → WRITE_ONLY +│ │ │ │ PUBLIC → WRITE_ONLY +│ │ │ │ +│ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} +│ │ │ rule: "secondary indexes containing column as key reach write-only before column" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 3} -│ │ │ rule: "column dependents removed after column no longer public" +│ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ PUBLIC → VALIDATED @@ -29,10 +32,19 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ rule: "index no longer public before dependents removed" +│ │ rule: "index no longer public before dependents" │ │ │ └── • 5 Mutation operations │ │ +│ ├── • MakeDroppedNonPrimaryIndexDeleteAndWriteOnly +│ │ IndexID: 2 +│ │ TableID: 104 +│ │ +│ ├── • SetIndexName +│ │ IndexID: 2 +│ │ Name: crdb_internal_index_2_name_placeholder +│ │ TableID: 104 +│ │ │ ├── • MakeDroppedColumnDeleteAndWriteOnly │ │ ColumnID: 3 │ │ TableID: 104 @@ -54,18 +66,9 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ SubWorkID: 1 │ │ TargetStatus: 1 │ │ -│ ├── • SetColumnName -│ │ ColumnID: 3 -│ │ Name: crdb_internal_column_3_name_placeholder -│ │ TableID: 104 -│ │ -│ ├── • MakeDroppedNonPrimaryIndexDeleteAndWriteOnly -│ │ IndexID: 2 -│ │ TableID: 104 -│ │ -│ └── • SetIndexName -│ IndexID: 2 -│ Name: crdb_internal_index_2_name_placeholder +│ └── • SetColumnName +│ ColumnID: 3 +│ Name: crdb_internal_column_3_name_placeholder │ TableID: 104 │ ├── • PreCommitPhase @@ -85,7 +88,7 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ - 104 │ JobID: 1 │ NonCancelable: true -│ RunningStatus: PostCommitNonRevertiblePhase stage 1 of 2 with 4 MutationType ops pending +│ RunningStatus: PostCommitNonRevertiblePhase stage 1 of 2 with 2 MutationType ops pending │ Statements: │ - statement: DROP INDEX idx CASCADE │ redactedstatement: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE @@ -103,25 +106,28 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 3} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ VALIDATED → DELETE_ONLY │ │ - │ └── • 6 Mutation operations + │ └── • 4 Mutation operations │ │ │ ├── • MakeDroppedColumnDeleteOnly │ │ ColumnID: 3 @@ -131,17 +137,6 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ IndexID: 2 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ @@ -164,30 +159,31 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ │ │ └── • Precedence dependency from ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ rule: "indexes containing columns reach absent before column" + │ │ rule: "indexes containing column reach absent before column" │ │ │ ├── • ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 3} - │ │ rule: "column dependents removed after column no longer public" + │ │ rule: "column no longer public before dependents" │ │ │ ├── • SecondaryIndexPartial:{DescID: 104, IndexID: 2} │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ rule: "index no longer public before dependents removed" + │ │ rule: "index no longer public before dependents" │ │ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ DELETE_ONLY → ABSENT │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" │ │ rule: "dependents removed before index" │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" │ │ rule: "dependents removed before index" │ │ │ ├── • SameStagePrecedence dependency from ABSENT SecondaryIndexPartial:{DescID: 104, IndexID: 2} diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_index_vanilla_index b/pkg/sql/schemachanger/testdata/explain_verbose/drop_index_vanilla_index index 4bf47a17ff21..67d267509c3d 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_index_vanilla_index +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_index_vanilla_index @@ -20,7 +20,7 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ rule: "index no longer public before dependents removed" +│ │ rule: "index no longer public before dependents" │ │ │ └── • 2 Mutation operations │ │ @@ -50,7 +50,7 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ - 104 │ JobID: 1 │ NonCancelable: true -│ RunningStatus: PostCommitNonRevertiblePhase stage 1 of 2 with 3 MutationType ops pending +│ RunningStatus: PostCommitNonRevertiblePhase stage 1 of 2 with 1 MutationType op pending │ Statements: │ - statement: DROP INDEX idx CASCADE │ redactedstatement: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE @@ -65,41 +65,30 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ VALIDATED → DELETE_ONLY │ │ - │ └── • 5 Mutation operations + │ └── • 3 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 2 - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 2 - │ │ Kind: 1 - │ │ TableID: 104 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ @@ -116,11 +105,9 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ DELETE_ONLY → ABSENT │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" │ │ rule: "dependents removed before index" │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" │ │ rule: "dependents removed before index" │ │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: idx, IndexID: 2} diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_1_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_1_of_7 index 4b45474c0128..19a74f8b3ddb 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_1_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_1_of_7 @@ -15,10 +15,16 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; ├── • 4 elements transitioning toward ABSENT │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ BACKFILL_ONLY → ABSENT @@ -40,14 +46,47 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ WRITE_ONLY → PUBLIC │ │ │ - │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ rule: "ensure columns are in increasing order" + │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: k, ColumnID: 3} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC ColumnDefaultExpression:{DescID: 104, ColumnID: 3} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC ColumnOnUpdateExpression:{DescID: 104, ColumnID: 3} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ rule: "ensure columns are in increasing order" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} + │ │ rule: "column dependents exist before column becomes public" │ │ │ ├── • ColumnName:{DescID: 104, Name: k, ColumnID: 3} │ │ ABSENT → PUBLIC │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ WRITE_ONLY → PUBLIC + │ │ │ WRITE_ONLY → PUBLIC + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ rule: "column dependents exist before column becomes public" │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ WRITE_ONLY → PUBLIC @@ -55,13 +94,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 3} │ │ │ rule: "ensure columns are in increasing order" │ │ │ - │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ rule: "ensure columns are in increasing order" + │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ rule: "ensure columns are in increasing order" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ + │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ rule: "column dependents exist before column becomes public" │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ VALIDATED → PUBLIC │ │ │ + │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ + │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ rule: "index dependents exist before index becomes public" │ │ rule: "index named right before index becomes public" │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} @@ -73,38 +131,13 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ ABSENT → PUBLIC │ - └── • 19 Mutation operations + └── • 17 Mutation operations │ ├── • SetColumnName │ ColumnID: 3 │ Name: k │ TableID: 104 │ - ├── • MakeColumnPublic - │ ColumnID: 2 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ StatementTag: ALTER TABLE - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TableID: 104 - │ - ├── • RefreshStats - │ TableID: 104 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 1 - │ IndexID: 3 - │ TableID: 104 - │ - ├── • RemoveColumnFromIndex - │ ColumnID: 1 - │ IndexID: 4 - │ TableID: 104 - │ ├── • SetColumnName │ ColumnID: 2 │ Name: j @@ -129,23 +162,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ TableID: 104 │ ├── • MakeColumnPublic - │ ColumnID: 3 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹k› CASCADE - │ StatementTag: ALTER TABLE - │ TargetMetadata: - │ SourceElementID: 1 - │ StatementID: 1 - │ SubWorkID: 1 - │ TableID: 104 - │ - ├── • RefreshStats - │ TableID: 104 - │ - ├── • MakeColumnPublic - │ ColumnID: 4 + │ ColumnID: 2 │ EventBase: │ Authorization: │ UserName: root @@ -182,6 +199,37 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ IndexID: 3 │ TableID: 104 │ + ├── • MakeColumnPublic + │ ColumnID: 3 + │ EventBase: + │ Authorization: + │ UserName: root + │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹k› CASCADE + │ StatementTag: ALTER TABLE + │ TargetMetadata: + │ SourceElementID: 1 + │ StatementID: 1 + │ SubWorkID: 1 + │ TableID: 104 + │ + ├── • RefreshStats + │ TableID: 104 + │ + ├── • MakeColumnPublic + │ ColumnID: 4 + │ EventBase: + │ Authorization: + │ UserName: root + │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE + │ StatementTag: ALTER TABLE + │ TargetMetadata: + │ SourceElementID: 1 + │ SubWorkID: 1 + │ TableID: 104 + │ + ├── • RefreshStats + │ TableID: 104 + │ ├── • RemoveJobStateFromDescriptor │ DescriptorID: 104 │ JobID: 1 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_2_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_2_of_7 index 9715397944ff..47440d25bde8 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_2_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_2_of_7 @@ -15,10 +15,16 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ ├── • 4 elements transitioning toward ABSENT │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ │ BACKFILL_ONLY → ABSENT @@ -37,14 +43,47 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: k, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnDefaultExpression:{DescID: 104, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnOnUpdateExpression:{DescID: 104, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: k, ColumnID: 3} │ │ │ ABSENT → PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ │ WRITE_ONLY → PUBLIC @@ -52,13 +91,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 3} │ │ │ │ rule: "ensure columns are in increasing order" │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} @@ -70,38 +128,13 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 18 Mutation operations + │ └── • 16 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 3 │ │ Name: k │ │ TableID: 104 │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 2 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -122,23 +155,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic - │ │ ColumnID: 3 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹k› CASCADE - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ StatementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 4 + │ │ ColumnID: 2 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -175,6 +192,37 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ IndexID: 3 │ │ TableID: 104 │ │ + │ ├── • MakeColumnPublic + │ │ ColumnID: 3 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹k› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ StatementID: 1 + │ │ SubWorkID: 1 + │ │ TableID: 104 + │ │ + │ ├── • RefreshStats + │ │ TableID: 104 + │ │ + │ ├── • MakeColumnPublic + │ │ ColumnID: 4 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TableID: 104 + │ │ + │ ├── • RefreshStats + │ │ TableID: 104 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_3_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_3_of_7 index 230bb9d974fb..436f63476a4e 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_3_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_3_of_7 @@ -15,10 +15,16 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ ├── • 4 elements transitioning toward ABSENT │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ │ BACKFILL_ONLY → ABSENT @@ -37,14 +43,47 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: k, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnDefaultExpression:{DescID: 104, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnOnUpdateExpression:{DescID: 104, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: k, ColumnID: 3} │ │ │ ABSENT → PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ │ WRITE_ONLY → PUBLIC @@ -52,13 +91,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 3} │ │ │ │ rule: "ensure columns are in increasing order" │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} @@ -70,38 +128,13 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 18 Mutation operations + │ └── • 16 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 3 │ │ Name: k │ │ TableID: 104 │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 2 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -122,23 +155,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic - │ │ ColumnID: 3 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹k› CASCADE - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ StatementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 - │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 4 + │ │ ColumnID: 2 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -175,6 +192,37 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ IndexID: 3 │ │ TableID: 104 │ │ + │ ├── • MakeColumnPublic + │ │ ColumnID: 3 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹k› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ StatementID: 1 + │ │ SubWorkID: 1 + │ │ TableID: 104 + │ │ + │ ├── • RefreshStats + │ │ TableID: 104 + │ │ + │ ├── • MakeColumnPublic + │ │ ColumnID: 4 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TableID: 104 + │ │ + │ ├── • RefreshStats + │ │ TableID: 104 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_4_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_4_of_7 index 31928ceaac83..ccccecda5617 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_4_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_4_of_7 @@ -15,10 +15,16 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ ├── • 4 elements transitioning toward ABSENT │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ │ DELETE_ONLY → ABSENT @@ -37,14 +43,47 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: k, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnDefaultExpression:{DescID: 104, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnOnUpdateExpression:{DescID: 104, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: k, ColumnID: 3} │ │ │ ABSENT → PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ │ WRITE_ONLY → PUBLIC @@ -52,13 +91,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 3} │ │ │ │ rule: "ensure columns are in increasing order" │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} @@ -70,38 +128,13 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 18 Mutation operations + │ └── • 16 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 3 │ │ Name: k │ │ TableID: 104 │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 2 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -141,6 +174,25 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic + │ │ ColumnID: 2 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TableID: 104 + │ │ + │ ├── • RefreshStats + │ │ TableID: 104 + │ │ + │ ├── • MakeAddedSecondaryIndexPublic + │ │ IndexID: 2 + │ │ TableID: 104 + │ │ + │ ├── • MakeColumnPublic │ │ ColumnID: 3 │ │ EventBase: │ │ Authorization: @@ -171,10 +223,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • MakeAddedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_5_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_5_of_7 index e02489db9dbe..59017a11e83e 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_5_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_5_of_7 @@ -15,10 +15,16 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ ├── • 4 elements transitioning toward ABSENT │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ MERGE_ONLY → DELETE_ONLY @@ -31,14 +37,47 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: k, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnDefaultExpression:{DescID: 104, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnOnUpdateExpression:{DescID: 104, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: k, ColumnID: 3} │ │ │ ABSENT → PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ │ WRITE_ONLY → PUBLIC @@ -46,13 +85,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 3} │ │ │ │ rule: "ensure columns are in increasing order" │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} @@ -64,55 +122,53 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 17 Mutation operations + │ └── • 15 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 3 │ │ Name: k │ │ TableID: 104 │ │ - │ ├── • MakeColumnPublic + │ ├── • SetColumnName │ │ ColumnID: 2 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 + │ │ Name: j │ │ TableID: 104 │ │ - │ ├── • RefreshStats + │ ├── • SetColumnName + │ │ ColumnID: 4 + │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: t_expr_k_idx │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 + │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • SetColumnName + │ ├── • MakeColumnPublic │ │ ColumnID: 2 - │ │ Name: j + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 │ │ TableID: 104 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 4 - │ │ Name: crdb_internal_idx_expr + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • SetIndexName + │ ├── • MakeAddedSecondaryIndexPublic │ │ IndexID: 2 - │ │ Name: t_expr_k_idx │ │ TableID: 104 │ │ │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 4 + │ │ IndexID: 3 │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic @@ -146,14 +202,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • MakeAddedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_6_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_6_of_7 index b724c0dae4dc..e35e72f2c47f 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_6_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_6_of_7 @@ -15,10 +15,16 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ ├── • 4 elements transitioning toward ABSENT │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ MERGE_ONLY → DELETE_ONLY @@ -31,14 +37,47 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: k, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnDefaultExpression:{DescID: 104, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnOnUpdateExpression:{DescID: 104, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: k, ColumnID: 3} │ │ │ ABSENT → PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ │ WRITE_ONLY → PUBLIC @@ -46,13 +85,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 3} │ │ │ │ rule: "ensure columns are in increasing order" │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} @@ -64,55 +122,53 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 17 Mutation operations + │ └── • 15 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 3 │ │ Name: k │ │ TableID: 104 │ │ - │ ├── • MakeColumnPublic + │ ├── • SetColumnName │ │ ColumnID: 2 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 + │ │ Name: j │ │ TableID: 104 │ │ - │ ├── • RefreshStats + │ ├── • SetColumnName + │ │ ColumnID: 4 + │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: t_expr_k_idx │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 + │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • SetColumnName + │ ├── • MakeColumnPublic │ │ ColumnID: 2 - │ │ Name: j + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 │ │ TableID: 104 │ │ - │ ├── • SetColumnName - │ │ ColumnID: 4 - │ │ Name: crdb_internal_idx_expr + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • SetIndexName + │ ├── • MakeAddedSecondaryIndexPublic │ │ IndexID: 2 - │ │ Name: t_expr_k_idx │ │ TableID: 104 │ │ │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 4 + │ │ IndexID: 3 │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic @@ -146,14 +202,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • MakeAddedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • MakeDroppedIndexDeleteOnly - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_7_of_7 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_7_of_7 index e8d51b766136..c386157dc870 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_7_of_7 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.rollback_7_of_7 @@ -15,10 +15,16 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ ├── • 4 elements transitioning toward ABSENT │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ WRITE_ONLY → DELETE_ONLY @@ -31,14 +37,47 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ WRITE_ONLY → PUBLIC │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: k, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnDefaultExpression:{DescID: 104, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnOnUpdateExpression:{DescID: 104, ColumnID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: k, ColumnID: 3} │ │ │ ABSENT → PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} - │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ WRITE_ONLY → PUBLIC + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} │ │ │ │ WRITE_ONLY → PUBLIC @@ -46,13 +85,32 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 3} │ │ │ │ rule: "ensure columns are in increasing order" │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} - │ │ │ rule: "ensure columns are in increasing order" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "ensure columns are in increasing order" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "column dependents exist before column becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ rule: "column dependents exist before column becomes public" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ │ VALIDATED → PUBLIC │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} @@ -64,38 +122,13 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ ABSENT → PUBLIC │ │ - │ └── • 17 Mutation operations + │ └── • 15 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 3 │ │ Name: k │ │ TableID: 104 │ │ - │ ├── • MakeColumnPublic - │ │ ColumnID: 2 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TableID: 104 - │ │ - │ ├── • RefreshStats - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 1 - │ │ IndexID: 4 - │ │ TableID: 104 - │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -120,6 +153,25 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ TableID: 104 │ │ │ ├── • MakeColumnPublic + │ │ ColumnID: 2 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TableID: 104 + │ │ + │ ├── • RefreshStats + │ │ TableID: 104 + │ │ + │ ├── • MakeAddedSecondaryIndexPublic + │ │ IndexID: 2 + │ │ TableID: 104 + │ │ + │ ├── • MakeColumnPublic │ │ ColumnID: 3 │ │ EventBase: │ │ Authorization: @@ -150,10 +202,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • MakeAddedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.statement_1_of_2 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.statement_1_of_2 index af7738e30e64..f35c6c887d52 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.statement_1_of_2 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.statement_1_of_2 @@ -19,16 +19,19 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 2} -│ │ │ rule: "column dependents removed after column no longer public" +│ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 4} -│ │ │ PUBLIC → WRITE_ONLY +│ │ │ │ PUBLIC → WRITE_ONLY +│ │ │ │ +│ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} +│ │ │ rule: "secondary indexes containing column as key reach write-only before column" │ │ │ │ │ ├── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 4} -│ │ │ rule: "column dependents removed after column no longer public" +│ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ PUBLIC → VALIDATED @@ -37,9 +40,9 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ rule: "index no longer public before dependents removed" +│ │ rule: "index no longer public before dependents" │ │ -│ ├── • 5 elements transitioning toward PUBLIC +│ ├── • 3 elements transitioning toward PUBLIC │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ │ ABSENT → BACKFILL_ONLY @@ -48,32 +51,30 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" +│ │ │ rule: "index existence precedes index dependents" │ │ │ -│ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} -│ │ │ │ ABSENT → PUBLIC -│ │ │ │ -│ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} -│ │ │ rule: "index-column added to index after index exists" +│ │ └── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} +│ │ │ ABSENT → PUBLIC +│ │ │ +│ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} +│ │ rule: "index existence precedes index dependents" +│ │ +│ ├── • 3 elements transitioning toward TRANSIENT_ABSENT +│ │ │ +│ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} +│ │ │ ABSENT → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} │ │ │ │ ABSENT → PUBLIC │ │ │ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} -│ │ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ │ rule: "index-column added to index after temp index exists" +│ │ │ rule: "temp index existence precedes index dependents" │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} │ │ │ ABSENT → PUBLIC │ │ │ │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} -│ │ rule: "temp index exists before columns, partitioning, and partial" -│ │ rule: "index-column added to index after temp index exists" -│ │ -│ ├── • 1 element transitioning toward TRANSIENT_ABSENT -│ │ │ -│ │ └── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} -│ │ ABSENT → DELETE_ONLY +│ │ rule: "temp index existence precedes index dependents" │ │ │ └── • 14 Mutation operations │ │ @@ -102,32 +103,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ Name: crdb_internal_column_2_name_placeholder │ │ TableID: 104 │ │ -│ ├── • MakeDroppedColumnDeleteAndWriteOnly -│ │ ColumnID: 4 -│ │ TableID: 104 -│ │ -│ ├── • LogEvent -│ │ Element: -│ │ Column: -│ │ columnId: 4 -│ │ isInaccessible: true -│ │ pgAttributeNum: 4 -│ │ tableId: 104 -│ │ EventBase: -│ │ Authorization: -│ │ UserName: root -│ │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE -│ │ StatementTag: ALTER TABLE -│ │ TargetMetadata: -│ │ SourceElementID: 1 -│ │ SubWorkID: 1 -│ │ TargetStatus: 1 -│ │ -│ ├── • SetColumnName -│ │ ColumnID: 4 -│ │ Name: crdb_internal_column_4_name_placeholder -│ │ TableID: 104 -│ │ │ ├── • MakeDroppedNonPrimaryIndexDeleteAndWriteOnly │ │ IndexID: 2 │ │ TableID: 104 @@ -170,10 +145,36 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ IndexID: 4 │ │ TableID: 104 │ │ -│ └── • AddColumnToIndex -│ ColumnID: 3 -│ IndexID: 4 -│ Kind: 2 +│ ├── • AddColumnToIndex +│ │ ColumnID: 3 +│ │ IndexID: 4 +│ │ Kind: 2 +│ │ TableID: 104 +│ │ +│ ├── • MakeDroppedColumnDeleteAndWriteOnly +│ │ ColumnID: 4 +│ │ TableID: 104 +│ │ +│ ├── • LogEvent +│ │ Element: +│ │ Column: +│ │ columnId: 4 +│ │ isInaccessible: true +│ │ pgAttributeNum: 4 +│ │ tableId: 104 +│ │ EventBase: +│ │ Authorization: +│ │ UserName: root +│ │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE +│ │ StatementTag: ALTER TABLE +│ │ TargetMetadata: +│ │ SourceElementID: 1 +│ │ SubWorkID: 1 +│ │ TargetStatus: 1 +│ │ +│ └── • SetColumnName +│ ColumnID: 4 +│ Name: crdb_internal_column_4_name_placeholder │ TableID: 104 │ ├── • PreCommitPhase @@ -351,20 +352,32 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ PUBLIC → WRITE_ONLY @@ -373,34 +386,37 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 4} + │ │ │ │ rule: "column no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ VALIDATED → DELETE_ONLY @@ -413,21 +429,40 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ ├── • SameStagePrecedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ │ rule: "primary index swap" │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 3} - │ │ │ rule: "index named right before index becomes public" + │ │ │ ├── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 3} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ rule: "index named right before index becomes public" + │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ + │ │ │ └── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_pkey, IndexID: 3} │ │ │ ABSENT → PUBLIC │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ rule: "index existence precedes index name and comment" + │ │ rule: "index existence precedes index dependents" │ │ - │ ├── • 1 element transitioning toward TRANSIENT_ABSENT + │ ├── • 3 elements transitioning toward TRANSIENT_ABSENT │ │ │ - │ │ └── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ │ WRITE_ONLY → TRANSIENT_DELETE_ONLY + │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} + │ │ │ WRITE_ONLY → TRANSIENT_DELETE_ONLY + │ │ │ + │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} + │ │ │ │ PUBLIC → TRANSIENT_ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" + │ │ │ + │ │ └── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} + │ │ │ PUBLIC → TRANSIENT_ABSENT + │ │ │ + │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 16 Mutation operations + │ └── • 10 Mutation operations │ │ │ ├── • MakeDroppedColumnDeleteOnly │ │ ColumnID: 2 @@ -455,24 +490,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ IndexID: 4 │ │ 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 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 @@ -489,55 +506,131 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ 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 │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 1 MutationType op pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 7 MutationType ops pending │ ├── • Stage 2 of 3 in PostCommitNonRevertiblePhase │ │ - │ ├── • 1 element transitioning toward ABSENT + │ ├── • 4 elements transitioning toward ABSENT + │ │ │ + │ │ ├── • Column:{DescID: 104, ColumnID: 4} + │ │ │ │ DELETE_ONLY → ABSENT + │ │ │ │ + │ │ │ ├── • Precedence dependency from ABSENT ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ │ rule: "dependents removed before column" + │ │ │ │ + │ │ │ ├── • SameStagePrecedence dependency from ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "dependents removed before column" + │ │ │ │ rule: "column type removed right before column when not dropping relation" + │ │ │ │ + │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "dependents removed before column" + │ │ │ │ + │ │ │ └── • Precedence dependency from ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "indexes containing column reach absent before column" + │ │ │ + │ │ ├── • ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 4} + │ │ │ rule: "column no longer public before dependents" + │ │ │ + │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ WRITE_ONLY → DELETE_ONLY + │ │ │ + │ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ DELETE_ONLY → ABSENT + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ rule: "dependents removed before index" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ rule: "dependents removed before index" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ rule: "dependents removed before index" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ rule: "dependents removed before index" + │ │ + │ ├── • 1 element transitioning toward TRANSIENT_ABSENT │ │ │ - │ │ └── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ WRITE_ONLY → DELETE_ONLY + │ │ └── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} + │ │ │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT + │ │ │ + │ │ ├── • Precedence dependency from TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} + │ │ │ rule: "dependents removed before index" + │ │ │ + │ │ └── • Precedence dependency from TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} + │ │ rule: "dependents removed before index" │ │ - │ └── • 3 Mutation operations + │ └── • 9 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 1 │ │ TableID: 104 │ │ + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ tableId: 104 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TargetStatus: 1 + │ │ + │ ├── • CreateGcJobForIndex + │ │ IndexID: 2 + │ │ StatementForDropJob: + │ │ Statement: ALTER TABLE defaultdb.public.t DROP COLUMN j CASCADE + │ │ TableID: 104 + │ │ + │ ├── • MakeIndexAbsent + │ │ IndexID: 2 + │ │ TableID: 104 + │ │ + │ ├── • CreateGcJobForIndex + │ │ IndexID: 4 + │ │ TableID: 104 + │ │ + │ ├── • MakeIndexAbsent + │ │ IndexID: 4 + │ │ TableID: 104 + │ │ + │ ├── • MakeColumnAbsent + │ │ ColumnID: 4 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TableID: 104 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 3 of 3 with 9 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 3 of 3 with 3 MutationType ops pending │ └── • Stage 3 of 3 in PostCommitNonRevertiblePhase │ - ├── • 6 elements transitioning toward ABSENT + ├── • 3 elements transitioning toward ABSENT │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ DELETE_ONLY → ABSENT @@ -549,87 +642,34 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ rule: "dependents removed before column" + │ │ │ │ │ └── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ rule: "indexes containing columns reach absent before column" + │ │ rule: "indexes containing column reach absent before column" │ │ │ ├── • ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 2} │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 2} - │ │ rule: "column dependents removed after column no longer public" + │ │ rule: "column no longer public before dependents" │ │ - │ ├── • Column:{DescID: 104, ColumnID: 4} - │ │ │ DELETE_ONLY → ABSENT - │ │ │ - │ │ ├── • Precedence dependency from ABSENT ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} - │ │ │ rule: "dependents removed before column" - │ │ │ - │ │ ├── • SameStagePrecedence dependency from ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} - │ │ │ rule: "dependents removed before column" - │ │ │ rule: "column type removed right before column when not dropping relation" - │ │ │ - │ │ └── • Precedence dependency from ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ rule: "indexes containing columns reach absent before column" - │ │ - │ ├── • ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} - │ │ │ PUBLIC → ABSENT - │ │ │ - │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 4} - │ │ rule: "column dependents removed after column no longer public" - │ │ - │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ DELETE_ONLY → ABSENT - │ │ │ - │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} - │ │ │ rule: "dependents removed before index" - │ │ │ - │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} - │ │ │ rule: "dependents removed before index" - │ │ │ - │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} - │ │ │ rule: "dependents removed before index" - │ │ │ - │ │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} - │ │ │ rule: "dependents removed before index" - │ │ │ - │ │ └── • SameStagePrecedence dependency from TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ │ rule: "temp indexes reach absent at the same time as other indexes" - │ │ - │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ └── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ DELETE_ONLY → ABSENT │ │ - │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" - │ │ rule: "dependents removed before index" - │ │ - │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" + │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} │ │ rule: "dependents removed before index" │ │ - │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" + │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} │ │ rule: "dependents removed before index" │ │ - │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} │ │ rule: "dependents removed before index" │ │ - │ └── • SameStagePrecedence dependency from TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ rule: "temp indexes reach absent at the same time as other indexes" + │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} + │ rule: "dependents removed before index" │ - ├── • 1 element transitioning toward TRANSIENT_ABSENT - │ │ - │ └── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT - │ - └── • 11 Mutation operations - │ - ├── • CreateGcJobForIndex - │ IndexID: 4 - │ TableID: 104 - │ - ├── • MakeIndexAbsent - │ IndexID: 4 - │ TableID: 104 + └── • 5 Mutation operations │ ├── • CreateGcJobForIndex │ IndexID: 1 @@ -649,31 +689,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ IndexID: 1 │ TableID: 104 │ - ├── • LogEvent - │ Element: - │ SecondaryIndex: - │ indexId: 2 - │ tableId: 104 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE - │ StatementTag: ALTER TABLE - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TargetStatus: 1 - │ - ├── • CreateGcJobForIndex - │ IndexID: 2 - │ StatementForDropJob: - │ Statement: ALTER TABLE defaultdb.public.t DROP COLUMN j CASCADE - │ TableID: 104 - │ - ├── • MakeIndexAbsent - │ IndexID: 2 - │ TableID: 104 - │ ├── • MakeColumnAbsent │ ColumnID: 2 │ EventBase: @@ -686,18 +701,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ SubWorkID: 1 │ TableID: 104 │ - ├── • MakeColumnAbsent - │ ColumnID: 4 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE - │ StatementTag: ALTER TABLE - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TableID: 104 - │ ├── • RemoveJobStateFromDescriptor │ DescriptorID: 104 │ JobID: 1 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.statement_2_of_2 b/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.statement_2_of_2 index fba8a52a838f..2d856b577e53 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.statement_2_of_2 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_multiple_columns_separate_statements.statement_2_of_2 @@ -14,13 +14,16 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN k CASCADE; │ ├── • 2 elements transitioning toward ABSENT │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 3} -│ │ │ PUBLIC → WRITE_ONLY +│ │ │ │ PUBLIC → WRITE_ONLY +│ │ │ │ +│ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} +│ │ │ rule: "secondary indexes containing column as key reach write-only before column" │ │ │ │ │ └── • ColumnName:{DescID: 104, Name: k, ColumnID: 3} │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 3} -│ │ rule: "column dependents removed after column no longer public" +│ │ rule: "column no longer public before dependents" │ │ │ └── • 3 Mutation operations │ │ @@ -225,20 +228,35 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN k CASCADE; │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 2} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 3} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ PUBLIC → WRITE_ONLY @@ -247,43 +265,58 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN k CASCADE; │ │ │ │ PUBLIC → ABSENT │ │ │ │ │ │ │ └── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 4} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 3} + │ │ │ │ rule: "column no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" + │ │ │ │ + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "secondary index in DELETE_ONLY before removing columns" + │ │ │ ├── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ - │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ └── • skip PUBLIC → ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ VALIDATED → DELETE_ONLY │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 3} + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ └── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 3} + │ │ │ rule: "column no longer public before dependents" + │ │ │ + │ │ └── • skip PUBLIC → ABSENT operations + │ │ rule: "skip index-column removal ops on index removal" │ │ │ ├── • 2 elements transitioning toward PUBLIC │ │ │ @@ -293,21 +326,31 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN k CASCADE; │ │ │ ├── • SameStagePrecedence dependency from VALIDATED PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ │ │ rule: "primary index swap" │ │ │ │ + │ │ │ ├── • Precedence dependency from PUBLIC IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} + │ │ │ │ rule: "index dependents exist before index becomes public" + │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 3} + │ │ │ rule: "index dependents exist before index becomes public" │ │ │ rule: "index named right before index becomes public" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_pkey, IndexID: 3} │ │ │ ABSENT → PUBLIC │ │ │ │ │ └── • Precedence dependency from BACKFILL_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} - │ │ rule: "index existence precedes index name and comment" + │ │ rule: "index existence precedes index dependents" │ │ - │ ├── • 1 element transitioning toward TRANSIENT_ABSENT + │ ├── • 2 elements transitioning toward TRANSIENT_ABSENT + │ │ │ + │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} + │ │ │ │ PUBLIC → TRANSIENT_ABSENT + │ │ │ │ + │ │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ WRITE_ONLY → TRANSIENT_DELETE_ONLY │ │ - │ └── • 19 Mutation operations + │ └── • 12 Mutation operations │ │ │ ├── • MakeDroppedColumnDeleteOnly │ │ ColumnID: 3 @@ -336,12 +379,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN k CASCADE; │ │ Kind: 2 │ │ TableID: 104 │ │ - │ ├── • RemoveColumnFromIndex - │ │ ColumnID: 3 - │ │ IndexID: 4 - │ │ Kind: 2 - │ │ TableID: 104 - │ │ │ ├── • SetIndexName │ │ IndexID: 3 │ │ Name: t_pkey @@ -351,24 +388,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN k CASCADE; │ │ IndexID: 4 │ │ 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 - │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 @@ -385,56 +404,131 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN k CASCADE; │ │ 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 │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 1 MutationType op pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 7 MutationType ops pending │ ├── • Stage 2 of 3 in PostCommitNonRevertiblePhase │ │ - │ ├── • 1 element transitioning toward ABSENT + │ ├── • 4 elements transitioning toward ABSENT + │ │ │ + │ │ ├── • Column:{DescID: 104, ColumnID: 4} + │ │ │ │ DELETE_ONLY → ABSENT + │ │ │ │ + │ │ │ ├── • SameStagePrecedence dependency from ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ rule: "dependents removed before column" + │ │ │ │ rule: "column type removed right before column when not dropping relation" + │ │ │ │ + │ │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ │ rule: "dependents removed before column" + │ │ │ │ + │ │ │ ├── • Precedence dependency from ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "indexes containing column reach absent before column" + │ │ │ │ + │ │ │ └── • Precedence dependency from ABSENT ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ ├── • ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 4} + │ │ │ rule: "column no longer public before dependents" + │ │ │ + │ │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} + │ │ │ WRITE_ONLY → DELETE_ONLY │ │ │ - │ │ └── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ WRITE_ONLY → DELETE_ONLY + │ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ DELETE_ONLY → ABSENT + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} + │ │ │ rule: "dependents removed before index" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ rule: "dependents removed before index" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} + │ │ │ rule: "dependents removed before index" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ rule: "dependents removed before index" │ │ - │ └── • 3 Mutation operations + │ ├── • 1 element transitioning toward TRANSIENT_ABSENT + │ │ │ + │ │ └── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} + │ │ │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT + │ │ │ + │ │ ├── • Precedence dependency from TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} + │ │ │ rule: "dependents removed before index" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} + │ │ rule: "dependents removed before index" + │ │ + │ └── • 9 Mutation operations │ │ │ ├── • MakeDroppedIndexDeleteOnly │ │ IndexID: 1 │ │ TableID: 104 │ │ + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ tableId: 104 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TargetStatus: 1 + │ │ + │ ├── • CreateGcJobForIndex + │ │ IndexID: 2 + │ │ StatementForDropJob: + │ │ Statement: ALTER TABLE defaultdb.public.t DROP COLUMN j CASCADE + │ │ TableID: 104 + │ │ + │ ├── • MakeIndexAbsent + │ │ IndexID: 2 + │ │ TableID: 104 + │ │ + │ ├── • CreateGcJobForIndex + │ │ IndexID: 4 + │ │ TableID: 104 + │ │ + │ ├── • MakeIndexAbsent + │ │ IndexID: 4 + │ │ TableID: 104 + │ │ + │ ├── • MakeColumnAbsent + │ │ ColumnID: 4 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TableID: 104 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 3 of 3 with 12 MutationType ops - │ pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 3 of 3 with 6 MutationType ops pending │ └── • Stage 3 of 3 in PostCommitNonRevertiblePhase │ - ├── • 10 elements transitioning toward ABSENT + ├── • 7 elements transitioning toward ABSENT │ │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ DELETE_ONLY → ABSENT @@ -446,17 +540,35 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN k CASCADE; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ + │ │ ├── • Precedence dependency from ABSENT ColumnDefaultExpression:{DescID: 104, ColumnID: 3} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT ColumnOnUpdateExpression:{DescID: 104, ColumnID: 3} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} + │ │ │ rule: "dependents removed before column" + │ │ │ │ │ ├── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "indexes containing columns reach absent before column" + │ │ │ rule: "indexes containing column reach absent before column" │ │ │ - │ │ └── • Precedence dependency from ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ rule: "indexes containing columns reach absent before column" + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "indexes containing column reach absent before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} + │ │ rule: "dependents removed before column" │ │ │ ├── • ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} │ │ │ PUBLIC → ABSENT │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 3} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • SameStagePrecedence dependency from ABSENT ColumnDefaultExpression:{DescID: 104, ColumnID: 3} │ │ │ rule: "column type dependents removed right before column type" @@ -465,10 +577,16 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN k CASCADE; │ │ rule: "column type dependents removed right before column type" │ │ │ ├── • ColumnDefaultExpression:{DescID: 104, ColumnID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 3} + │ │ rule: "column no longer public before dependents" │ │ │ ├── • ColumnOnUpdateExpression:{DescID: 104, ColumnID: 3} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 3} + │ │ rule: "column no longer public before dependents" │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ DELETE_ONLY → ABSENT @@ -477,8 +595,11 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN k CASCADE; │ │ │ rule: "dependents removed before column" │ │ │ rule: "column type removed right before column when not dropping relation" │ │ │ + │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} + │ │ │ rule: "dependents removed before column" + │ │ │ │ │ ├── • Precedence dependency from ABSENT PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "indexes containing columns reach absent before column" + │ │ │ rule: "indexes containing column reach absent before column" │ │ │ │ │ └── • Precedence dependency from ABSENT ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ rule: "dependents removed before column" @@ -487,80 +608,24 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN k CASCADE; │ │ │ PUBLIC → ABSENT │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 2} - │ │ rule: "column dependents removed after column no longer public" - │ │ - │ ├── • Column:{DescID: 104, ColumnID: 4} - │ │ │ DELETE_ONLY → ABSENT - │ │ │ - │ │ ├── • SameStagePrecedence dependency from ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} - │ │ │ rule: "dependents removed before column" - │ │ │ rule: "column type removed right before column when not dropping relation" - │ │ │ - │ │ ├── • Precedence dependency from ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "indexes containing columns reach absent before column" - │ │ │ - │ │ └── • Precedence dependency from ABSENT ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} - │ │ rule: "dependents removed before column" - │ │ - │ ├── • ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} - │ │ │ PUBLIC → ABSENT - │ │ │ - │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 4} - │ │ rule: "column dependents removed after column no longer public" + │ │ rule: "column no longer public before dependents" │ │ - │ ├── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} - │ │ │ DELETE_ONLY → ABSENT - │ │ │ - │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} - │ │ │ rule: "dependents removed before index" - │ │ │ - │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} - │ │ │ rule: "dependents removed before index" - │ │ │ - │ │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} - │ │ │ rule: "dependents removed before index" - │ │ │ - │ │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} - │ │ │ rule: "dependents removed before index" - │ │ │ - │ │ └── • SameStagePrecedence dependency from TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ │ rule: "temp indexes reach absent at the same time as other indexes" - │ │ - │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ └── • PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ DELETE_ONLY → ABSENT │ │ - │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" + │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} │ │ rule: "dependents removed before index" │ │ - │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" + │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} │ │ rule: "dependents removed before index" │ │ - │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2} - │ │ rule: "secondary index columns removed before removing the index" + │ ├── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 1} │ │ rule: "dependents removed before index" │ │ - │ ├── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} - │ │ rule: "dependents removed before index" - │ │ - │ └── • SameStagePrecedence dependency from TRANSIENT_ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ rule: "temp indexes reach absent at the same time as other indexes" - │ - ├── • 1 element transitioning toward TRANSIENT_ABSENT - │ │ - │ └── • TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ TRANSIENT_DELETE_ONLY → TRANSIENT_ABSENT + │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} + │ rule: "dependents removed before index" │ - └── • 14 Mutation operations - │ - ├── • CreateGcJobForIndex - │ IndexID: 4 - │ TableID: 104 - │ - ├── • MakeIndexAbsent - │ IndexID: 4 - │ TableID: 104 + └── • 8 Mutation operations │ ├── • CreateGcJobForIndex │ IndexID: 1 @@ -580,31 +645,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN k CASCADE; │ IndexID: 1 │ TableID: 104 │ - ├── • LogEvent - │ Element: - │ SecondaryIndex: - │ indexId: 2 - │ tableId: 104 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE - │ StatementTag: ALTER TABLE - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TargetStatus: 1 - │ - ├── • CreateGcJobForIndex - │ IndexID: 2 - │ StatementForDropJob: - │ Statement: ALTER TABLE defaultdb.public.t DROP COLUMN j CASCADE - │ TableID: 104 - │ - ├── • MakeIndexAbsent - │ IndexID: 2 - │ TableID: 104 - │ ├── • RemoveColumnDefaultExpression │ ColumnID: 3 │ TableID: 104 @@ -626,18 +666,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN k CASCADE; │ TableID: 104 │ ├── • MakeColumnAbsent - │ ColumnID: 4 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE - │ StatementTag: ALTER TABLE - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TableID: 104 - │ - ├── • MakeColumnAbsent │ ColumnID: 3 │ EventBase: │ Authorization: diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_table b/pkg/sql/schemachanger/testdata/explain_verbose/drop_table index 50e8f201db97..9e8e6d5b1379 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_table +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_table @@ -153,7 +153,7 @@ EXPLAIN (ddl, verbose) DROP TABLE db.sc.t; │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 107, ColumnID: 1} - │ │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip column dependents removal ops on relation drop" @@ -165,7 +165,7 @@ EXPLAIN (ddl, verbose) DROP TABLE db.sc.t; │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 107, ColumnID: 1} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • Column:{DescID: 107, ColumnID: 2} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -180,7 +180,7 @@ EXPLAIN (ddl, verbose) DROP TABLE db.sc.t; │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 107, ColumnID: 2} - │ │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip column dependents removal ops on relation drop" @@ -192,7 +192,7 @@ EXPLAIN (ddl, verbose) DROP TABLE db.sc.t; │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 107, ColumnID: 2} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • Column:{DescID: 107, ColumnID: 3} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -207,7 +207,7 @@ EXPLAIN (ddl, verbose) DROP TABLE db.sc.t; │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 107, ColumnID: 3} - │ │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip column dependents removal ops on relation drop" @@ -219,7 +219,7 @@ EXPLAIN (ddl, verbose) DROP TABLE db.sc.t; │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 107, ColumnID: 3} - │ │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ │ │ └── • SameStagePrecedence dependency from ABSENT ColumnDefaultExpression:{DescID: 107, ColumnID: 3} │ │ │ rule: "column type dependents removed right before column type" @@ -227,8 +227,11 @@ EXPLAIN (ddl, verbose) DROP TABLE db.sc.t; │ │ ├── • ColumnDefaultExpression:{DescID: 107, ColumnID: 3} │ │ │ │ PUBLIC → ABSENT │ │ │ │ - │ │ │ └── • SameStagePrecedence dependency from DROPPED Table:{DescID: 107} - │ │ │ rule: "descriptor drop right before dependent element removal" + │ │ │ ├── • SameStagePrecedence dependency from DROPPED Table:{DescID: 107} + │ │ │ │ rule: "descriptor drop right before dependent element removal" + │ │ │ │ + │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 107, ColumnID: 3} + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • Column:{DescID: 107, ColumnID: 4294967295} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -243,7 +246,7 @@ EXPLAIN (ddl, verbose) DROP TABLE db.sc.t; │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 107, ColumnID: 4294967295} - │ │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip column dependents removal ops on relation drop" @@ -255,7 +258,7 @@ EXPLAIN (ddl, verbose) DROP TABLE db.sc.t; │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 107, ColumnID: 4294967295} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • Column:{DescID: 107, ColumnID: 4294967294} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -270,7 +273,7 @@ EXPLAIN (ddl, verbose) DROP TABLE db.sc.t; │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 107, ColumnID: 4294967294} - │ │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip column dependents removal ops on relation drop" @@ -282,7 +285,7 @@ EXPLAIN (ddl, verbose) DROP TABLE db.sc.t; │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 107, ColumnID: 4294967294} - │ │ │ rule: "column dependents removed after column no longer public" + │ │ │ rule: "column no longer public before dependents" │ │ │ │ │ ├── • IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 1} │ │ │ │ PUBLIC → ABSENT @@ -290,11 +293,15 @@ EXPLAIN (ddl, verbose) DROP TABLE db.sc.t; │ │ │ ├── • SameStagePrecedence dependency from DROPPED Table:{DescID: 107} │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 107, ColumnID: 3} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 1} - │ │ │ │ rule: "index no longer public before dependents removed" + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip index dependents removal ops on relation drop" + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 1} │ │ │ │ PUBLIC → ABSENT @@ -302,11 +309,15 @@ EXPLAIN (ddl, verbose) DROP TABLE db.sc.t; │ │ │ ├── • SameStagePrecedence dependency from DROPPED Table:{DescID: 107} │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 107, ColumnID: 1} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 1} - │ │ │ │ rule: "index no longer public before dependents removed" + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip index dependents removal ops on relation drop" + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 1} │ │ │ │ PUBLIC → ABSENT @@ -314,11 +325,15 @@ EXPLAIN (ddl, verbose) DROP TABLE db.sc.t; │ │ │ ├── • SameStagePrecedence dependency from DROPPED Table:{DescID: 107} │ │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ + │ │ │ ├── • Precedence dependency from WRITE_ONLY Column:{DescID: 107, ColumnID: 2} + │ │ │ │ rule: "column no longer public before dependents" + │ │ │ │ │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 1} - │ │ │ │ rule: "index no longer public before dependents removed" + │ │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip index dependents removal ops on relation drop" + │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 1} │ │ │ │ VALIDATED → DELETE_ONLY @@ -336,7 +351,7 @@ EXPLAIN (ddl, verbose) DROP TABLE db.sc.t; │ │ │ rule: "descriptor drop right before dependent element removal" │ │ │ │ │ ├── • Precedence dependency from VALIDATED PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 1} - │ │ │ rule: "index no longer public before dependents removed" + │ │ │ rule: "index no longer public before dependents" │ │ │ │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index dependents removal ops on relation drop" @@ -384,7 +399,10 @@ EXPLAIN (ddl, verbose) DROP TABLE db.sc.t; │ │ ├── • Precedence dependency from ABSENT ColumnName:{DescID: 107, Name: k, ColumnID: 1} │ │ │ rule: "dependents removed before column" │ │ │ - │ │ └── • Precedence dependency from ABSENT ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 1} + │ │ ├── • Precedence dependency from ABSENT ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 1} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 1} │ │ rule: "dependents removed before column" │ │ │ ├── • Column:{DescID: 107, ColumnID: 2} @@ -396,7 +414,10 @@ EXPLAIN (ddl, verbose) DROP TABLE db.sc.t; │ │ ├── • Precedence dependency from ABSENT ColumnName:{DescID: 107, Name: v, ColumnID: 2} │ │ │ rule: "dependents removed before column" │ │ │ - │ │ └── • Precedence dependency from ABSENT ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 2} + │ │ ├── • Precedence dependency from ABSENT ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 2} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 1} │ │ rule: "dependents removed before column" │ │ │ ├── • Column:{DescID: 107, ColumnID: 3} @@ -408,7 +429,13 @@ EXPLAIN (ddl, verbose) DROP TABLE db.sc.t; │ │ ├── • Precedence dependency from ABSENT ColumnName:{DescID: 107, Name: rowid, ColumnID: 3} │ │ │ rule: "dependents removed before column" │ │ │ - │ │ └── • Precedence dependency from ABSENT ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 3} + │ │ ├── • Precedence dependency from ABSENT ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 3} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ ├── • Precedence dependency from ABSENT ColumnDefaultExpression:{DescID: 107, ColumnID: 3} + │ │ │ rule: "dependents removed before column" + │ │ │ + │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 1} │ │ rule: "dependents removed before column" │ │ │ ├── • Column:{DescID: 107, ColumnID: 4294967295}