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 a2989a231651..d4c65569f50f 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 @@ -24,9 +24,8 @@ Schema change plan for rolling back CREATE INDEX ‹id1› ON ‹defaultdb›.pu │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - └── 7 Mutation operations + └── 6 Mutation operations ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} - ├── LogEvent {"TargetStatus":1} ├── MakeIndexAbsent {"IndexID":2,"TableID":104} ├── CreateGCJobForIndex {"IndexID":2,"TableID":104} ├── MakeIndexAbsent {"IndexID":3,"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 7579dc08ef30..6b4a9d8b67ec 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 @@ -23,10 +23,9 @@ Schema change plan for rolling back CREATE INDEX ‹id1› ON ‹defaultdb›.pu │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - │ └── 6 Mutation operations + │ └── 5 Mutation operations │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} 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 0d4e78e178d9..32043346598e 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 @@ -23,10 +23,9 @@ Schema change plan for rolling back CREATE INDEX ‹id1› ON ‹defaultdb›.pu │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - │ └── 6 Mutation operations + │ └── 5 Mutation operations │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} 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 75916b699050..6e1b513b28ff 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 @@ -23,10 +23,9 @@ Schema change plan for rolling back CREATE INDEX ‹id1› ON ‹defaultdb›.pu │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - │ └── 6 Mutation operations + │ └── 5 Mutation operations │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} 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 eca8753277ba..ff368373afb1 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 @@ -23,10 +23,11 @@ Schema change plan for rolling back CREATE INDEX ‹id1› ON ‹defaultdb›.pu │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - │ └── 5 Mutation operations - │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} + │ └── 6 Mutation operations │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":104} + │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase @@ -35,8 +36,7 @@ Schema change plan for rolling back CREATE INDEX ‹id1› ON ‹defaultdb›.pu │ ├── PUBLIC → ABSENT IndexData:{DescID: 104, IndexID: 2} │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ └── PUBLIC → ABSENT IndexData:{DescID: 104, IndexID: 3} - └── 7 Mutation operations - ├── LogEvent {"TargetStatus":1} + └── 6 Mutation operations ├── MakeIndexAbsent {"IndexID":2,"TableID":104} ├── CreateGCJobForIndex {"IndexID":2,"TableID":104} ├── MakeIndexAbsent {"IndexID":3,"TableID":104} 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 8ec44f0c4447..f0d157cd29d5 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 @@ -23,10 +23,11 @@ Schema change plan for rolling back CREATE INDEX ‹id1› ON ‹defaultdb›.pu │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - │ └── 5 Mutation operations - │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} + │ └── 6 Mutation operations │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":104} + │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase @@ -35,8 +36,7 @@ Schema change plan for rolling back CREATE INDEX ‹id1› ON ‹defaultdb›.pu │ ├── PUBLIC → ABSENT IndexData:{DescID: 104, IndexID: 2} │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ └── PUBLIC → ABSENT IndexData:{DescID: 104, IndexID: 3} - └── 7 Mutation operations - ├── LogEvent {"TargetStatus":1} + └── 6 Mutation operations ├── MakeIndexAbsent {"IndexID":2,"TableID":104} ├── CreateGCJobForIndex {"IndexID":2,"TableID":104} ├── MakeIndexAbsent {"IndexID":3,"TableID":104} 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 58c1698c60df..4123c2e1569f 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 @@ -23,7 +23,8 @@ Schema change plan for rolling back CREATE INDEX ‹id1› ON ‹defaultdb›.pu │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} - │ └── 5 Mutation operations + │ └── 6 Mutation operations + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":104} │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} @@ -35,8 +36,7 @@ Schema change plan for rolling back CREATE INDEX ‹id1› ON ‹defaultdb›.pu │ ├── PUBLIC → ABSENT IndexData:{DescID: 104, IndexID: 2} │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ └── PUBLIC → ABSENT IndexData:{DescID: 104, IndexID: 3} - └── 7 Mutation operations - ├── LogEvent {"TargetStatus":1} + └── 6 Mutation operations ├── MakeIndexAbsent {"IndexID":2,"TableID":104} ├── CreateGCJobForIndex {"IndexID":2,"TableID":104} ├── MakeIndexAbsent {"IndexID":3,"TableID":104} 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 7c69cb169037..ff1ed71a213a 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 @@ -65,7 +65,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ │ rule: "index removed before garbage collection" │ │ │ ├── • IndexName:{DescID: 104, Name: id1, IndexID: 2} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ rule: "index no longer public before index name" │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ │ │ DELETE_ONLY → ABSENT @@ -106,31 +109,13 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ └── • skip PUBLIC → ABSENT operations │ rule: "skip index-column removal ops on index removal" │ - └── • 7 Mutation operations + └── • 6 Mutation operations │ ├── • SetIndexName │ IndexID: 2 │ Name: crdb_internal_index_2_name_placeholder │ TableID: 104 │ - ├── • LogEvent - │ Element: - │ SecondaryIndex: - │ indexId: 2 - │ sourceIndexId: 1 - │ tableId: 104 - │ temporaryIndexId: 3 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: CREATE INDEX ‹id1› ON ‹defaultdb›.public.‹t1› (‹id›, ‹name›) STORING - │ (‹money›) PARTITION BY LIST (‹id›) (PARTITION ‹p1› VALUES IN (‹1›)) - │ StatementTag: CREATE INDEX - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TargetStatus: 1 - │ ├── • MakeIndexAbsent │ IndexID: 2 │ TableID: 104 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 3836b1238d9c..52f47bcdf1a1 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 @@ -59,7 +59,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexName:{DescID: 104, Name: id1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -88,7 +91,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 6 Mutation operations + │ └── • 5 Mutation operations │ │ │ ├── • SetIndexName │ │ IndexID: 2 @@ -99,24 +102,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ indexId: 2 - │ │ sourceIndexId: 1 - │ │ tableId: 104 - │ │ temporaryIndexId: 3 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: CREATE INDEX ‹id1› ON ‹defaultdb›.public.‹t1› (‹id›, ‹name›) STORING - │ │ (‹money›) PARTITION BY LIST (‹id›) (PARTITION ‹p1› VALUES IN (‹1›)) - │ │ StatementTag: CREATE INDEX - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 2 │ │ TableID: 104 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 dde37d543039..0cdb972dd902 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 @@ -59,7 +59,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexName:{DescID: 104, Name: id1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -88,7 +91,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 6 Mutation operations + │ └── • 5 Mutation operations │ │ │ ├── • SetIndexName │ │ IndexID: 2 @@ -99,24 +102,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ indexId: 2 - │ │ sourceIndexId: 1 - │ │ tableId: 104 - │ │ temporaryIndexId: 3 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: CREATE INDEX ‹id1› ON ‹defaultdb›.public.‹t1› (‹id›, ‹name›) STORING - │ │ (‹money›) PARTITION BY LIST (‹id›) (PARTITION ‹p1› VALUES IN (‹1›)) - │ │ StatementTag: CREATE INDEX - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 2 │ │ TableID: 104 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 3b875c4cfd0f..0061aba82187 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 @@ -59,7 +59,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexName:{DescID: 104, Name: id1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -88,7 +91,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 6 Mutation operations + │ └── • 5 Mutation operations │ │ │ ├── • SetIndexName │ │ IndexID: 2 @@ -99,24 +102,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ indexId: 2 - │ │ sourceIndexId: 1 - │ │ tableId: 104 - │ │ temporaryIndexId: 3 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: CREATE INDEX ‹id1› ON ‹defaultdb›.public.‹t1› (‹id›, ‹name›) STORING - │ │ (‹money›) PARTITION BY LIST (‹id›) (PARTITION ‹p1› VALUES IN (‹1›)) - │ │ StatementTag: CREATE INDEX - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 2 │ │ TableID: 104 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 984713113fb5..412ccf271518 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 @@ -44,7 +44,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexName:{DescID: 104, Name: id1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -73,28 +76,46 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 5 Mutation operations - │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: crdb_internal_index_2_name_placeholder - │ │ TableID: 104 + │ └── • 6 Mutation operations │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 104 │ │ + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ sourceIndexId: 1 + │ │ tableId: 104 + │ │ temporaryIndexId: 3 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: CREATE INDEX ‹id1› ON ‹defaultdb›.public.‹t1› (‹id›, ‹name›) STORING + │ │ (‹money›) PARTITION BY LIST (‹id›) (PARTITION ‹p1› VALUES IN (‹1›)) + │ │ StatementTag: CREATE INDEX + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TargetStatus: 1 + │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: crdb_internal_index_2_name_placeholder + │ │ TableID: 104 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 5 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 4 MutationType ops pending │ └── • Stage 2 of 2 in PostCommitNonRevertiblePhase │ @@ -154,25 +175,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ └── • Precedence dependency from ABSENT TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ rule: "index removed before garbage collection" │ - └── • 7 Mutation operations - │ - ├── • LogEvent - │ Element: - │ SecondaryIndex: - │ indexId: 2 - │ sourceIndexId: 1 - │ tableId: 104 - │ temporaryIndexId: 3 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: CREATE INDEX ‹id1› ON ‹defaultdb›.public.‹t1› (‹id›, ‹name›) STORING - │ (‹money›) PARTITION BY LIST (‹id›) (PARTITION ‹p1› VALUES IN (‹1›)) - │ StatementTag: CREATE INDEX - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TargetStatus: 1 + └── • 6 Mutation operations │ ├── • MakeIndexAbsent │ 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 036e493fa2d9..8ccdc480d283 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 @@ -44,7 +44,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexName:{DescID: 104, Name: id1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -73,28 +76,46 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 5 Mutation operations - │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: crdb_internal_index_2_name_placeholder - │ │ TableID: 104 + │ └── • 6 Mutation operations │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 104 │ │ + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ sourceIndexId: 1 + │ │ tableId: 104 + │ │ temporaryIndexId: 3 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: CREATE INDEX ‹id1› ON ‹defaultdb›.public.‹t1› (‹id›, ‹name›) STORING + │ │ (‹money›) PARTITION BY LIST (‹id›) (PARTITION ‹p1› VALUES IN (‹1›)) + │ │ StatementTag: CREATE INDEX + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TargetStatus: 1 + │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: crdb_internal_index_2_name_placeholder + │ │ TableID: 104 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 5 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 4 MutationType ops pending │ └── • Stage 2 of 2 in PostCommitNonRevertiblePhase │ @@ -154,25 +175,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ └── • Precedence dependency from ABSENT TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ rule: "index removed before garbage collection" │ - └── • 7 Mutation operations - │ - ├── • LogEvent - │ Element: - │ SecondaryIndex: - │ indexId: 2 - │ sourceIndexId: 1 - │ tableId: 104 - │ temporaryIndexId: 3 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: CREATE INDEX ‹id1› ON ‹defaultdb›.public.‹t1› (‹id›, ‹name›) STORING - │ (‹money›) PARTITION BY LIST (‹id›) (PARTITION ‹p1› VALUES IN (‹1›)) - │ StatementTag: CREATE INDEX - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TargetStatus: 1 + └── • 6 Mutation operations │ ├── • MakeIndexAbsent │ 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 e1b3dad12eff..e4281f273bef 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 @@ -44,7 +44,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexName:{DescID: 104, Name: id1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -73,7 +76,25 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 5 Mutation operations + │ └── • 6 Mutation operations + │ │ + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ sourceIndexId: 1 + │ │ tableId: 104 + │ │ temporaryIndexId: 3 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: CREATE INDEX ‹id1› ON ‹defaultdb›.public.‹t1› (‹id›, ‹name›) STORING + │ │ (‹money›) PARTITION BY LIST (‹id›) (PARTITION ‹p1› VALUES IN (‹1›)) + │ │ StatementTag: CREATE INDEX + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TargetStatus: 1 │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 2 @@ -94,7 +115,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 5 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 4 MutationType ops pending │ └── • Stage 2 of 2 in PostCommitNonRevertiblePhase │ @@ -154,25 +175,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ └── • Precedence dependency from ABSENT TemporaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ rule: "index removed before garbage collection" │ - └── • 7 Mutation operations - │ - ├── • LogEvent - │ Element: - │ SecondaryIndex: - │ indexId: 2 - │ sourceIndexId: 1 - │ tableId: 104 - │ temporaryIndexId: 3 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: CREATE INDEX ‹id1› ON ‹defaultdb›.public.‹t1› (‹id›, ‹name›) STORING - │ (‹money›) PARTITION BY LIST (‹id›) (PARTITION ‹p1› VALUES IN (‹1›)) - │ StatementTag: CREATE INDEX - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TargetStatus: 1 + └── • 6 Mutation operations │ ├── • MakeIndexAbsent │ IndexID: 2 diff --git a/pkg/sql/logictest/testdata/logic_test/create_index b/pkg/sql/logictest/testdata/logic_test/create_index index f9987f3c44a8..fc4e1de7cd90 100644 --- a/pkg/sql/logictest/testdata/logic_test/create_index +++ b/pkg/sql/logictest/testdata/logic_test/create_index @@ -193,6 +193,8 @@ query T noticetrace DROP INDEX CONCURRENTLY IF EXISTS create_index_concurrently_idx ---- NOTICE: CONCURRENTLY is not required as all indexes are dropped concurrently +NOTICE: the data for dropped indexes is reclaimed asynchronously +HINT: The reclamation delay can be customized in the zone configuration for the table. query TT SHOW CREATE TABLE create_index_concurrently_tbl diff --git a/pkg/sql/schema_changer.go b/pkg/sql/schema_changer.go index cb83c48e7e64..4ebda18e3de4 100644 --- a/pkg/sql/schema_changer.go +++ b/pkg/sql/schema_changer.go @@ -654,7 +654,6 @@ func (sc *SchemaChanger) exec(ctx context.Context) error { if err := sc.notFirstInLine(ctx, desc); err != nil { return err } - if err := sc.checkForMVCCCompliantAddIndexMutations(ctx, desc); err != nil { return err } diff --git a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/drop_index.go b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/drop_index.go index 5197b4b53d9b..da677ed72dfb 100644 --- a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/drop_index.go +++ b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/drop_index.go @@ -131,29 +131,31 @@ func dropSecondaryIndex( dropBehavior tree.DropBehavior, sie *scpb.SecondaryIndex, ) { - // Maybe drop dependent views. - // If CASCADE and there are "dependent" views (i.e. views that use this - // to-be-dropped index), then we will drop all dependent views and their - // dependents. - maybeDropDependentViews(b, sie, indexName.Index.String(), dropBehavior) - - // Maybe drop dependent FK constraints. - // A PK or unique constraint is required to serve an inbound FK constraint. - // It is possible that there is an inbound FK constraint 'fk' and it's - // served by a unique constraint 'uc' that is provided by a unique index 'ui'. - // In this case, if we were to drop 'ui' and no other unique constraint can be - // found to replace 'uc' (to continue to serve 'fk'), we will require CASCADE - //and drop 'fk' as well. - maybeDropDependentFKConstraints(b, sie, indexName, dropBehavior) - - // If shard index, also drop the shard column and all check constraints that - // uses this shard column if no other index uses the shard column. - maybeDropAdditionallyForShardedIndex(b, sie, indexName.Index.String(), dropBehavior) - - // If expression index, also drop the expression column if no other index is - // using the expression column. - dropAdditionallyForExpressionIndex(b, sie) - + { + next := b.WithNewSourceElementID() + // Maybe drop dependent views. + // If CASCADE and there are "dependent" views (i.e. views that use this + // to-be-dropped index), then we will drop all dependent views and their + // dependents. + maybeDropDependentViews(next, sie, indexName.Index.String(), dropBehavior) + + // Maybe drop dependent FK constraints. + // A PK or unique constraint is required to serve an inbound FK constraint. + // It is possible that there is an inbound FK constraint 'fk' and it's + // served by a unique constraint 'uc' that is provided by a unique index 'ui'. + // In this case, if we were to drop 'ui' and no other unique constraint can be + // found to replace 'uc' (to continue to serve 'fk'), we will require CASCADE + //and drop 'fk' as well. + maybeDropDependentFKConstraints(next, sie, indexName, dropBehavior) + + // If shard index, also drop the shard column and all check constraints that + // uses this shard column if no other index uses the shard column. + maybeDropAdditionallyForShardedIndex(next, sie, indexName.Index.String(), dropBehavior) + + // If expression index, also drop the expression column if no other index is + // using the expression column. + dropAdditionallyForExpressionIndex(next, sie) + } // Finally, drop the index's public elements and trigger a GC job. b.QueryByID(sie.TableID). Filter(hasIndexIDAttrFilter(sie.IndexID)). diff --git a/pkg/sql/schemachanger/scexec/exec_mutation.go b/pkg/sql/schemachanger/scexec/exec_mutation.go index 9f0bf732da99..28a4bad82276 100644 --- a/pkg/sql/schemachanger/scexec/exec_mutation.go +++ b/pkg/sql/schemachanger/scexec/exec_mutation.go @@ -239,7 +239,7 @@ func eventLogEntriesForStatement(statementEvents []eventPayload) (logEntries []e collectDependentViewNames = true collectDependentTables = true collectDependentSequences = true - case *eventpb.DropView, *eventpb.DropTable: + case *eventpb.DropView, *eventpb.DropTable, *eventpb.DropIndex: // Drop view and drop tables only cares about // dependent views collectDependentViewNames = true @@ -270,6 +270,8 @@ func eventLogEntriesForStatement(statementEvents []eventPayload) (logEntries []e ev.CascadeDroppedViews = dependentObjects case *eventpb.DropDatabase: ev.DroppedSchemaObjects = dependentObjects + case *eventpb.DropIndex: + ev.CascadeDroppedViews = dependentObjects } // Generate event log entries for the source event only. The dependent // events will be ignored. diff --git a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_secondary_index.go b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_secondary_index.go index 7c8519681a03..7fedc8e50a2b 100644 --- a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_secondary_index.go +++ b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_secondary_index.go @@ -119,6 +119,9 @@ func init() { equiv(scpb.Status_MERGE_ONLY), equiv(scpb.Status_MERGED), to(scpb.Status_DELETE_ONLY, + emit(func(this *scpb.SecondaryIndex, md *opGenContext) *scop.LogEvent { + return newLogEventOp(this, md) + }), emit(func(this *scpb.SecondaryIndex) *scop.MakeWriteOnlyIndexDeleteOnly { return &scop.MakeWriteOnlyIndexDeleteOnly{ TableID: this.TableID, @@ -129,9 +132,6 @@ func init() { equiv(scpb.Status_BACKFILLED), equiv(scpb.Status_BACKFILL_ONLY), to(scpb.Status_ABSENT, - emit(func(this *scpb.SecondaryIndex, md *opGenContext) *scop.LogEvent { - return newLogEventOp(this, md) - }), emit(func(this *scpb.SecondaryIndex, md *opGenContext) *scop.CreateGCJobForIndex { if !md.ActiveVersion.IsActive(clusterversion.V23_1) { return &scop.CreateGCJobForIndex{ diff --git a/pkg/sql/schemachanger/scplan/internal/rules/dep_drop_index.go b/pkg/sql/schemachanger/scplan/internal/rules/dep_drop_index.go index 40dfcd565d46..ec9c3af80a0a 100644 --- a/pkg/sql/schemachanger/scplan/internal/rules/dep_drop_index.go +++ b/pkg/sql/schemachanger/scplan/internal/rules/dep_drop_index.go @@ -46,6 +46,21 @@ func init() { } }, ) + + // This rule helps us to have the index name inside event log entries. + registerDepRuleForDrop( + "index no longer public before index name", + scgraph.Precedence, + "index", "name", + scpb.Status_DELETE_ONLY, scpb.Status_ABSENT, + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.Type((*scpb.SecondaryIndex)(nil)), + to.Type((*scpb.IndexName)(nil)), + joinOnIndexID(from, to, "table-id", "index-id"), + } + }, + ) } // Special cases of the above. @@ -105,3 +120,72 @@ func init() { ) } + +func init() { + // TODO(fqazi): We need to model these rules better to use indexes, + // since they may perform terrible in scenarios where we are dropping + // a large number of views and indexes (i.e. O(views * indexes) ). + registerDepRuleForDrop( + "dependent view no longer public before secondary index", + scgraph.Precedence, + "view", "index", + scpb.Status_DROPPED, scpb.Status_VALIDATED, + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.Type((*scpb.View)(nil)), + to.Type((*scpb.SecondaryIndex)(nil)), + filterElements("viewReferencesIndex", from, to, func(from *scpb.View, to *scpb.SecondaryIndex) bool { + for _, ref := range from.ForwardReferences { + if ref.ToID == to.TableID && + ref.IndexID == to.IndexID { + return true + } + } + return false + }), + } + }, + ) + registerDepRuleForDrop( + "secondary index should be validated before dependent view can be absent", + scgraph.Precedence, + "index", "view", + scpb.Status_VALIDATED, scpb.Status_ABSENT, + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.Type((*scpb.SecondaryIndex)(nil)), + to.Type((*scpb.View)(nil)), + filterElements("viewReferencesIndex", from, to, func(from *scpb.SecondaryIndex, to *scpb.View) bool { + for _, ref := range to.ForwardReferences { + if ref.ToID == from.TableID && + ref.IndexID == from.IndexID { + return true + } + } + return false + }), + } + }, + ) + registerDepRuleForDrop( + "dependent view absent before secondary index", + scgraph.Precedence, + "view", "index", + scpb.Status_ABSENT, scpb.Status_ABSENT, + func(from, to nodeVars) rel.Clauses { + return rel.Clauses{ + from.Type((*scpb.View)(nil)), + to.Type((*scpb.SecondaryIndex)(nil)), + filterElements("viewReferencesIndex", from, to, func(from *scpb.View, to *scpb.SecondaryIndex) bool { + for _, ref := range from.ForwardReferences { + if ref.ToID == to.TableID && + ref.IndexID == to.IndexID { + return true + } + } + return false + }), + } + }, + ) +} diff --git a/pkg/sql/schemachanger/scplan/internal/rules/testdata/deprules b/pkg/sql/schemachanger/scplan/internal/rules/testdata/deprules index 3043a441eb42..1f0a49925326 100644 --- a/pkg/sql/schemachanger/scplan/internal/rules/testdata/deprules +++ b/pkg/sql/schemachanger/scplan/internal/rules/testdata/deprules @@ -1438,9 +1438,10 @@ deprules - $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) - - toAbsent($column-target, $dependent-target) + - $column-target[TargetStatus] = ABSENT - $column-node[CurrentStatus] = WRITE_ONLY - - $dependent-node[CurrentStatus] = ABSENT + - $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 @@ -1451,9 +1452,9 @@ deprules - $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 + - 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) - name: column no longer public before dependents @@ -1464,10 +1465,9 @@ deprules - $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 + - transient($column-target, $dependent-target) - $column-node[CurrentStatus] = TRANSIENT_WRITE_ONLY - - $dependent-target[TargetStatus] = ABSENT - - $dependent-node[CurrentStatus] = 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 @@ -1478,10 +1478,10 @@ deprules - $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 + - $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 type dependents removed right before column type @@ -1532,10 +1532,10 @@ deprules - $constraint[Type] = '*scpb.CheckConstraint' - $dependent[Type] IN ['*scpb.ConstraintWithoutIndexName', '*scpb.ConstraintComment'] - joinOnConstraintID($constraint, $dependent, $table-id, $constraint-id) - - $constraint-target[TargetStatus] = TRANSIENT_ABSENT - - $constraint-node[CurrentStatus] = TRANSIENT_VALIDATED - - $dependent-target[TargetStatus] = ABSENT - - $dependent-node[CurrentStatus] = ABSENT + - $constraint-target[TargetStatus] = ABSENT + - $constraint-node[CurrentStatus] = VALIDATED + - $dependent-target[TargetStatus] = TRANSIENT_ABSENT + - $dependent-node[CurrentStatus] = TRANSIENT_ABSENT - joinTargetNode($constraint, $constraint-target, $constraint-node) - joinTargetNode($dependent, $dependent-target, $dependent-node) - name: constraint no longer public before dependents @@ -1546,10 +1546,9 @@ deprules - $constraint[Type] = '*scpb.CheckConstraint' - $dependent[Type] IN ['*scpb.ConstraintWithoutIndexName', '*scpb.ConstraintComment'] - joinOnConstraintID($constraint, $dependent, $table-id, $constraint-id) - - $constraint-target[TargetStatus] = ABSENT + - toAbsent($constraint-target, $dependent-target) - $constraint-node[CurrentStatus] = VALIDATED - - $dependent-target[TargetStatus] = TRANSIENT_ABSENT - - $dependent-node[CurrentStatus] = TRANSIENT_ABSENT + - $dependent-node[CurrentStatus] = ABSENT - joinTargetNode($constraint, $constraint-target, $constraint-node) - joinTargetNode($dependent, $dependent-target, $dependent-node) - name: constraint no longer public before dependents @@ -1560,9 +1559,10 @@ deprules - $constraint[Type] = '*scpb.CheckConstraint' - $dependent[Type] IN ['*scpb.ConstraintWithoutIndexName', '*scpb.ConstraintComment'] - joinOnConstraintID($constraint, $dependent, $table-id, $constraint-id) - - transient($constraint-target, $dependent-target) + - $constraint-target[TargetStatus] = TRANSIENT_ABSENT - $constraint-node[CurrentStatus] = TRANSIENT_VALIDATED - - $dependent-node[CurrentStatus] = TRANSIENT_ABSENT + - $dependent-target[TargetStatus] = ABSENT + - $dependent-node[CurrentStatus] = ABSENT - joinTargetNode($constraint, $constraint-target, $constraint-node) - joinTargetNode($dependent, $dependent-target, $dependent-node) - name: constraint no longer public before dependents @@ -1573,11 +1573,119 @@ deprules - $constraint[Type] = '*scpb.CheckConstraint' - $dependent[Type] IN ['*scpb.ConstraintWithoutIndexName', '*scpb.ConstraintComment'] - joinOnConstraintID($constraint, $dependent, $table-id, $constraint-id) - - toAbsent($constraint-target, $dependent-target) - - $constraint-node[CurrentStatus] = VALIDATED - - $dependent-node[CurrentStatus] = ABSENT + - transient($constraint-target, $dependent-target) + - $constraint-node[CurrentStatus] = TRANSIENT_VALIDATED + - $dependent-node[CurrentStatus] = TRANSIENT_ABSENT - joinTargetNode($constraint, $constraint-target, $constraint-node) - joinTargetNode($dependent, $dependent-target, $dependent-node) +- name: dependent view absent before secondary index + from: view-node + kind: Precedence + to: index-node + query: + - $view[Type] = '*scpb.View' + - $index[Type] = '*scpb.SecondaryIndex' + - viewReferencesIndex(*scpb.View, *scpb.SecondaryIndex)($view, $index) + - transient($view-target, $index-target) + - $view-node[CurrentStatus] = TRANSIENT_ABSENT + - $index-node[CurrentStatus] = TRANSIENT_ABSENT + - joinTargetNode($view, $view-target, $view-node) + - joinTargetNode($index, $index-target, $index-node) +- name: dependent view absent before secondary index + from: view-node + kind: Precedence + to: index-node + query: + - $view[Type] = '*scpb.View' + - $index[Type] = '*scpb.SecondaryIndex' + - viewReferencesIndex(*scpb.View, *scpb.SecondaryIndex)($view, $index) + - toAbsent($view-target, $index-target) + - $view-node[CurrentStatus] = ABSENT + - $index-node[CurrentStatus] = ABSENT + - joinTargetNode($view, $view-target, $view-node) + - joinTargetNode($index, $index-target, $index-node) +- name: dependent view absent before secondary index + from: view-node + kind: Precedence + to: index-node + query: + - $view[Type] = '*scpb.View' + - $index[Type] = '*scpb.SecondaryIndex' + - viewReferencesIndex(*scpb.View, *scpb.SecondaryIndex)($view, $index) + - $view-target[TargetStatus] = ABSENT + - $view-node[CurrentStatus] = ABSENT + - $index-target[TargetStatus] = TRANSIENT_ABSENT + - $index-node[CurrentStatus] = TRANSIENT_ABSENT + - joinTargetNode($view, $view-target, $view-node) + - joinTargetNode($index, $index-target, $index-node) +- name: dependent view absent before secondary index + from: view-node + kind: Precedence + to: index-node + query: + - $view[Type] = '*scpb.View' + - $index[Type] = '*scpb.SecondaryIndex' + - viewReferencesIndex(*scpb.View, *scpb.SecondaryIndex)($view, $index) + - $view-target[TargetStatus] = TRANSIENT_ABSENT + - $view-node[CurrentStatus] = TRANSIENT_ABSENT + - $index-target[TargetStatus] = ABSENT + - $index-node[CurrentStatus] = ABSENT + - joinTargetNode($view, $view-target, $view-node) + - joinTargetNode($index, $index-target, $index-node) +- name: dependent view no longer public before secondary index + from: view-node + kind: Precedence + to: index-node + query: + - $view[Type] = '*scpb.View' + - $index[Type] = '*scpb.SecondaryIndex' + - viewReferencesIndex(*scpb.View, *scpb.SecondaryIndex)($view, $index) + - $view-target[TargetStatus] = ABSENT + - $view-node[CurrentStatus] = DROPPED + - $index-target[TargetStatus] = TRANSIENT_ABSENT + - $index-node[CurrentStatus] = TRANSIENT_VALIDATED + - joinTargetNode($view, $view-target, $view-node) + - joinTargetNode($index, $index-target, $index-node) +- name: dependent view no longer public before secondary index + from: view-node + kind: Precedence + to: index-node + query: + - $view[Type] = '*scpb.View' + - $index[Type] = '*scpb.SecondaryIndex' + - viewReferencesIndex(*scpb.View, *scpb.SecondaryIndex)($view, $index) + - toAbsent($view-target, $index-target) + - $view-node[CurrentStatus] = DROPPED + - $index-node[CurrentStatus] = VALIDATED + - joinTargetNode($view, $view-target, $view-node) + - joinTargetNode($index, $index-target, $index-node) +- name: dependent view no longer public before secondary index + from: view-node + kind: Precedence + to: index-node + query: + - $view[Type] = '*scpb.View' + - $index[Type] = '*scpb.SecondaryIndex' + - viewReferencesIndex(*scpb.View, *scpb.SecondaryIndex)($view, $index) + - $view-target[TargetStatus] = TRANSIENT_ABSENT + - $view-node[CurrentStatus] = TRANSIENT_DROPPED + - $index-target[TargetStatus] = ABSENT + - $index-node[CurrentStatus] = VALIDATED + - joinTargetNode($view, $view-target, $view-node) + - joinTargetNode($index, $index-target, $index-node) +- name: dependent view no longer public before secondary index + from: view-node + kind: Precedence + to: index-node + query: + - $view[Type] = '*scpb.View' + - $index[Type] = '*scpb.SecondaryIndex' + - viewReferencesIndex(*scpb.View, *scpb.SecondaryIndex)($view, $index) + - transient($view-target, $index-target) + - $view-node[CurrentStatus] = TRANSIENT_DROPPED + - $index-node[CurrentStatus] = TRANSIENT_VALIDATED + - joinTargetNode($view, $view-target, $view-node) + - joinTargetNode($index, $index-target, $index-node) - name: dependents removed before column from: dependent-node kind: Precedence @@ -1586,10 +1694,9 @@ deprules - $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 + - toAbsent($dependent-target, $column-target) - $dependent-node[CurrentStatus] = ABSENT - - $column-target[TargetStatus] = TRANSIENT_ABSENT - - $column-node[CurrentStatus] = TRANSIENT_ABSENT + - $column-node[CurrentStatus] = ABSENT - joinTargetNode($dependent, $dependent-target, $dependent-node) - joinTargetNode($column, $column-target, $column-node) - name: dependents removed before column @@ -1600,10 +1707,9 @@ deprules - $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 + - transient($dependent-target, $column-target) - $dependent-node[CurrentStatus] = TRANSIENT_ABSENT - - $column-target[TargetStatus] = ABSENT - - $column-node[CurrentStatus] = ABSENT + - $column-node[CurrentStatus] = TRANSIENT_ABSENT - joinTargetNode($dependent, $dependent-target, $dependent-node) - joinTargetNode($column, $column-target, $column-node) - name: dependents removed before column @@ -1614,8 +1720,9 @@ deprules - $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 + - $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) @@ -1627,8 +1734,9 @@ deprules - $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) - - $dependent-node[CurrentStatus] = ABSENT + - $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) @@ -1640,10 +1748,10 @@ deprules - $dependents[Type] IN ['*scpb.ConstraintWithoutIndexName', '*scpb.ConstraintComment'] - $constraint[Type] = '*scpb.CheckConstraint' - joinOnConstraintID($dependents, $constraint, $table-id, $constraint-id) - - $dependents-target[TargetStatus] = ABSENT - - $dependents-node[CurrentStatus] = ABSENT - - $constraint-target[TargetStatus] = TRANSIENT_ABSENT - - $constraint-node[CurrentStatus] = TRANSIENT_ABSENT + - $dependents-target[TargetStatus] = TRANSIENT_ABSENT + - $dependents-node[CurrentStatus] = TRANSIENT_ABSENT + - $constraint-target[TargetStatus] = ABSENT + - $constraint-node[CurrentStatus] = ABSENT - joinTargetNode($dependents, $dependents-target, $dependents-node) - joinTargetNode($constraint, $constraint-target, $constraint-node) - name: dependents removed before constraint @@ -1654,9 +1762,9 @@ deprules - $dependents[Type] IN ['*scpb.ConstraintWithoutIndexName', '*scpb.ConstraintComment'] - $constraint[Type] = '*scpb.CheckConstraint' - joinOnConstraintID($dependents, $constraint, $table-id, $constraint-id) - - toAbsent($dependents-target, $constraint-target) - - $dependents-node[CurrentStatus] = ABSENT - - $constraint-node[CurrentStatus] = ABSENT + - transient($dependents-target, $constraint-target) + - $dependents-node[CurrentStatus] = TRANSIENT_ABSENT + - $constraint-node[CurrentStatus] = TRANSIENT_ABSENT - joinTargetNode($dependents, $dependents-target, $dependents-node) - joinTargetNode($constraint, $constraint-target, $constraint-node) - name: dependents removed before constraint @@ -1667,9 +1775,9 @@ deprules - $dependents[Type] IN ['*scpb.ConstraintWithoutIndexName', '*scpb.ConstraintComment'] - $constraint[Type] = '*scpb.CheckConstraint' - joinOnConstraintID($dependents, $constraint, $table-id, $constraint-id) - - transient($dependents-target, $constraint-target) - - $dependents-node[CurrentStatus] = TRANSIENT_ABSENT - - $constraint-node[CurrentStatus] = TRANSIENT_ABSENT + - toAbsent($dependents-target, $constraint-target) + - $dependents-node[CurrentStatus] = ABSENT + - $constraint-node[CurrentStatus] = ABSENT - joinTargetNode($dependents, $dependents-target, $dependents-node) - joinTargetNode($constraint, $constraint-target, $constraint-node) - name: dependents removed before constraint @@ -1680,10 +1788,10 @@ deprules - $dependents[Type] IN ['*scpb.ConstraintWithoutIndexName', '*scpb.ConstraintComment'] - $constraint[Type] = '*scpb.CheckConstraint' - joinOnConstraintID($dependents, $constraint, $table-id, $constraint-id) - - $dependents-target[TargetStatus] = TRANSIENT_ABSENT - - $dependents-node[CurrentStatus] = TRANSIENT_ABSENT - - $constraint-target[TargetStatus] = ABSENT - - $constraint-node[CurrentStatus] = ABSENT + - $dependents-target[TargetStatus] = ABSENT + - $dependents-node[CurrentStatus] = ABSENT + - $constraint-target[TargetStatus] = TRANSIENT_ABSENT + - $constraint-node[CurrentStatus] = TRANSIENT_ABSENT - joinTargetNode($dependents, $dependents-target, $dependents-node) - joinTargetNode($constraint, $constraint-target, $constraint-node) - name: dependents removed before index @@ -1694,9 +1802,9 @@ deprules - $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) - - toAbsent($dependent-target, $index-target) - - $dependent-node[CurrentStatus] = ABSENT - - $index-node[CurrentStatus] = ABSENT + - 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 @@ -1707,10 +1815,9 @@ deprules - $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 + - toAbsent($dependent-target, $index-target) - $dependent-node[CurrentStatus] = ABSENT - - $index-target[TargetStatus] = TRANSIENT_ABSENT - - $index-node[CurrentStatus] = TRANSIENT_ABSENT + - $index-node[CurrentStatus] = ABSENT - joinTargetNode($dependent, $dependent-target, $dependent-node) - joinTargetNode($index, $index-target, $index-node) - name: dependents removed before index @@ -1721,9 +1828,10 @@ deprules - $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-target[TargetStatus] = TRANSIENT_ABSENT - $dependent-node[CurrentStatus] = TRANSIENT_ABSENT - - $index-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 @@ -1734,10 +1842,10 @@ deprules - $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 + - $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 DROPPED in transaction before removal @@ -1911,9 +2019,9 @@ deprules - $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 + - transient($index-target, $dependent-target) + - $index-node[CurrentStatus] = TRANSIENT_VALIDATED + - $dependent-node[CurrentStatus] = TRANSIENT_ABSENT - joinTargetNode($index, $index-target, $index-node) - joinTargetNode($dependent, $dependent-target, $dependent-node) - name: index no longer public before dependents @@ -1924,10 +2032,9 @@ deprules - $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 + - toAbsent($index-target, $dependent-target) - $index-node[CurrentStatus] = VALIDATED - - $dependent-target[TargetStatus] = TRANSIENT_ABSENT - - $dependent-node[CurrentStatus] = TRANSIENT_ABSENT + - $dependent-node[CurrentStatus] = ABSENT - joinTargetNode($index, $index-target, $index-node) - joinTargetNode($dependent, $dependent-target, $dependent-node) - name: index no longer public before dependents @@ -1938,8 +2045,9 @@ deprules - $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) - - transient($index-target, $dependent-target) - - $index-node[CurrentStatus] = TRANSIENT_VALIDATED + - $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($dependent, $dependent-target, $dependent-node) @@ -1957,20 +2065,60 @@ deprules - $dependent-node[CurrentStatus] = ABSENT - joinTargetNode($index, $index-target, $index-node) - joinTargetNode($dependent, $dependent-target, $dependent-node) -- name: index removed before garbage collection +- name: index no longer public before index name from: index-node kind: Precedence - to: index-data-node + to: name-node query: - - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - - $index-data[Type] = '*scpb.IndexData' - - joinOnIndexID($index, $index-data, $table-id, $index-id) + - $index[Type] = '*scpb.SecondaryIndex' + - $name[Type] = '*scpb.IndexName' + - joinOnIndexID($index, $name, $table-id, $index-id) - $index-target[TargetStatus] = ABSENT - - $index-node[CurrentStatus] = ABSENT - - $index-data-target[TargetStatus] = TRANSIENT_ABSENT - - $index-data-node[CurrentStatus] = TRANSIENT_DROPPED + - $index-node[CurrentStatus] = DELETE_ONLY + - $name-target[TargetStatus] = TRANSIENT_ABSENT + - $name-node[CurrentStatus] = TRANSIENT_ABSENT - joinTargetNode($index, $index-target, $index-node) - - joinTargetNode($index-data, $index-data-target, $index-data-node) + - joinTargetNode($name, $name-target, $name-node) +- name: index no longer public before index name + from: index-node + kind: Precedence + to: name-node + query: + - $index[Type] = '*scpb.SecondaryIndex' + - $name[Type] = '*scpb.IndexName' + - joinOnIndexID($index, $name, $table-id, $index-id) + - toAbsent($index-target, $name-target) + - $index-node[CurrentStatus] = DELETE_ONLY + - $name-node[CurrentStatus] = ABSENT + - joinTargetNode($index, $index-target, $index-node) + - joinTargetNode($name, $name-target, $name-node) +- name: index no longer public before index name + from: index-node + kind: Precedence + to: name-node + query: + - $index[Type] = '*scpb.SecondaryIndex' + - $name[Type] = '*scpb.IndexName' + - joinOnIndexID($index, $name, $table-id, $index-id) + - transient($index-target, $name-target) + - $index-node[CurrentStatus] = TRANSIENT_DELETE_ONLY + - $name-node[CurrentStatus] = TRANSIENT_ABSENT + - joinTargetNode($index, $index-target, $index-node) + - joinTargetNode($name, $name-target, $name-node) +- name: index no longer public before index name + from: index-node + kind: Precedence + to: name-node + query: + - $index[Type] = '*scpb.SecondaryIndex' + - $name[Type] = '*scpb.IndexName' + - joinOnIndexID($index, $name, $table-id, $index-id) + - $index-target[TargetStatus] = TRANSIENT_ABSENT + - $index-node[CurrentStatus] = TRANSIENT_DELETE_ONLY + - $name-target[TargetStatus] = ABSENT + - $name-node[CurrentStatus] = ABSENT + - joinTargetNode($index, $index-target, $index-node) + - joinTargetNode($name, $name-target, $name-node) - name: index removed before garbage collection from: index-node kind: Precedence @@ -1979,8 +2127,9 @@ deprules - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - $index-data[Type] = '*scpb.IndexData' - joinOnIndexID($index, $index-data, $table-id, $index-id) - - toAbsent($index-target, $index-data-target) - - $index-node[CurrentStatus] = ABSENT + - $index-target[TargetStatus] = TRANSIENT_ABSENT + - $index-node[CurrentStatus] = TRANSIENT_ABSENT + - $index-data-target[TargetStatus] = ABSENT - $index-data-node[CurrentStatus] = DROPPED - joinTargetNode($index, $index-target, $index-node) - joinTargetNode($index-data, $index-data-target, $index-data-node) @@ -2005,12 +2154,25 @@ deprules - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - $index-data[Type] = '*scpb.IndexData' - joinOnIndexID($index, $index-data, $table-id, $index-id) - - $index-target[TargetStatus] = TRANSIENT_ABSENT - - $index-node[CurrentStatus] = TRANSIENT_ABSENT - - $index-data-target[TargetStatus] = ABSENT + - toAbsent($index-target, $index-data-target) + - $index-node[CurrentStatus] = ABSENT - $index-data-node[CurrentStatus] = DROPPED - joinTargetNode($index, $index-target, $index-node) - joinTargetNode($index-data, $index-data-target, $index-data-node) +- name: index removed before garbage collection + from: index-node + kind: Precedence + to: index-data-node + query: + - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] + - $index-data[Type] = '*scpb.IndexData' + - joinOnIndexID($index, $index-data, $table-id, $index-id) + - $index-target[TargetStatus] = ABSENT + - $index-node[CurrentStatus] = ABSENT + - $index-data-target[TargetStatus] = TRANSIENT_ABSENT + - $index-data-node[CurrentStatus] = TRANSIENT_DROPPED + - joinTargetNode($index, $index-target, $index-node) + - joinTargetNode($index-data, $index-data-target, $index-data-node) - name: index-column added to index before index is backfilled from: index-column-node kind: Precedence @@ -2047,10 +2209,10 @@ deprules - columnInIndex($index-column, $index, $table-id, $column-id, $index-id) - joinOnColumnID($index-column, $column, $table-id, $column-id) - descriptorIsNotBeingDropped($index-column) - - $index-target[TargetStatus] = ABSENT - - $index-node[CurrentStatus] = ABSENT - - $column-target[TargetStatus] = TRANSIENT_ABSENT - - $column-node[CurrentStatus] = TRANSIENT_ABSENT + - $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 @@ -2063,9 +2225,8 @@ deprules - columnInIndex($index-column, $index, $table-id, $column-id, $index-id) - joinOnColumnID($index-column, $column, $table-id, $column-id) - descriptorIsNotBeingDropped($index-column) - - $index-target[TargetStatus] = TRANSIENT_ABSENT - - $index-node[CurrentStatus] = TRANSIENT_ABSENT - - $column-target[TargetStatus] = ABSENT + - toAbsent($index-target, $column-target) + - $index-node[CurrentStatus] = ABSENT - $column-node[CurrentStatus] = ABSENT - joinTargetNode($index, $index-target, $index-node) - joinTargetNode($column, $column-target, $column-node) @@ -2094,9 +2255,10 @@ deprules - columnInIndex($index-column, $index, $table-id, $column-id, $index-id) - joinOnColumnID($index-column, $column, $table-id, $column-id) - descriptorIsNotBeingDropped($index-column) - - toAbsent($index-target, $column-target) + - $index-target[TargetStatus] = ABSENT - $index-node[CurrentStatus] = ABSENT - - $column-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: old index absent before new index public when swapping with transient @@ -2128,10 +2290,9 @@ deprules - descriptorIsNotBeingDropped($partial-predicate) - $index[Type] = '*scpb.SecondaryIndex' - joinOnIndexID($partial-predicate, $index, $table-id, $index-id) - - $partial-predicate-target[TargetStatus] = TRANSIENT_ABSENT + - transient($partial-predicate-target, $index-target) - $partial-predicate-node[CurrentStatus] = TRANSIENT_ABSENT - - $index-target[TargetStatus] = ABSENT - - $index-node[CurrentStatus] = 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 @@ -2143,10 +2304,9 @@ deprules - descriptorIsNotBeingDropped($partial-predicate) - $index[Type] = '*scpb.SecondaryIndex' - joinOnIndexID($partial-predicate, $index, $table-id, $index-id) - - $partial-predicate-target[TargetStatus] = ABSENT + - toAbsent($partial-predicate-target, $index-target) - $partial-predicate-node[CurrentStatus] = ABSENT - - $index-target[TargetStatus] = TRANSIENT_ABSENT - - $index-node[CurrentStatus] = TRANSIENT_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 @@ -2158,8 +2318,9 @@ deprules - descriptorIsNotBeingDropped($partial-predicate) - $index[Type] = '*scpb.SecondaryIndex' - joinOnIndexID($partial-predicate, $index, $table-id, $index-id) - - toAbsent($partial-predicate-target, $index-target) - - $partial-predicate-node[CurrentStatus] = ABSENT + - $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) @@ -2172,8 +2333,9 @@ deprules - descriptorIsNotBeingDropped($partial-predicate) - $index[Type] = '*scpb.SecondaryIndex' - joinOnIndexID($partial-predicate, $index, $table-id, $index-id) - - transient($partial-predicate-target, $index-target) - - $partial-predicate-node[CurrentStatus] = TRANSIENT_ABSENT + - $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) @@ -2200,8 +2362,8 @@ deprules - 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 + - $old-index-target[TargetStatus] = ABSENT + - $old-index-node[CurrentStatus] = VALIDATED - $new-index-target[TargetStatus] IN [PUBLIC, TRANSIENT_ABSENT] - $new-index-node[CurrentStatus] = PUBLIC - joinTargetNode($old-index, $old-index-target, $old-index-node) @@ -2232,8 +2394,8 @@ deprules - joinOnDescID($old-index, $new-index, $table-id) - $old-index[IndexID] = $old-index-id - $new-index[SourceIndexID] = $old-index-id - - $old-index-target[TargetStatus] = ABSENT - - $old-index-node[CurrentStatus] = VALIDATED + - $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) @@ -2331,9 +2493,10 @@ deprules - $data-b[Type] IN ['*scpb.TableData', '*scpb.IndexData', '*scpb.DatabaseData'] - joinOnDescID($data-a, $data-b, $desc-id) - SmallerIDsFirst(scpb.Element, scpb.Element)($data-a, $data-b) - - toAbsent($data-a-target, $data-b-target) + - $data-a-target[TargetStatus] = ABSENT - $data-a-node[CurrentStatus] = DROPPED - - $data-b-node[CurrentStatus] = DROPPED + - $data-b-target[TargetStatus] = TRANSIENT_ABSENT + - $data-b-node[CurrentStatus] = TRANSIENT_DROPPED - joinTargetNode($data-a, $data-a-target, $data-a-node) - joinTargetNode($data-b, $data-b-target, $data-b-node) - name: schedule all GC jobs for a descriptor in the same stage @@ -2345,9 +2508,8 @@ deprules - $data-b[Type] IN ['*scpb.TableData', '*scpb.IndexData', '*scpb.DatabaseData'] - joinOnDescID($data-a, $data-b, $desc-id) - SmallerIDsFirst(scpb.Element, scpb.Element)($data-a, $data-b) - - $data-a-target[TargetStatus] = TRANSIENT_ABSENT - - $data-a-node[CurrentStatus] = TRANSIENT_DROPPED - - $data-b-target[TargetStatus] = ABSENT + - toAbsent($data-a-target, $data-b-target) + - $data-a-node[CurrentStatus] = DROPPED - $data-b-node[CurrentStatus] = DROPPED - joinTargetNode($data-a, $data-a-target, $data-a-node) - joinTargetNode($data-b, $data-b-target, $data-b-node) @@ -2360,10 +2522,10 @@ deprules - $data-b[Type] IN ['*scpb.TableData', '*scpb.IndexData', '*scpb.DatabaseData'] - joinOnDescID($data-a, $data-b, $desc-id) - SmallerIDsFirst(scpb.Element, scpb.Element)($data-a, $data-b) - - $data-a-target[TargetStatus] = ABSENT - - $data-a-node[CurrentStatus] = DROPPED - - $data-b-target[TargetStatus] = TRANSIENT_ABSENT - - $data-b-node[CurrentStatus] = TRANSIENT_DROPPED + - $data-a-target[TargetStatus] = TRANSIENT_ABSENT + - $data-a-node[CurrentStatus] = TRANSIENT_DROPPED + - $data-b-target[TargetStatus] = ABSENT + - $data-b-node[CurrentStatus] = DROPPED - joinTargetNode($data-a, $data-a-target, $data-a-node) - joinTargetNode($data-b, $data-b-target, $data-b-node) - name: schedule all GC jobs for a descriptor in the same stage @@ -2393,6 +2555,60 @@ deprules - $index-node[CurrentStatus] = VALIDATED - joinTargetNode($index-name, $index-name-target, $index-name-node) - joinTargetNode($index, $index-target, $index-node) +- name: secondary index should be validated before dependent view can be absent + from: index-node + kind: Precedence + to: view-node + query: + - $index[Type] = '*scpb.SecondaryIndex' + - $view[Type] = '*scpb.View' + - viewReferencesIndex(*scpb.SecondaryIndex, *scpb.View)($index, $view) + - $index-target[TargetStatus] = ABSENT + - $index-node[CurrentStatus] = VALIDATED + - $view-target[TargetStatus] = TRANSIENT_ABSENT + - $view-node[CurrentStatus] = TRANSIENT_ABSENT + - joinTargetNode($index, $index-target, $index-node) + - joinTargetNode($view, $view-target, $view-node) +- name: secondary index should be validated before dependent view can be absent + from: index-node + kind: Precedence + to: view-node + query: + - $index[Type] = '*scpb.SecondaryIndex' + - $view[Type] = '*scpb.View' + - viewReferencesIndex(*scpb.SecondaryIndex, *scpb.View)($index, $view) + - toAbsent($index-target, $view-target) + - $index-node[CurrentStatus] = VALIDATED + - $view-node[CurrentStatus] = ABSENT + - joinTargetNode($index, $index-target, $index-node) + - joinTargetNode($view, $view-target, $view-node) +- name: secondary index should be validated before dependent view can be absent + from: index-node + kind: Precedence + to: view-node + query: + - $index[Type] = '*scpb.SecondaryIndex' + - $view[Type] = '*scpb.View' + - viewReferencesIndex(*scpb.SecondaryIndex, *scpb.View)($index, $view) + - transient($index-target, $view-target) + - $index-node[CurrentStatus] = TRANSIENT_VALIDATED + - $view-node[CurrentStatus] = TRANSIENT_ABSENT + - joinTargetNode($index, $index-target, $index-node) + - joinTargetNode($view, $view-target, $view-node) +- name: secondary index should be validated before dependent view can be absent + from: index-node + kind: Precedence + to: view-node + query: + - $index[Type] = '*scpb.SecondaryIndex' + - $view[Type] = '*scpb.View' + - viewReferencesIndex(*scpb.SecondaryIndex, *scpb.View)($index, $view) + - $index-target[TargetStatus] = TRANSIENT_ABSENT + - $index-node[CurrentStatus] = TRANSIENT_VALIDATED + - $view-target[TargetStatus] = ABSENT + - $view-node[CurrentStatus] = ABSENT + - joinTargetNode($index, $index-target, $index-node) + - joinTargetNode($view, $view-target, $view-node) - name: secondary indexes containing column as key reach write-only before column from: index-node 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 d05281ab1dd1..e0cac437c1f0 100644 --- a/pkg/sql/schemachanger/scplan/testdata/alter_table_drop_column +++ b/pkg/sql/schemachanger/scplan/testdata/alter_table_drop_column @@ -14,12 +14,11 @@ SET sql_safe_updates = false; ops ALTER TABLE defaultdb.foo DROP COLUMN v1 CASCADE; ---- -StatementPhase stage 1 of 1 with 12 MutationType ops +StatementPhase stage 1 of 1 with 11 MutationType ops transitions: [[Column:{DescID: 107, ColumnID: 2}, ABSENT], PUBLIC] -> WRITE_ONLY [[ColumnName:{DescID: 107, Name: v1, ColumnID: 2}, ABSENT], PUBLIC] -> ABSENT [[SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT], PUBLIC] -> VALIDATED - [[IndexName:{DescID: 107, Name: foo_v2_key, IndexID: 2}, ABSENT], PUBLIC] -> ABSENT [[View:{DescID: 108}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 108, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 108, ColumnID: 2}, ABSENT], PUBLIC] -> WRITE_ONLY @@ -59,10 +58,6 @@ StatementPhase stage 1 of 1 with 12 MutationType ops *scop.MakePublicSecondaryIndexWriteOnly IndexID: 2 TableID: 107 - *scop.SetIndexName - IndexID: 2 - Name: crdb_internal_index_2_name_placeholder - TableID: 107 *scop.MarkDescriptorAsSyntheticallyDropped DescriptorID: 108 *scop.MakeAbsentIndexBackfilling @@ -219,7 +214,7 @@ PostCommitPhase stage 7 of 7 with 1 ValidationType op *scop.ValidateIndex IndexID: 3 TableID: 107 -PostCommitNonRevertiblePhase stage 1 of 3 with 24 MutationType ops +PostCommitNonRevertiblePhase stage 1 of 3 with 26 MutationType ops transitions: [[Column:{DescID: 107, ColumnID: 2}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 1}, ABSENT], PUBLIC] -> ABSENT @@ -231,6 +226,7 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 24 MutationType ops [[IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 2}, ABSENT], PUBLIC] -> ABSENT [[IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 2}, ABSENT], PUBLIC] -> ABSENT [[SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT], VALIDATED] -> DELETE_ONLY + [[IndexName:{DescID: 107, Name: foo_v2_key, IndexID: 2}, ABSENT], PUBLIC] -> ABSENT [[Namespace:{DescID: 108, Name: fooview, ReferencedDescID: 100}, ABSENT], PUBLIC] -> ABSENT [[Owner:{DescID: 108}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 108, Name: admin}, ABSENT], PUBLIC] -> ABSENT @@ -295,9 +291,29 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 24 MutationType ops *scop.MakeWriteOnlyIndexDeleteOnly IndexID: 4 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.MakeWriteOnlyIndexDeleteOnly IndexID: 2 TableID: 107 + *scop.SetIndexName + IndexID: 2 + Name: crdb_internal_index_2_name_placeholder + TableID: 107 *scop.DrainDescriptorName Namespace: DatabaseID: 100 @@ -381,29 +397,13 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 24 MutationType ops *scop.UpdateSchemaChangerJob IsNonCancelable: true JobID: 1 -PostCommitNonRevertiblePhase stage 2 of 3 with 10 MutationType ops +PostCommitNonRevertiblePhase stage 2 of 3 with 9 MutationType ops transitions: [[PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, ABSENT], VALIDATED] -> DELETE_ONLY [[SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT], DELETE_ONLY] -> ABSENT [[View:{DescID: 108}, ABSENT], DROPPED] -> ABSENT [[TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, TRANSIENT_ABSENT], TRANSIENT_DELETE_ONLY] -> TRANSIENT_ABSENT ops: - *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.MakeIndexAbsent IndexID: 2 TableID: 107 @@ -823,6 +823,10 @@ ALTER TABLE defaultdb.foo DROP COLUMN v1 CASCADE; to: [IndexData:{DescID: 107, IndexID: 2}, DROPPED] kind: Precedence rule: index removed before garbage collection +- from: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, DELETE_ONLY] + to: [IndexName:{DescID: 107, Name: foo_v2_key, IndexID: 2}, ABSENT] + kind: Precedence + rule: index no longer public before index name - from: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, DELETE_ONLY] to: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT] kind: PreviousTransactionPrecedence @@ -959,12 +963,11 @@ ALTER TABLE defaultdb.foo DROP COLUMN v1 CASCADE; ops ALTER TABLE defaultdb.foo DROP COLUMN v2 CASCADE; ---- -StatementPhase stage 1 of 1 with 12 MutationType ops +StatementPhase stage 1 of 1 with 11 MutationType ops transitions: [[Column:{DescID: 107, ColumnID: 3}, ABSENT], PUBLIC] -> WRITE_ONLY [[ColumnName:{DescID: 107, Name: v2, ColumnID: 3}, ABSENT], PUBLIC] -> ABSENT [[SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT], PUBLIC] -> VALIDATED - [[IndexName:{DescID: 107, Name: foo_v2_key, IndexID: 2}, ABSENT], PUBLIC] -> ABSENT [[View:{DescID: 108}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 108, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 108, ColumnID: 2}, ABSENT], PUBLIC] -> WRITE_ONLY @@ -982,10 +985,6 @@ StatementPhase stage 1 of 1 with 12 MutationType ops *scop.MakePublicSecondaryIndexWriteOnly IndexID: 2 TableID: 107 - *scop.SetIndexName - IndexID: 2 - Name: crdb_internal_index_2_name_placeholder - TableID: 107 *scop.MarkDescriptorAsSyntheticallyDropped DescriptorID: 108 *scop.MakeAbsentIndexBackfilling @@ -1176,7 +1175,7 @@ PostCommitPhase stage 7 of 7 with 1 ValidationType op *scop.ValidateIndex IndexID: 3 TableID: 107 -PostCommitNonRevertiblePhase stage 1 of 3 with 25 MutationType ops +PostCommitNonRevertiblePhase stage 1 of 3 with 27 MutationType ops transitions: [[Column:{DescID: 107, ColumnID: 3}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 1}, ABSENT], PUBLIC] -> ABSENT @@ -1188,6 +1187,7 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 25 MutationType ops [[IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 2}, ABSENT], PUBLIC] -> ABSENT [[IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 2}, ABSENT], PUBLIC] -> ABSENT [[SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT], VALIDATED] -> DELETE_ONLY + [[IndexName:{DescID: 107, Name: foo_v2_key, IndexID: 2}, ABSENT], PUBLIC] -> ABSENT [[Namespace:{DescID: 108, Name: fooview, ReferencedDescID: 100}, ABSENT], PUBLIC] -> ABSENT [[Owner:{DescID: 108}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 108, Name: admin}, ABSENT], PUBLIC] -> ABSENT @@ -1252,9 +1252,29 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 25 MutationType ops *scop.MakeWriteOnlyIndexDeleteOnly IndexID: 4 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.MakeWriteOnlyIndexDeleteOnly IndexID: 2 TableID: 107 + *scop.SetIndexName + IndexID: 2 + Name: crdb_internal_index_2_name_placeholder + TableID: 107 *scop.DrainDescriptorName Namespace: DatabaseID: 100 @@ -1340,29 +1360,13 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 25 MutationType ops *scop.UpdateSchemaChangerJob IsNonCancelable: true JobID: 1 -PostCommitNonRevertiblePhase stage 2 of 3 with 11 MutationType ops +PostCommitNonRevertiblePhase stage 2 of 3 with 10 MutationType ops transitions: [[PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 2}, ABSENT], VALIDATED] -> DELETE_ONLY [[SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT], DELETE_ONLY] -> ABSENT [[View:{DescID: 108}, ABSENT], DROPPED] -> ABSENT [[TemporaryIndex:{DescID: 107, IndexID: 4, ConstraintID: 4, SourceIndexID: 1}, TRANSIENT_ABSENT], TRANSIENT_DELETE_ONLY] -> TRANSIENT_ABSENT ops: - *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.MakeIndexAbsent IndexID: 2 TableID: 107 @@ -1801,6 +1805,10 @@ ALTER TABLE defaultdb.foo DROP COLUMN v2 CASCADE; to: [IndexData:{DescID: 107, IndexID: 2}, DROPPED] kind: Precedence rule: index removed before garbage collection +- from: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, DELETE_ONLY] + to: [IndexName:{DescID: 107, Name: foo_v2_key, IndexID: 2}, ABSENT] + kind: Precedence + rule: index no longer public before index name - from: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, DELETE_ONLY] to: [SecondaryIndex:{DescID: 107, IndexID: 2, ConstraintID: 1}, ABSENT] kind: PreviousTransactionPrecedence diff --git a/pkg/sql/schemachanger/scplan/testdata/drop_index b/pkg/sql/schemachanger/scplan/testdata/drop_index index 4573b9c7b8d4..07b9b08ca7c7 100644 --- a/pkg/sql/schemachanger/scplan/testdata/drop_index +++ b/pkg/sql/schemachanger/scplan/testdata/drop_index @@ -15,18 +15,13 @@ CREATE VIEW v AS SELECT count(j) FROM t1@idx4 ops DROP INDEX idx1 CASCADE ---- -StatementPhase stage 1 of 1 with 2 MutationType ops +StatementPhase stage 1 of 1 with 1 MutationType op transitions: [[SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0}, ABSENT], PUBLIC] -> VALIDATED - [[IndexName:{DescID: 104, Name: idx1, IndexID: 2}, ABSENT], PUBLIC] -> ABSENT ops: *scop.MakePublicSecondaryIndexWriteOnly IndexID: 2 TableID: 104 - *scop.SetIndexName - IndexID: 2 - Name: crdb_internal_index_2_name_placeholder - TableID: 104 PreCommitPhase stage 1 of 1 with 2 MutationType ops transitions: [[IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 2}, ABSENT], PUBLIC] -> ABSENT @@ -42,27 +37,15 @@ PreCommitPhase stage 1 of 1 with 2 MutationType ops - 104 JobID: 1 NonCancelable: true - RunningStatus: PostCommitNonRevertiblePhase stage 1 of 2 with 1 MutationType op pending + RunningStatus: PostCommitNonRevertiblePhase stage 1 of 2 with 3 MutationType ops pending Statements: - statement: DROP INDEX idx1 CASCADE redactedstatement: DROP INDEX ‹defaultdb›.public.‹t1›@‹idx1› CASCADE statementtag: DROP INDEX -PostCommitNonRevertiblePhase stage 1 of 2 with 3 MutationType ops +PostCommitNonRevertiblePhase stage 1 of 2 with 5 MutationType ops transitions: [[SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0}, ABSENT], VALIDATED] -> DELETE_ONLY - ops: - *scop.MakeWriteOnlyIndexDeleteOnly - IndexID: 2 - TableID: 104 - *scop.SetJobStateOnDescriptor - DescriptorID: 104 - *scop.UpdateSchemaChangerJob - IsNonCancelable: true - JobID: 1 -PostCommitNonRevertiblePhase stage 2 of 2 with 5 MutationType ops - transitions: - [[SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0}, ABSENT], DELETE_ONLY] -> ABSENT - [[IndexData:{DescID: 104, IndexID: 2}, ABSENT], PUBLIC] -> ABSENT + [[IndexName:{DescID: 104, Name: idx1, IndexID: 2}, ABSENT], PUBLIC] -> ABSENT ops: *scop.LogEvent Element: @@ -79,6 +62,23 @@ PostCommitNonRevertiblePhase stage 2 of 2 with 5 MutationType ops SourceElementID: 1 SubWorkID: 1 TargetStatus: 1 + *scop.MakeWriteOnlyIndexDeleteOnly + IndexID: 2 + TableID: 104 + *scop.SetIndexName + IndexID: 2 + Name: crdb_internal_index_2_name_placeholder + TableID: 104 + *scop.SetJobStateOnDescriptor + DescriptorID: 104 + *scop.UpdateSchemaChangerJob + IsNonCancelable: true + JobID: 1 +PostCommitNonRevertiblePhase stage 2 of 2 with 4 MutationType ops + transitions: + [[SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0}, ABSENT], DELETE_ONLY] -> ABSENT + [[IndexData:{DescID: 104, IndexID: 2}, ABSENT], PUBLIC] -> ABSENT + ops: *scop.MakeIndexAbsent IndexID: 2 TableID: 104 @@ -115,6 +115,10 @@ DROP INDEX idx1 CASCADE to: [IndexData:{DescID: 104, IndexID: 2}, DROPPED] kind: Precedence rule: index removed before garbage collection +- from: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0}, DELETE_ONLY] + to: [IndexName:{DescID: 104, Name: idx1, IndexID: 2}, ABSENT] + kind: Precedence + rule: index no longer public before index name - from: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0}, DELETE_ONLY] to: [SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0}, ABSENT] kind: PreviousTransactionPrecedence @@ -143,20 +147,15 @@ DROP INDEX idx1 CASCADE ops DROP INDEX idx2 CASCADE ---- -StatementPhase stage 1 of 1 with 5 MutationType ops +StatementPhase stage 1 of 1 with 4 MutationType ops transitions: [[Column:{DescID: 104, ColumnID: 4}, ABSENT], PUBLIC] -> WRITE_ONLY [[ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4}, ABSENT], PUBLIC] -> ABSENT [[SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 0}, ABSENT], PUBLIC] -> VALIDATED - [[IndexName:{DescID: 104, Name: idx2, IndexID: 4}, ABSENT], PUBLIC] -> ABSENT ops: *scop.MakePublicSecondaryIndexWriteOnly IndexID: 4 TableID: 104 - *scop.SetIndexName - IndexID: 4 - Name: crdb_internal_index_4_name_placeholder - TableID: 104 *scop.MakePublicColumnWriteOnly ColumnID: 4 TableID: 104 @@ -173,7 +172,7 @@ StatementPhase stage 1 of 1 with 5 MutationType ops Statement: DROP INDEX ‹defaultdb›.public.‹t1›@‹idx2› CASCADE StatementTag: DROP INDEX TargetMetadata: - SourceElementID: 1 + SourceElementID: 2 SubWorkID: 1 TargetStatus: 1 *scop.SetColumnName @@ -195,28 +194,48 @@ PreCommitPhase stage 1 of 1 with 2 MutationType ops - 104 JobID: 1 NonCancelable: true - RunningStatus: PostCommitNonRevertiblePhase stage 1 of 2 with 2 MutationType ops pending + RunningStatus: PostCommitNonRevertiblePhase stage 1 of 2 with 4 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 4 MutationType ops +PostCommitNonRevertiblePhase stage 1 of 2 with 6 MutationType ops transitions: [[Column:{DescID: 104, ColumnID: 4}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 0}, ABSENT], VALIDATED] -> DELETE_ONLY + [[IndexName:{DescID: 104, Name: idx2, IndexID: 4}, ABSENT], PUBLIC] -> ABSENT ops: *scop.MakeWriteOnlyColumnDeleteOnly ColumnID: 4 TableID: 104 + *scop.LogEvent + Element: + SecondaryIndex: + indexId: 4 + isCreatedExplicitly: true + tableId: 104 + EventBase: + Authorization: + UserName: root + Statement: DROP INDEX ‹defaultdb›.public.‹t1›@‹idx2› CASCADE + StatementTag: DROP INDEX + TargetMetadata: + SourceElementID: 1 + SubWorkID: 1 + TargetStatus: 1 *scop.MakeWriteOnlyIndexDeleteOnly IndexID: 4 TableID: 104 + *scop.SetIndexName + IndexID: 4 + Name: crdb_internal_index_4_name_placeholder + TableID: 104 *scop.SetJobStateOnDescriptor DescriptorID: 104 *scop.UpdateSchemaChangerJob IsNonCancelable: true JobID: 1 -PostCommitNonRevertiblePhase stage 2 of 2 with 7 MutationType ops +PostCommitNonRevertiblePhase stage 2 of 2 with 6 MutationType ops transitions: [[Column:{DescID: 104, ColumnID: 4}, ABSENT], DELETE_ONLY] -> ABSENT [[ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4}, ABSENT], PUBLIC] -> ABSENT @@ -227,21 +246,6 @@ PostCommitNonRevertiblePhase stage 2 of 2 with 7 MutationType ops *scop.RemoveDroppedIndexPartialPredicate IndexID: 4 TableID: 104 - *scop.LogEvent - Element: - SecondaryIndex: - indexId: 4 - isCreatedExplicitly: true - tableId: 104 - EventBase: - Authorization: - UserName: root - Statement: DROP INDEX ‹defaultdb›.public.‹t1›@‹idx2› CASCADE - StatementTag: DROP INDEX - TargetMetadata: - SourceElementID: 1 - SubWorkID: 1 - TargetStatus: 1 *scop.MakeIndexAbsent IndexID: 4 TableID: 104 @@ -258,7 +262,7 @@ PostCommitNonRevertiblePhase stage 2 of 2 with 7 MutationType ops Statement: DROP INDEX ‹defaultdb›.public.‹t1›@‹idx2› CASCADE StatementTag: DROP INDEX TargetMetadata: - SourceElementID: 1 + SourceElementID: 2 SubWorkID: 1 TableID: 104 *scop.RemoveJobStateFromDescriptor @@ -329,6 +333,10 @@ DROP INDEX idx2 CASCADE to: [IndexData:{DescID: 104, IndexID: 4}, DROPPED] kind: Precedence rule: index removed before garbage collection +- from: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 0}, DELETE_ONLY] + to: [IndexName:{DescID: 104, Name: idx2, IndexID: 4}, ABSENT] + kind: Precedence + rule: index no longer public before index name - from: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 0}, DELETE_ONLY] to: [SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 0}, ABSENT] kind: PreviousTransactionPrecedence @@ -369,22 +377,17 @@ DROP INDEX idx2 CASCADE ops DROP INDEX idx3 CASCADE ---- -StatementPhase stage 1 of 1 with 7 MutationType ops +StatementPhase stage 1 of 1 with 6 MutationType ops transitions: [[Column:{DescID: 104, ColumnID: 5}, ABSENT], PUBLIC] -> WRITE_ONLY [[ColumnName:{DescID: 104, Name: crdb_internal_i_shard_16, ColumnID: 5}, ABSENT], PUBLIC] -> ABSENT [[SecondaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 0}, ABSENT], PUBLIC] -> VALIDATED - [[IndexName:{DescID: 104, Name: idx3, IndexID: 6}, ABSENT], PUBLIC] -> ABSENT [[CheckConstraint:{DescID: 104, IndexID: 0, ConstraintID: 2}, ABSENT], PUBLIC] -> VALIDATED [[ConstraintWithoutIndexName:{DescID: 104, Name: check_crdb_internal_i_shard_16, ConstraintID: 2}, ABSENT], PUBLIC] -> ABSENT ops: *scop.MakePublicSecondaryIndexWriteOnly IndexID: 6 TableID: 104 - *scop.SetIndexName - IndexID: 6 - Name: crdb_internal_index_6_name_placeholder - TableID: 104 *scop.MakePublicCheckConstraintValidated ConstraintID: 2 TableID: 104 @@ -408,7 +411,7 @@ StatementPhase stage 1 of 1 with 7 MutationType ops Statement: DROP INDEX ‹defaultdb›.public.‹t1›@‹idx3› CASCADE StatementTag: DROP INDEX TargetMetadata: - SourceElementID: 1 + SourceElementID: 2 SubWorkID: 1 TargetStatus: 1 *scop.SetColumnName @@ -431,15 +434,16 @@ 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 5 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 5 MutationType ops +PostCommitNonRevertiblePhase stage 1 of 2 with 7 MutationType ops transitions: [[Column:{DescID: 104, ColumnID: 5}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[SecondaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 0}, ABSENT], VALIDATED] -> DELETE_ONLY + [[IndexName:{DescID: 104, Name: idx3, IndexID: 6}, ABSENT], PUBLIC] -> ABSENT [[CheckConstraint:{DescID: 104, IndexID: 0, ConstraintID: 2}, ABSENT], VALIDATED] -> ABSENT ops: *scop.MakeWriteOnlyColumnDeleteOnly @@ -448,21 +452,6 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 5 MutationType ops *scop.RemoveCheckConstraint ConstraintID: 2 TableID: 104 - *scop.MakeWriteOnlyIndexDeleteOnly - IndexID: 6 - TableID: 104 - *scop.SetJobStateOnDescriptor - DescriptorID: 104 - *scop.UpdateSchemaChangerJob - IsNonCancelable: true - JobID: 1 -PostCommitNonRevertiblePhase stage 2 of 2 with 6 MutationType ops - transitions: - [[Column:{DescID: 104, ColumnID: 5}, ABSENT], DELETE_ONLY] -> ABSENT - [[ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 5}, ABSENT], PUBLIC] -> ABSENT - [[SecondaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 0}, ABSENT], DELETE_ONLY] -> ABSENT - [[IndexData:{DescID: 104, IndexID: 6}, ABSENT], PUBLIC] -> ABSENT - ops: *scop.LogEvent Element: SecondaryIndex: @@ -484,6 +473,25 @@ PostCommitNonRevertiblePhase stage 2 of 2 with 6 MutationType ops SourceElementID: 1 SubWorkID: 1 TargetStatus: 1 + *scop.MakeWriteOnlyIndexDeleteOnly + IndexID: 6 + TableID: 104 + *scop.SetIndexName + IndexID: 6 + Name: crdb_internal_index_6_name_placeholder + TableID: 104 + *scop.SetJobStateOnDescriptor + DescriptorID: 104 + *scop.UpdateSchemaChangerJob + IsNonCancelable: true + JobID: 1 +PostCommitNonRevertiblePhase stage 2 of 2 with 5 MutationType ops + transitions: + [[Column:{DescID: 104, ColumnID: 5}, ABSENT], DELETE_ONLY] -> ABSENT + [[ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 5}, ABSENT], PUBLIC] -> ABSENT + [[SecondaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 0}, ABSENT], DELETE_ONLY] -> ABSENT + [[IndexData:{DescID: 104, IndexID: 6}, ABSENT], PUBLIC] -> ABSENT + ops: *scop.MakeIndexAbsent IndexID: 6 TableID: 104 @@ -500,7 +508,7 @@ PostCommitNonRevertiblePhase stage 2 of 2 with 6 MutationType ops Statement: DROP INDEX ‹defaultdb›.public.‹t1›@‹idx3› CASCADE StatementTag: DROP INDEX TargetMetadata: - SourceElementID: 1 + SourceElementID: 2 SubWorkID: 1 TableID: 104 *scop.RemoveJobStateFromDescriptor @@ -591,6 +599,10 @@ DROP INDEX idx3 CASCADE to: [IndexData:{DescID: 104, IndexID: 6}, DROPPED] kind: Precedence rule: index removed before garbage collection +- from: [SecondaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 0}, DELETE_ONLY] + to: [IndexName:{DescID: 104, Name: idx3, IndexID: 6}, ABSENT] + kind: Precedence + rule: index no longer public before index name - from: [SecondaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 0}, DELETE_ONLY] to: [SecondaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 0}, ABSENT] kind: PreviousTransactionPrecedence @@ -627,28 +639,20 @@ DROP INDEX idx3 CASCADE ops DROP INDEX idx4 CASCADE ---- -StatementPhase stage 1 of 1 with 3 MutationType ops +StatementPhase stage 1 of 1 with 1 MutationType op transitions: - [[SecondaryIndex:{DescID: 104, IndexID: 8, ConstraintID: 3}, ABSENT], PUBLIC] -> VALIDATED - [[IndexName:{DescID: 104, Name: idx4, IndexID: 8}, ABSENT], PUBLIC] -> ABSENT [[View:{DescID: 105}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 105, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 105, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 105, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY ops: - *scop.MakePublicSecondaryIndexWriteOnly - IndexID: 8 - TableID: 104 - *scop.SetIndexName - IndexID: 8 - Name: crdb_internal_index_8_name_placeholder - TableID: 104 *scop.MarkDescriptorAsSyntheticallyDropped DescriptorID: 105 -PreCommitPhase stage 1 of 1 with 10 MutationType ops +PreCommitPhase stage 1 of 1 with 11 MutationType ops transitions: [[IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 8}, ABSENT], PUBLIC] -> ABSENT [[IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 8}, ABSENT], PUBLIC] -> ABSENT + [[SecondaryIndex:{DescID: 104, IndexID: 8, ConstraintID: 3}, ABSENT], PUBLIC] -> VALIDATED [[Namespace:{DescID: 105, Name: v, ReferencedDescID: 100}, ABSENT], PUBLIC] -> ABSENT [[Owner:{DescID: 105}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 105, Name: admin}, ABSENT], PUBLIC] -> ABSENT @@ -673,6 +677,9 @@ PreCommitPhase stage 1 of 1 with 10 MutationType ops - 104 *scop.RemoveAllTableComments TableID: 105 + *scop.MakePublicSecondaryIndexWriteOnly + IndexID: 8 + TableID: 104 *scop.DrainDescriptorName Namespace: DatabaseID: 100 @@ -687,7 +694,7 @@ PreCommitPhase stage 1 of 1 with 10 MutationType ops Statement: DROP INDEX ‹defaultdb›.public.‹t1›@‹idx4› CASCADE StatementTag: DROP INDEX TargetMetadata: - SourceElementID: 1 + SourceElementID: 2 SubWorkID: 1 TableID: 105 *scop.MakeDeleteOnlyColumnAbsent @@ -698,7 +705,7 @@ PreCommitPhase stage 1 of 1 with 10 MutationType ops Statement: DROP INDEX ‹defaultdb›.public.‹t1›@‹idx4› CASCADE StatementTag: DROP INDEX TargetMetadata: - SourceElementID: 1 + SourceElementID: 2 SubWorkID: 1 TableID: 105 *scop.MakeDeleteOnlyColumnAbsent @@ -709,7 +716,7 @@ PreCommitPhase stage 1 of 1 with 10 MutationType ops Statement: DROP INDEX ‹defaultdb›.public.‹t1›@‹idx4› CASCADE StatementTag: DROP INDEX TargetMetadata: - SourceElementID: 1 + SourceElementID: 2 SubWorkID: 1 TableID: 105 *scop.SetJobStateOnDescriptor @@ -726,14 +733,15 @@ PreCommitPhase stage 1 of 1 with 10 MutationType ops - 105 JobID: 1 NonCancelable: true - RunningStatus: PostCommitNonRevertiblePhase stage 1 of 2 with 3 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 5 MutationType ops +PostCommitNonRevertiblePhase stage 1 of 2 with 7 MutationType ops transitions: [[SecondaryIndex:{DescID: 104, IndexID: 8, ConstraintID: 3}, ABSENT], VALIDATED] -> DELETE_ONLY + [[IndexName:{DescID: 104, Name: idx4, IndexID: 8}, ABSENT], PUBLIC] -> ABSENT [[View:{DescID: 105}, ABSENT], DROPPED] -> ABSENT ops: *scop.LogEvent @@ -753,26 +761,11 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 5 MutationType ops Statement: DROP INDEX ‹defaultdb›.public.‹t1›@‹idx4› CASCADE StatementTag: DROP INDEX TargetMetadata: - SourceElementID: 1 + SourceElementID: 2 SubWorkID: 1 TargetStatus: 1 *scop.DeleteDescriptor DescriptorID: 105 - *scop.MakeWriteOnlyIndexDeleteOnly - IndexID: 8 - TableID: 104 - *scop.SetJobStateOnDescriptor - DescriptorID: 104 - *scop.UpdateSchemaChangerJob - DescriptorIDsToRemove: - - 105 - IsNonCancelable: true - JobID: 1 -PostCommitNonRevertiblePhase stage 2 of 2 with 5 MutationType ops - transitions: - [[SecondaryIndex:{DescID: 104, IndexID: 8, ConstraintID: 3}, ABSENT], DELETE_ONLY] -> ABSENT - [[IndexData:{DescID: 104, IndexID: 8}, ABSENT], PUBLIC] -> ABSENT - ops: *scop.LogEvent Element: SecondaryIndex: @@ -790,6 +783,25 @@ PostCommitNonRevertiblePhase stage 2 of 2 with 5 MutationType ops SourceElementID: 1 SubWorkID: 1 TargetStatus: 1 + *scop.MakeWriteOnlyIndexDeleteOnly + IndexID: 8 + TableID: 104 + *scop.SetIndexName + IndexID: 8 + Name: crdb_internal_index_8_name_placeholder + TableID: 104 + *scop.SetJobStateOnDescriptor + DescriptorID: 104 + *scop.UpdateSchemaChangerJob + DescriptorIDsToRemove: + - 105 + IsNonCancelable: true + JobID: 1 +PostCommitNonRevertiblePhase stage 2 of 2 with 4 MutationType ops + transitions: + [[SecondaryIndex:{DescID: 104, IndexID: 8, ConstraintID: 3}, ABSENT], DELETE_ONLY] -> ABSENT + [[IndexData:{DescID: 104, IndexID: 8}, ABSENT], PUBLIC] -> ABSENT + ops: *scop.MakeIndexAbsent IndexID: 8 TableID: 104 @@ -874,6 +886,10 @@ DROP INDEX idx4 CASCADE to: [IndexData:{DescID: 104, IndexID: 8}, DROPPED] kind: Precedence rule: index removed before garbage collection +- from: [SecondaryIndex:{DescID: 104, IndexID: 8, ConstraintID: 3}, DELETE_ONLY] + to: [IndexName:{DescID: 104, Name: idx4, IndexID: 8}, ABSENT] + kind: Precedence + rule: index no longer public before index name - from: [SecondaryIndex:{DescID: 104, IndexID: 8, ConstraintID: 3}, DELETE_ONLY] to: [SecondaryIndex:{DescID: 104, IndexID: 8, ConstraintID: 3}, ABSENT] kind: PreviousTransactionPrecedence @@ -898,6 +914,14 @@ DROP INDEX idx4 CASCADE to: [SecondaryIndex:{DescID: 104, IndexID: 8, ConstraintID: 3}, WRITE_ONLY] kind: PreviousTransactionPrecedence rule: SecondaryIndex transitions to ABSENT uphold 2-version invariant: VALIDATED->WRITE_ONLY +- from: [SecondaryIndex:{DescID: 104, IndexID: 8, ConstraintID: 3}, VALIDATED] + to: [View:{DescID: 105}, ABSENT] + kind: Precedence + rule: secondary index should be validated before dependent view can be absent +- from: [View:{DescID: 105}, ABSENT] + to: [SecondaryIndex:{DescID: 104, IndexID: 8, ConstraintID: 3}, ABSENT] + kind: Precedence + rule: dependent view absent before secondary index - from: [View:{DescID: 105}, DROPPED] to: [ColumnName:{DescID: 105, Name: count, ColumnID: 1}, ABSENT] kind: Precedence @@ -934,6 +958,10 @@ DROP INDEX idx4 CASCADE to: [Owner:{DescID: 105}, ABSENT] kind: Precedence rule: descriptor drop right before dependent element removal +- from: [View:{DescID: 105}, DROPPED] + to: [SecondaryIndex:{DescID: 104, IndexID: 8, ConstraintID: 3}, VALIDATED] + kind: Precedence + rule: dependent view no longer public before secondary index - from: [View:{DescID: 105}, DROPPED] to: [UserPrivileges:{DescID: 105, Name: admin}, ABSENT] kind: Precedence diff --git a/pkg/sql/schemachanger/scplan/testdata/drop_table b/pkg/sql/schemachanger/scplan/testdata/drop_table index 795107d5d4e9..b49356631f92 100644 --- a/pkg/sql/schemachanger/scplan/testdata/drop_table +++ b/pkg/sql/schemachanger/scplan/testdata/drop_table @@ -851,6 +851,10 @@ DROP TABLE defaultdb.shipments CASCADE; to: [IndexData:{DescID: 109, IndexID: 2}, DROPPED] kind: Precedence rule: index removed before garbage collection +- from: [SecondaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 0}, DELETE_ONLY] + to: [IndexName:{DescID: 109, Name: partialidx, IndexID: 2}, ABSENT] + kind: Precedence + rule: index no longer public before index name - from: [SecondaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 0}, VALIDATED] to: [IndexColumn:{DescID: 109, ColumnID: 1, IndexID: 2}, ABSENT] kind: Precedence 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 5aa2fcba8637..ab09c2e4f8bb 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 @@ -37,7 +37,7 @@ begin transaction #1 checking for feature: ALTER TABLE increment telemetry for sql.schema.alter_table increment telemetry for sql.schema.alter_table.drop_column -## StatementPhase stage 1 of 1 with 12 MutationType ops +## StatementPhase stage 1 of 1 with 11 MutationType ops upsert descriptor #104 ... oid: 20 @@ -117,7 +117,7 @@ upsert descriptor #104 + - crdb_internal_column_3_name_placeholder + keySuffixColumnIds: + - 1 - + name: crdb_internal_index_2_name_placeholder + + name: t_expr_idx + partitioning: {} + sharded: {} + version: 3 @@ -322,7 +322,7 @@ begin transaction #9 validate forward indexes [3] in table #104 commit transaction #9 begin transaction #10 -## PostCommitNonRevertiblePhase stage 1 of 3 with 10 MutationType ops +## PostCommitNonRevertiblePhase stage 1 of 3 with 12 MutationType ops upsert descriptor #104 ... statement: ALTER TABLE t DROP COLUMN j CASCADE @@ -338,6 +338,12 @@ upsert descriptor #104 - direction: DROP index: ... + keySuffixColumnIds: + - 1 + - name: t_expr_idx + + name: crdb_internal_index_2_name_placeholder + partitioning: {} + sharded: {} version: 3 mutationId: 1 - state: WRITE_ONLY @@ -437,11 +443,12 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "6" + version: "7" -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 3 with 5 MutationType ops pending" +write *eventpb.DropIndex to event log: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 3 with 4 MutationType ops pending" set schema change job #1 to non-cancellable commit transaction #10 begin transaction #11 -## PostCommitNonRevertiblePhase stage 2 of 3 with 7 MutationType ops +## PostCommitNonRevertiblePhase stage 2 of 3 with 6 MutationType ops upsert descriptor #104 ... - direction: DROP @@ -519,7 +526,6 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "7" + version: "8" -write *eventpb.DropIndex to event log: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 3 with 5 MutationType ops pending" commit transaction #11 begin transaction #12 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 3ca191e46259..6e228b418d6e 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 @@ -38,7 +38,7 @@ begin transaction #1 checking for feature: ALTER TABLE increment telemetry for sql.schema.alter_table increment telemetry for sql.schema.alter_table.drop_column -## StatementPhase stage 1 of 1 with 14 MutationType ops +## StatementPhase stage 1 of 1 with 13 MutationType ops upsert descriptor #104 ... oid: 20 @@ -129,7 +129,7 @@ upsert descriptor #104 + - k + keySuffixColumnIds: + - 1 - + name: crdb_internal_index_2_name_placeholder + + name: t_expr_k_idx + partitioning: {} + sharded: {} + version: 3 @@ -602,7 +602,7 @@ begin transaction #17 validate forward indexes [5] in table #104 commit transaction #17 begin transaction #18 -## PostCommitNonRevertiblePhase stage 1 of 2 with 11 MutationType ops +## PostCommitNonRevertiblePhase stage 1 of 2 with 13 MutationType ops upsert descriptor #104 ... statementTag: CREATE INDEX @@ -646,6 +646,12 @@ upsert descriptor #104 - direction: DROP index: ... + keySuffixColumnIds: + - 1 + - name: t_expr_k_idx + + name: crdb_internal_index_2_name_placeholder + partitioning: {} + sharded: {} version: 3 mutationId: 1 - state: WRITE_ONLY @@ -715,13 +721,14 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "11" + version: "12" +write *eventpb.DropIndex to event log: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE write *eventpb.CreateIndex to event log: CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.‹public›.‹t› (‹k›) adding table for stats refresh: 104 -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 2 with 11 MutationType ops pending" +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 2 with 10 MutationType ops pending" set schema change job #1 to non-cancellable commit transaction #18 begin transaction #19 -## PostCommitNonRevertiblePhase stage 2 of 2 with 13 MutationType ops +## PostCommitNonRevertiblePhase stage 2 of 2 with 12 MutationType ops upsert descriptor #104 ... createAsOfTime: @@ -894,7 +901,7 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "12" + version: "13" -write *eventpb.DropIndex to event log: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE +write *eventpb.FinishSchemaChange to event log create job #2 (non-cancelable: true): "GC for ALTER TABLE defaultdb.public.t DROP COLUMN j CASCADE; CREATE UNIQUE INDEX idx ON defaultdb.public.t (k)" descriptor IDs: [104] update progress of schema change job #1: "all stages completed" diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_column_with_index b/pkg/sql/schemachanger/testdata/end_to_end/drop_column_with_index index 936ad9ab0ef8..d8ccd4b75ec0 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 @@ -38,7 +38,7 @@ begin transaction #1 checking for feature: ALTER TABLE increment telemetry for sql.schema.alter_table increment telemetry for sql.schema.alter_table.drop_column -## StatementPhase stage 1 of 1 with 9 MutationType ops +## StatementPhase stage 1 of 1 with 8 MutationType ops upsert descriptor #104 ... oid: 20 @@ -97,7 +97,7 @@ upsert descriptor #104 + - crdb_internal_column_2_name_placeholder + keySuffixColumnIds: + - 1 - + name: crdb_internal_index_2_name_placeholder + + name: t_j_idx + partitioning: {} + sharded: {} + version: 3 @@ -298,7 +298,7 @@ begin transaction #9 validate forward indexes [3] in table #104 commit transaction #9 begin transaction #10 -## PostCommitNonRevertiblePhase stage 1 of 3 with 9 MutationType ops +## PostCommitNonRevertiblePhase stage 1 of 3 with 11 MutationType ops upsert descriptor #104 ... statement: ALTER TABLE t DROP COLUMN j @@ -307,6 +307,12 @@ upsert descriptor #104 targetRanks: targets: ... + keySuffixColumnIds: + - 1 + - name: t_j_idx + + name: crdb_internal_index_2_name_placeholder + partitioning: {} + sharded: {} version: 3 mutationId: 1 - state: WRITE_ONLY @@ -422,11 +428,12 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "6" + version: "7" -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 3 with 4 MutationType ops pending" +write *eventpb.DropIndex to event log: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› +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 6 MutationType ops +## PostCommitNonRevertiblePhase stage 2 of 3 with 5 MutationType ops upsert descriptor #104 ... modificationTime: {} @@ -490,7 +497,6 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "7" + version: "8" -write *eventpb.DropIndex to event log: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 3 with 5 MutationType ops pending" commit transaction #11 begin transaction #12 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 572b3252079a..4c6adcd4f650 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 @@ -24,7 +24,7 @@ begin transaction #1 # begin StatementPhase checking for feature: DROP INDEX increment telemetry for sql.schema.drop_index -## StatementPhase stage 1 of 1 with 7 MutationType ops +## StatementPhase stage 1 of 1 with 6 MutationType ops upsert descriptor #104 ... - 3 @@ -107,7 +107,7 @@ upsert descriptor #104 + - j + keySuffixColumnIds: + - 1 - + name: crdb_internal_index_2_name_placeholder + + name: idx + partitioning: {} + sharded: + columnNames: @@ -190,7 +190,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 7 MutationType ops upsert descriptor #104 table: - checks: @@ -206,6 +206,13 @@ upsert descriptor #104 + checks: [] columns: - id: 1 + ... + keySuffixColumnIds: + - 1 + - name: idx + + name: crdb_internal_index_2_name_placeholder + partitioning: {} + sharded: ... version: 3 mutationId: 2 @@ -242,10 +249,11 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "9" + version: "10" -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 2 with 4 MutationType ops pending" +write *eventpb.DropIndex to event log: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 2 with 3 MutationType ops pending" commit transaction #3 begin transaction #4 -## PostCommitNonRevertiblePhase stage 2 of 2 with 6 MutationType ops +## PostCommitNonRevertiblePhase stage 2 of 2 with 5 MutationType ops upsert descriptor #104 ... createAsOfTime: @@ -319,7 +327,7 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "10" + version: "11" -write *eventpb.DropIndex to event log: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE +write *eventpb.FinishSchemaChange to event log create job #2 (non-cancelable: true): "GC for DROP INDEX defaultdb.public.t@idx CASCADE" descriptor IDs: [104] update progress of schema change job #1: "all stages completed" 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 629adaa8f492..db202cce3405 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 @@ -16,7 +16,7 @@ begin transaction #1 # begin StatementPhase checking for feature: DROP INDEX increment telemetry for sql.schema.drop_index -## StatementPhase stage 1 of 1 with 5 MutationType ops +## StatementPhase stage 1 of 1 with 4 MutationType ops upsert descriptor #104 ... family: StringFamily @@ -75,7 +75,7 @@ upsert descriptor #104 + - crdb_internal_column_3_name_placeholder + keySuffixColumnIds: + - 1 - + name: crdb_internal_index_2_name_placeholder + + name: idx + partitioning: {} + predicate: i > 0 + sharded: {} @@ -138,8 +138,15 @@ notified job registry to adopt jobs: [1] begin transaction #2 commit transaction #2 begin transaction #3 -## PostCommitNonRevertiblePhase stage 1 of 2 with 4 MutationType ops +## PostCommitNonRevertiblePhase stage 1 of 2 with 6 MutationType ops upsert descriptor #104 + ... + keySuffixColumnIds: + - 1 + - name: idx + + name: crdb_internal_index_2_name_placeholder + partitioning: {} + predicate: i > 0 ... version: 4 mutationId: 1 @@ -159,10 +166,11 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "9" + version: "10" -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 2 with 5 MutationType ops pending" +write *eventpb.DropIndex to event log: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 2 with 4 MutationType ops pending" commit transaction #3 begin transaction #4 -## PostCommitNonRevertiblePhase stage 2 of 2 with 7 MutationType ops +## PostCommitNonRevertiblePhase stage 2 of 2 with 6 MutationType ops upsert descriptor #104 ... createAsOfTime: @@ -230,7 +238,7 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "10" + version: "11" -write *eventpb.DropIndex to event log: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE +write *eventpb.FinishSchemaChange to event log create job #2 (non-cancelable: true): "GC for DROP INDEX defaultdb.public.t@idx CASCADE" descriptor IDs: [104] update progress of schema change job #1: "all stages completed" 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 baec74c52b4b..2aa7990d81db 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 @@ -29,7 +29,7 @@ begin transaction #1 # begin StatementPhase checking for feature: DROP INDEX increment telemetry for sql.schema.drop_index -## StatementPhase stage 1 of 1 with 2 MutationType ops +## StatementPhase stage 1 of 1 with 1 MutationType op upsert descriptor #104 ... formatVersion: 3 @@ -72,7 +72,7 @@ upsert descriptor #104 + - j + keySuffixColumnIds: + - 1 - + name: crdb_internal_index_2_name_placeholder + + name: idx + partitioning: {} + sharded: {} + version: 4 @@ -120,9 +120,15 @@ notified job registry to adopt jobs: [1] begin transaction #2 commit transaction #2 begin transaction #3 -## PostCommitNonRevertiblePhase stage 1 of 2 with 3 MutationType ops +## PostCommitNonRevertiblePhase stage 1 of 2 with 5 MutationType ops upsert descriptor #104 ... + keySuffixColumnIds: + - 1 + - name: idx + + name: crdb_internal_index_2_name_placeholder + partitioning: {} + sharded: {} version: 4 mutationId: 1 - state: WRITE_ONLY @@ -134,10 +140,11 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "9" + version: "10" -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 2 with 3 MutationType ops pending" +write *eventpb.DropIndex to event log: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 2 with 2 MutationType ops pending" commit transaction #3 begin transaction #4 -## PostCommitNonRevertiblePhase stage 2 of 2 with 5 MutationType ops +## PostCommitNonRevertiblePhase stage 2 of 2 with 4 MutationType ops upsert descriptor #104 ... createAsOfTime: @@ -191,7 +198,6 @@ upsert descriptor #104 - version: "10" + version: "11" write *eventpb.FinishSchemaChange to event log -write *eventpb.DropIndex to event log: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE create job #2 (non-cancelable: true): "GC for DROP INDEX defaultdb.public.t@idx CASCADE" descriptor IDs: [104] update progress of schema change job #1: "all stages completed" 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 8152bc083c1f..3b3e4f14c190 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 @@ -52,7 +52,7 @@ begin transaction #1 checking for feature: ALTER TABLE increment telemetry for sql.schema.alter_table increment telemetry for sql.schema.alter_table.drop_column -## StatementPhase stage 1 of 1 with 14 MutationType ops +## StatementPhase stage 1 of 1 with 13 MutationType ops upsert descriptor #104 ... oid: 20 @@ -143,7 +143,7 @@ upsert descriptor #104 + - k + keySuffixColumnIds: + - 1 - + name: crdb_internal_index_2_name_placeholder + + name: t_expr_k_idx + partitioning: {} + sharded: {} + version: 3 @@ -436,7 +436,7 @@ begin transaction #9 validate forward indexes [3] in table #104 commit transaction #9 begin transaction #10 -## PostCommitNonRevertiblePhase stage 1 of 3 with 12 MutationType ops +## PostCommitNonRevertiblePhase stage 1 of 3 with 14 MutationType ops upsert descriptor #104 ... statementTag: ALTER TABLE @@ -452,6 +452,12 @@ upsert descriptor #104 - direction: DROP index: ... + keySuffixColumnIds: + - 1 + - name: t_expr_k_idx + + name: crdb_internal_index_2_name_placeholder + partitioning: {} + sharded: {} version: 3 mutationId: 1 - state: WRITE_ONLY @@ -566,11 +572,12 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "6" + version: "7" -update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 3 with 5 MutationType ops pending" +write *eventpb.DropIndex to event log: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE +update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 2 of 3 with 4 MutationType ops pending" set schema change job #1 to non-cancellable commit transaction #10 begin transaction #11 -## PostCommitNonRevertiblePhase stage 2 of 3 with 7 MutationType ops +## PostCommitNonRevertiblePhase stage 2 of 3 with 6 MutationType ops upsert descriptor #104 ... mutationId: 1 @@ -655,7 +662,6 @@ upsert descriptor #104 unexposedParentSchemaId: 101 - version: "7" + version: "8" -write *eventpb.DropIndex to event log: ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COLUMN ‹j› CASCADE update progress of schema change job #1: "PostCommitNonRevertiblePhase stage 3 of 3 with 8 MutationType ops pending" commit transaction #11 begin transaction #12 diff --git a/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_10_of_15 b/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_10_of_15 index 406c77929b67..e3c31135e53c 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_10_of_15 +++ b/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_10_of_15 @@ -29,7 +29,7 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 5} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 5, SourceIndexID: 2} - │ └── 13 Mutation operations + │ └── 12 Mutation operations │ ├── SetIndexName {"IndexID":1,"Name":"tbl_pkey","TableID":106} │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":106} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":106} @@ -39,7 +39,6 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ ├── SetIndexName {"IndexID":4,"Name":"crdb_internal_in...","TableID":106} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":5,"TableID":106} │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":1,"TableID":106} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} diff --git a/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_11_of_15 b/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_11_of_15 index 866568038269..19b2367fb81a 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_11_of_15 +++ b/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_11_of_15 @@ -29,7 +29,7 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 5} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 5, SourceIndexID: 2} - │ └── 13 Mutation operations + │ └── 12 Mutation operations │ ├── SetIndexName {"IndexID":1,"Name":"tbl_pkey","TableID":106} │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":106} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":106} @@ -39,7 +39,6 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ ├── SetIndexName {"IndexID":4,"Name":"crdb_internal_in...","TableID":106} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":5,"TableID":106} │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":1,"TableID":106} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} diff --git a/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_12_of_15 b/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_12_of_15 index 32ad369f37e2..26b0d9b17afb 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_12_of_15 +++ b/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_12_of_15 @@ -29,7 +29,7 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 5} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 5, SourceIndexID: 2} - │ └── 13 Mutation operations + │ └── 12 Mutation operations │ ├── SetIndexName {"IndexID":1,"Name":"tbl_pkey","TableID":106} │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":106} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":106} @@ -39,7 +39,6 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ ├── SetIndexName {"IndexID":4,"Name":"crdb_internal_in...","TableID":106} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":5,"TableID":106} │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":1,"TableID":106} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} diff --git a/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_13_of_15 b/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_13_of_15 index a991aa9f1f65..573d2ddfbe13 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_13_of_15 +++ b/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_13_of_15 @@ -29,17 +29,18 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 5} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 5, SourceIndexID: 2} - │ └── 12 Mutation operations + │ └── 13 Mutation operations │ ├── SetIndexName {"IndexID":1,"Name":"tbl_pkey","TableID":106} │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":106} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":106} │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":2,"TableID":106} │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":106} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":106} - │ ├── SetIndexName {"IndexID":4,"Name":"crdb_internal_in...","TableID":106} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":5,"TableID":106} │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":1,"TableID":106} + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":106} + │ ├── SetIndexName {"IndexID":4,"Name":"crdb_internal_in...","TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} ├── Stage 2 of 3 in PostCommitNonRevertiblePhase @@ -48,9 +49,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} │ │ ├── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 106, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2} │ │ └── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 5, SourceIndexID: 2} - │ └── 7 Mutation operations + │ └── 6 Mutation operations │ ├── MakeIndexAbsent {"IndexID":3,"TableID":106} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":106} │ ├── MakeIndexAbsent {"IndexID":5,"TableID":106} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":106} diff --git a/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_14_of_15 b/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_14_of_15 index d986f26d5ddf..0874b911ec3f 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_14_of_15 +++ b/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_14_of_15 @@ -29,17 +29,18 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 5} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 5, SourceIndexID: 2} - │ └── 12 Mutation operations + │ └── 13 Mutation operations │ ├── SetIndexName {"IndexID":1,"Name":"tbl_pkey","TableID":106} │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":106} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":106} │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":2,"TableID":106} │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":106} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":106} - │ ├── SetIndexName {"IndexID":4,"Name":"crdb_internal_in...","TableID":106} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":5,"TableID":106} │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":1,"TableID":106} + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":106} + │ ├── SetIndexName {"IndexID":4,"Name":"crdb_internal_in...","TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} ├── Stage 2 of 3 in PostCommitNonRevertiblePhase @@ -48,9 +49,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} │ │ ├── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 106, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2} │ │ └── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 5, SourceIndexID: 2} - │ └── 7 Mutation operations + │ └── 6 Mutation operations │ ├── MakeIndexAbsent {"IndexID":3,"TableID":106} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":106} │ ├── MakeIndexAbsent {"IndexID":5,"TableID":106} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":106} diff --git a/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_15_of_15 b/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_15_of_15 index 541f1d0c282c..904564810fca 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_15_of_15 +++ b/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_15_of_15 @@ -29,13 +29,14 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 5} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 5, SourceIndexID: 2} - │ └── 12 Mutation operations + │ └── 13 Mutation operations │ ├── SetIndexName {"IndexID":1,"Name":"tbl_pkey","TableID":106} │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":106} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":106} │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":2,"TableID":106} │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":106} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":106} + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":106} │ ├── SetIndexName {"IndexID":4,"Name":"crdb_internal_in...","TableID":106} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":5,"TableID":106} @@ -48,9 +49,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} │ │ ├── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 106, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2} │ │ └── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 5, SourceIndexID: 2} - │ └── 7 Mutation operations + │ └── 6 Mutation operations │ ├── MakeIndexAbsent {"IndexID":3,"TableID":106} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":106} │ ├── MakeIndexAbsent {"IndexID":5,"TableID":106} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":106} diff --git a/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_9_of_15 b/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_9_of_15 index 74769ca08792..284bc2fa378e 100644 --- a/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_9_of_15 +++ b/pkg/sql/schemachanger/testdata/explain/add_column_default_unique.rollback_9_of_15 @@ -29,7 +29,7 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 5} │ │ └── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 5, SourceIndexID: 2} - │ └── 13 Mutation operations + │ └── 12 Mutation operations │ ├── SetIndexName {"IndexID":1,"Name":"tbl_pkey","TableID":106} │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":106} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":106} @@ -39,7 +39,6 @@ Schema change plan for rolling back ALTER TABLE ‹db›.public.‹tbl› ADD CO │ ├── SetIndexName {"IndexID":4,"Name":"crdb_internal_in...","TableID":106} │ ├── MakeIndexAbsent {"IndexID":5,"TableID":106} │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":1,"TableID":106} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} 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 436ef663ebfa..371697ed7c75 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 @@ -24,12 +24,11 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› A │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} │ └── PUBLIC → ABSENT IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} - └── 10 Mutation operations + └── 9 Mutation operations ├── SetIndexName {"IndexID":4,"Name":"crdb_internal_in...","TableID":104} ├── MakeIndexAbsent {"IndexID":2,"TableID":104} ├── CreateGCJobForIndex {"IndexID":2,"TableID":104} ├── MakeIndexAbsent {"IndexID":3,"TableID":104} - ├── LogEvent {"TargetStatus":1} ├── MakeIndexAbsent {"IndexID":4,"TableID":104} ├── CreateGCJobForIndex {"IndexID":4,"TableID":104} ├── MakeIndexAbsent {"IndexID":5,"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 9560cd48f124..efa73be43496 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 @@ -22,12 +22,11 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› A │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} - │ └── 8 Mutation operations + │ └── 7 Mutation operations │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":5,"TableID":104} │ ├── SetIndexName {"IndexID":4,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} 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 38ea600cf592..907d510091f4 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 @@ -22,12 +22,11 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› A │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} - │ └── 8 Mutation operations + │ └── 7 Mutation operations │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":5,"TableID":104} │ ├── SetIndexName {"IndexID":4,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} 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 4b401e459ff6..bd158017c048 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 @@ -22,12 +22,11 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› A │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} - │ └── 8 Mutation operations + │ └── 7 Mutation operations │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":5,"TableID":104} │ ├── SetIndexName {"IndexID":4,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} 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 1d352865e7a0..226e3742edcb 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 @@ -22,12 +22,13 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› A │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} - │ └── 7 Mutation operations + │ └── 8 Mutation operations │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":5,"TableID":104} - │ ├── SetIndexName {"IndexID":4,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── SetIndexName {"IndexID":4,"Name":"crdb_internal_in...","TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase @@ -40,12 +41,11 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› A │ ├── PUBLIC → ABSENT IndexData:{DescID: 104, IndexID: 4} │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1} │ └── PUBLIC → ABSENT IndexData:{DescID: 104, IndexID: 5} - └── 11 Mutation operations + └── 10 Mutation operations ├── MakeIndexAbsent {"IndexID":2,"TableID":104} ├── CreateGCJobForIndex {"IndexID":2,"TableID":104} ├── MakeIndexAbsent {"IndexID":3,"TableID":104} ├── CreateGCJobForIndex {"IndexID":3,"TableID":104} - ├── LogEvent {"TargetStatus":1} ├── MakeIndexAbsent {"IndexID":4,"TableID":104} ├── CreateGCJobForIndex {"IndexID":4,"TableID":104} ├── MakeIndexAbsent {"IndexID":5,"TableID":104} 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 b8f635843c8d..292f52998c4c 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 @@ -22,12 +22,13 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› A │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} - │ └── 7 Mutation operations + │ └── 8 Mutation operations │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":5,"TableID":104} - │ ├── SetIndexName {"IndexID":4,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── SetIndexName {"IndexID":4,"Name":"crdb_internal_in...","TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase @@ -40,12 +41,11 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› A │ ├── PUBLIC → ABSENT IndexData:{DescID: 104, IndexID: 4} │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1} │ └── PUBLIC → ABSENT IndexData:{DescID: 104, IndexID: 5} - └── 11 Mutation operations + └── 10 Mutation operations ├── MakeIndexAbsent {"IndexID":2,"TableID":104} ├── CreateGCJobForIndex {"IndexID":2,"TableID":104} ├── MakeIndexAbsent {"IndexID":3,"TableID":104} ├── CreateGCJobForIndex {"IndexID":3,"TableID":104} - ├── LogEvent {"TargetStatus":1} ├── MakeIndexAbsent {"IndexID":4,"TableID":104} ├── CreateGCJobForIndex {"IndexID":4,"TableID":104} ├── MakeIndexAbsent {"IndexID":5,"TableID":104} 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 d27581a69b2f..e3a07a6c2dde 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 @@ -22,9 +22,10 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› A │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 4} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 5} │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} - │ └── 7 Mutation operations + │ └── 8 Mutation operations │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":5,"TableID":104} │ ├── SetIndexName {"IndexID":4,"Name":"crdb_internal_in...","TableID":104} @@ -40,12 +41,11 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› A │ ├── PUBLIC → ABSENT IndexData:{DescID: 104, IndexID: 4} │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1} │ └── PUBLIC → ABSENT IndexData:{DescID: 104, IndexID: 5} - └── 11 Mutation operations + └── 10 Mutation operations ├── MakeIndexAbsent {"IndexID":2,"TableID":104} ├── CreateGCJobForIndex {"IndexID":2,"TableID":104} ├── MakeIndexAbsent {"IndexID":3,"TableID":104} ├── CreateGCJobForIndex {"IndexID":3,"TableID":104} - ├── LogEvent {"TargetStatus":1} ├── MakeIndexAbsent {"IndexID":4,"TableID":104} ├── CreateGCJobForIndex {"IndexID":4,"TableID":104} ├── MakeIndexAbsent {"IndexID":5,"TableID":104} 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 3be56513262d..b49700ef274a 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 @@ -20,11 +20,10 @@ Schema change plan for rolling back CREATE INDEX ‹idx1› ON ‹defaultdb›.p │ ├── PUBLIC → ABSENT SecondaryIndexPartial:{DescID: 106, IndexID: 3} │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - └── 9 Mutation operations + └── 8 Mutation operations ├── RemoveDroppedIndexPartialPredicate {"IndexID":2,"TableID":106} ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":106} ├── RemoveDroppedIndexPartialPredicate {"IndexID":3,"TableID":106} - ├── LogEvent {"TargetStatus":1} ├── MakeIndexAbsent {"IndexID":2,"TableID":106} ├── CreateGCJobForIndex {"IndexID":2,"TableID":106} ├── MakeIndexAbsent {"IndexID":3,"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 951a65577200..63304501500c 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 @@ -19,12 +19,11 @@ Schema change plan for rolling back CREATE INDEX ‹idx1› ON ‹defaultdb›.p │ │ ├── PUBLIC → ABSENT SecondaryIndexPartial:{DescID: 106, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ └── 8 Mutation operations + │ └── 7 Mutation operations │ ├── RemoveDroppedIndexPartialPredicate {"IndexID":2,"TableID":106} │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":106} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":106} │ ├── RemoveDroppedIndexPartialPredicate {"IndexID":3,"TableID":106} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} 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 fcafb36f6660..df7e0644bd50 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 @@ -19,12 +19,11 @@ Schema change plan for rolling back CREATE INDEX ‹idx1› ON ‹defaultdb›.p │ │ ├── PUBLIC → ABSENT SecondaryIndexPartial:{DescID: 106, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ └── 8 Mutation operations + │ └── 7 Mutation operations │ ├── RemoveDroppedIndexPartialPredicate {"IndexID":2,"TableID":106} │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":106} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":106} │ ├── RemoveDroppedIndexPartialPredicate {"IndexID":3,"TableID":106} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} 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 9716aa347afc..284809ee14c2 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 @@ -19,12 +19,11 @@ Schema change plan for rolling back CREATE INDEX ‹idx1› ON ‹defaultdb›.p │ │ ├── PUBLIC → ABSENT SecondaryIndexPartial:{DescID: 106, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ └── 8 Mutation operations + │ └── 7 Mutation operations │ ├── RemoveDroppedIndexPartialPredicate {"IndexID":2,"TableID":106} │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":106} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":106} │ ├── RemoveDroppedIndexPartialPredicate {"IndexID":3,"TableID":106} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":2,"TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} 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 161abc7b691e..27b16c14d93f 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 @@ -18,11 +18,12 @@ Schema change plan for rolling back CREATE INDEX ‹idx1› ON ‹defaultdb›.p │ │ ├── PUBLIC → ABSENT SecondaryIndexPartial:{DescID: 106, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ └── 6 Mutation operations - │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":106} + │ └── 7 Mutation operations │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":106} │ ├── RemoveDroppedIndexPartialPredicate {"IndexID":3,"TableID":106} + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":106} + │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase @@ -32,10 +33,9 @@ Schema change plan for rolling back CREATE INDEX ‹idx1› ON ‹defaultdb›.p │ ├── PUBLIC → ABSENT IndexData:{DescID: 106, IndexID: 2} │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ └── PUBLIC → ABSENT IndexData:{DescID: 106, IndexID: 3} - └── 8 Mutation operations + └── 7 Mutation operations ├── RemoveDroppedIndexPartialPredicate {"IndexID":2,"TableID":106} ├── MakeIndexAbsent {"IndexID":3,"TableID":106} - ├── LogEvent {"TargetStatus":1} ├── MakeIndexAbsent {"IndexID":2,"TableID":106} ├── CreateGCJobForIndex {"IndexID":2,"TableID":106} ├── CreateGCJobForIndex {"IndexID":3,"TableID":106} 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 b44b5d50dc49..db27cad358b0 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 @@ -18,11 +18,12 @@ Schema change plan for rolling back CREATE INDEX ‹idx1› ON ‹defaultdb›.p │ │ ├── PUBLIC → ABSENT SecondaryIndexPartial:{DescID: 106, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ └── 6 Mutation operations - │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":106} + │ └── 7 Mutation operations │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":106} │ ├── RemoveDroppedIndexPartialPredicate {"IndexID":3,"TableID":106} + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":106} + │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":106} │ ├── SetJobStateOnDescriptor {"DescriptorID":106} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase @@ -32,10 +33,9 @@ Schema change plan for rolling back CREATE INDEX ‹idx1› ON ‹defaultdb›.p │ ├── PUBLIC → ABSENT IndexData:{DescID: 106, IndexID: 2} │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ └── PUBLIC → ABSENT IndexData:{DescID: 106, IndexID: 3} - └── 8 Mutation operations + └── 7 Mutation operations ├── RemoveDroppedIndexPartialPredicate {"IndexID":2,"TableID":106} ├── MakeIndexAbsent {"IndexID":3,"TableID":106} - ├── LogEvent {"TargetStatus":1} ├── MakeIndexAbsent {"IndexID":2,"TableID":106} ├── CreateGCJobForIndex {"IndexID":2,"TableID":106} ├── CreateGCJobForIndex {"IndexID":3,"TableID":106} 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 9d4ed3a70e8f..3d02d59e73a9 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 @@ -18,7 +18,8 @@ Schema change plan for rolling back CREATE INDEX ‹idx1› ON ‹defaultdb›.p │ │ ├── PUBLIC → ABSENT SecondaryIndexPartial:{DescID: 106, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 106, ColumnID: 1, IndexID: 3} - │ └── 6 Mutation operations + │ └── 7 Mutation operations + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":106} │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":106} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":106} @@ -32,10 +33,9 @@ Schema change plan for rolling back CREATE INDEX ‹idx1› ON ‹defaultdb›.p │ ├── PUBLIC → ABSENT IndexData:{DescID: 106, IndexID: 2} │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ └── PUBLIC → ABSENT IndexData:{DescID: 106, IndexID: 3} - └── 8 Mutation operations + └── 7 Mutation operations ├── RemoveDroppedIndexPartialPredicate {"IndexID":2,"TableID":106} ├── MakeIndexAbsent {"IndexID":3,"TableID":106} - ├── LogEvent {"TargetStatus":1} ├── MakeIndexAbsent {"IndexID":2,"TableID":106} ├── CreateGCJobForIndex {"IndexID":2,"TableID":106} ├── CreateGCJobForIndex {"IndexID":3,"TableID":106} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index b/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index index f88e96adbb2b..f1d1b1b8a7c7 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_computed_index @@ -14,19 +14,17 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── 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} - │ ├── 6 elements transitioning toward ABSENT + │ ├── 5 elements transitioning toward ABSENT │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104, ColumnID: 2} │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104, ColumnID: 3} │ │ ├── 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} - │ └── 12 Mutation operations + │ │ └── PUBLIC → VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ └── 11 Mutation operations │ ├── MakePublicColumnWriteOnly {"ColumnID":2,"TableID":104} │ ├── LogEvent {"TargetStatus":1} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":104} │ ├── MakePublicSecondaryIndexWriteOnly {"IndexID":2,"TableID":104} - │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeAbsentIndexBackfilling {"Index":{"ConstraintID":2,"IndexID":3,"IsUnique":true,"SourceIndexID":1,"TableID":104,"TemporaryIndexID":4}} │ ├── AddColumnToIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── MakeAbsentTempIndexDeleteOnly {"Index":{"ConstraintID":3,"IndexID":4,"IsUnique":true,"SourceIndexID":1,"TableID":104}} @@ -92,7 +90,7 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── 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 elements transitioning toward ABSENT + │ ├── 10 elements transitioning toward ABSENT │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104, ColumnID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} @@ -101,15 +99,18 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} │ │ ├── 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} - │ └── 10 Mutation operations + │ │ ├── VALIDATED → DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} + │ └── 12 Mutation operations │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":104} │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":3,"TableID":104} │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":1,"TableID":104} │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":104} │ ├── SetIndexName {"IndexID":3,"Name":"t_pkey","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":104} + │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} @@ -121,8 +122,7 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ └── 7 Mutation operations - │ ├── LogEvent {"TargetStatus":1} + │ └── 6 Mutation operations │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} │ ├── MakeDeleteOnlyColumnAbsent {"ColumnID":3,"TableID":104} 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 d02281f9444b..0a1cf0389d01 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 @@ -8,30 +8,28 @@ EXPLAIN (ddl) rollback at post-commit stage 1 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase └── Stage 1 of 1 in PostCommitNonRevertiblePhase - ├── 6 elements transitioning toward PUBLIC + ├── 5 elements transitioning toward PUBLIC │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 3} │ ├── 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} + │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} ├── 5 elements transitioning toward ABSENT │ ├── BACKFILL_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ ├── PUBLIC → ABSENT IndexData:{DescID: 104, IndexID: 3} │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - └── 15 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} + ├── RefreshStats {"TableID":104} + ├── LogEvent {"TargetStatus":2} + ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} ├── RefreshStats {"TableID":104} ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} ├── RefreshStats {"TableID":104} - ├── RefreshStats {"TableID":104} - ├── LogEvent {"TargetStatus":2} - ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} ├── MakeIndexAbsent {"IndexID":3,"TableID":104} ├── CreateGCJobForIndex {"IndexID":3,"TableID":104} ├── MakeIndexAbsent {"IndexID":4,"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 427650e5fe8e..a81501ed6ecc 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 @@ -8,30 +8,28 @@ EXPLAIN (ddl) rollback at post-commit stage 2 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 6 elements transitioning toward PUBLIC + │ ├── 5 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 3} │ │ ├── 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} + │ │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ ├── 4 elements transitioning toward ABSENT │ │ ├── BACKFILL_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ └── 14 Mutation operations + │ └── 13 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} + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} 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 60426814f61c..70996194847e 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 @@ -8,30 +8,28 @@ EXPLAIN (ddl) rollback at post-commit stage 3 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 6 elements transitioning toward PUBLIC + │ ├── 5 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 3} │ │ ├── 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} + │ │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ ├── 4 elements transitioning toward ABSENT │ │ ├── BACKFILL_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ └── 14 Mutation operations + │ └── 13 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} + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} 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 33c86ccb983d..7fc73a3d85f0 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 @@ -8,30 +8,28 @@ EXPLAIN (ddl) rollback at post-commit stage 4 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 6 elements transitioning toward PUBLIC + │ ├── 5 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 3} │ │ ├── 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} + │ │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ ├── 4 elements transitioning toward ABSENT │ │ ├── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ └── 14 Mutation operations + │ └── 13 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} + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} 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 61ee1c5cf2e6..9b500630e53a 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 @@ -8,30 +8,28 @@ EXPLAIN (ddl) rollback at post-commit stage 5 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 6 elements transitioning toward PUBLIC + │ ├── 5 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 3} │ │ ├── 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} + │ │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ ├── 4 elements transitioning toward ABSENT │ │ ├── MERGE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ └── 14 Mutation operations + │ └── 13 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} + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} 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 2684398a42de..c115742ad0ac 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 @@ -8,30 +8,28 @@ EXPLAIN (ddl) rollback at post-commit stage 6 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 6 elements transitioning toward PUBLIC + │ ├── 5 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 3} │ │ ├── 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} + │ │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ ├── 4 elements transitioning toward ABSENT │ │ ├── MERGE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ └── 14 Mutation operations + │ └── 13 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} + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} 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 912bd1d83411..e5ed7f9485b6 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 @@ -8,31 +8,29 @@ EXPLAIN (ddl) rollback at post-commit stage 7 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 6 elements transitioning toward PUBLIC + │ ├── 5 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 3} │ │ ├── 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} + │ │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ ├── 4 elements transitioning toward ABSENT │ │ ├── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ └── 14 Mutation operations + │ └── 13 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} + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"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_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 3e12474df4e0..9912c5965fc1 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 @@ -9,15 +9,14 @@ EXPLAIN (ddl) rollback at post-commit stage 10 of 15; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); └── PostCommitNonRevertiblePhase ├── Stage 1 of 3 in PostCommitNonRevertiblePhase - │ ├── 8 elements transitioning toward PUBLIC + │ ├── 7 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 4} │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ ├── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ ├── 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} + │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ ├── 14 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} @@ -33,11 +32,13 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 5, SourceIndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 6} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6} - │ └── 21 Mutation operations + │ └── 19 Mutation operations │ ├── SetIndexName {"IndexID":1,"Name":"t_pkey","TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":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} │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":3,"TableID":104} │ ├── SetIndexName {"IndexID":3,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} @@ -48,10 +49,6 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":1,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":5,"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_11_of_15 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_11_of_15 index 1155e344603b..a5e07bf049f6 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 @@ -9,15 +9,14 @@ EXPLAIN (ddl) rollback at post-commit stage 11 of 15; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); └── PostCommitNonRevertiblePhase ├── Stage 1 of 3 in PostCommitNonRevertiblePhase - │ ├── 8 elements transitioning toward PUBLIC + │ ├── 7 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 4} │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ ├── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ ├── 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} + │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ ├── 14 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} @@ -33,11 +32,13 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 5, SourceIndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 6} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6} - │ └── 21 Mutation operations + │ └── 19 Mutation operations │ ├── SetIndexName {"IndexID":1,"Name":"t_pkey","TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":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} │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":3,"TableID":104} │ ├── SetIndexName {"IndexID":3,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} @@ -48,10 +49,6 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":1,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":5,"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_12_of_15 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_12_of_15 index a7604213ee8a..9245b4a49080 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 @@ -9,15 +9,14 @@ EXPLAIN (ddl) rollback at post-commit stage 12 of 15; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); └── PostCommitNonRevertiblePhase ├── Stage 1 of 3 in PostCommitNonRevertiblePhase - │ ├── 8 elements transitioning toward PUBLIC + │ ├── 7 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 4} │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ ├── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ ├── 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} + │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ ├── 14 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} @@ -33,11 +32,13 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 5, SourceIndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 6} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6} - │ └── 21 Mutation operations + │ └── 19 Mutation operations │ ├── SetIndexName {"IndexID":1,"Name":"t_pkey","TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":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} │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":3,"TableID":104} │ ├── SetIndexName {"IndexID":3,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} @@ -48,10 +49,6 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":1,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":5,"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_13_of_15 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_13_of_15 index 0f93eb43b4d1..6f3b70b86fe4 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 @@ -9,15 +9,14 @@ EXPLAIN (ddl) rollback at post-commit stage 13 of 15; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); └── PostCommitNonRevertiblePhase ├── Stage 1 of 3 in PostCommitNonRevertiblePhase - │ ├── 8 elements transitioning toward PUBLIC + │ ├── 7 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 4} │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ ├── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ ├── 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} + │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ ├── 14 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} @@ -35,23 +34,23 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6} │ └── 20 Mutation operations │ ├── SetIndexName {"IndexID":1,"Name":"t_pkey","TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":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} │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":3,"TableID":104} │ ├── SetIndexName {"IndexID":3,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── SetIndexName {"IndexID":5,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":6,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":1,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":5,"TableID":104} + │ ├── SetIndexName {"IndexID":5,"Name":"crdb_internal_in...","TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} ├── Stage 2 of 3 in PostCommitNonRevertiblePhase @@ -60,9 +59,8 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ ├── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} │ │ └── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 5, SourceIndexID: 3} - │ └── 7 Mutation operations + │ └── 6 Mutation operations │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":5,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":6,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} 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 9c5ff169a4b3..7c5711e1ad13 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 @@ -9,15 +9,14 @@ EXPLAIN (ddl) rollback at post-commit stage 14 of 15; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); └── PostCommitNonRevertiblePhase ├── Stage 1 of 3 in PostCommitNonRevertiblePhase - │ ├── 8 elements transitioning toward PUBLIC + │ ├── 7 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 4} │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ ├── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ ├── 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} + │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ ├── 14 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} @@ -35,23 +34,23 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6} │ └── 20 Mutation operations │ ├── SetIndexName {"IndexID":1,"Name":"t_pkey","TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":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} │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":3,"TableID":104} │ ├── SetIndexName {"IndexID":3,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── SetIndexName {"IndexID":5,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":6,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":1,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":5,"TableID":104} + │ ├── SetIndexName {"IndexID":5,"Name":"crdb_internal_in...","TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} ├── Stage 2 of 3 in PostCommitNonRevertiblePhase @@ -60,9 +59,8 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ ├── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} │ │ └── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 5, SourceIndexID: 3} - │ └── 7 Mutation operations + │ └── 6 Mutation operations │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":5,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":6,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} 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 167c06ae4499..cef12cbcc5a6 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 @@ -9,15 +9,14 @@ EXPLAIN (ddl) rollback at post-commit stage 15 of 15; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); └── PostCommitNonRevertiblePhase ├── Stage 1 of 3 in PostCommitNonRevertiblePhase - │ ├── 8 elements transitioning toward PUBLIC + │ ├── 7 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 4} │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ ├── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ ├── 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} + │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ ├── 14 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} @@ -35,12 +34,15 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6} │ └── 20 Mutation operations │ ├── SetIndexName {"IndexID":1,"Name":"t_pkey","TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":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} │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":3,"TableID":104} │ ├── SetIndexName {"IndexID":3,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":5,"TableID":104} │ ├── SetIndexName {"IndexID":5,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":6,"TableID":104} @@ -49,9 +51,6 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":1,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} ├── Stage 2 of 3 in PostCommitNonRevertiblePhase @@ -60,9 +59,8 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ ├── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} │ │ └── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 5, SourceIndexID: 3} - │ └── 7 Mutation operations + │ └── 6 Mutation operations │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":5,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":6,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} 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 fd464d262c92..b27afc20d5fd 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 @@ -9,13 +9,12 @@ EXPLAIN (ddl) rollback at post-commit stage 1 of 15; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); └── PostCommitNonRevertiblePhase └── Stage 1 of 1 in PostCommitNonRevertiblePhase - ├── 6 elements transitioning toward PUBLIC + ├── 5 elements transitioning toward PUBLIC │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 4} │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ ├── 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} + │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} ├── 7 elements transitioning toward ABSENT │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} @@ -24,18 +23,17 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} │ ├── BACKFILL_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ └── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - └── 15 Mutation operations + └── 14 Mutation operations + ├── RefreshStats {"TableID":104} + ├── LogEvent {"TargetStatus":2} + ├── MakeValidatedSecondaryIndexPublic {"IndexID":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} ├── MakeIndexAbsent {"IndexID":4,"TableID":104} ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} ├── RefreshStats {"TableID":104} ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} ├── RefreshStats {"TableID":104} - ├── RefreshStats {"TableID":104} - ├── LogEvent {"TargetStatus":2} - ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} ├── MakeIndexAbsent {"IndexID":3,"TableID":104} ├── CreateGCJobForIndex {"IndexID":3,"TableID":104} ├── RemoveJobStateFromDescriptor {"DescriptorID":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 bcc3985e1836..3ec8480cd952 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 @@ -9,13 +9,12 @@ EXPLAIN (ddl) rollback at post-commit stage 2 of 15; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 6 elements transitioning toward PUBLIC + │ ├── 5 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 4} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ ├── 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} + │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ ├── 6 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} @@ -23,18 +22,17 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} │ │ ├── BACKFILL_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ └── 14 Mutation operations + │ └── 13 Mutation operations + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":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} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"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_3_of_15 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_3_of_15 index 8bb59e79f1a1..12169e6da288 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 @@ -9,13 +9,12 @@ EXPLAIN (ddl) rollback at post-commit stage 3 of 15; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 6 elements transitioning toward PUBLIC + │ ├── 5 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 4} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ ├── 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} + │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ ├── 6 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} @@ -23,18 +22,17 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} │ │ ├── BACKFILL_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ └── 14 Mutation operations + │ └── 13 Mutation operations + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":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} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"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_4_of_15 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_4_of_15 index b42eebe52754..4b14070ecc20 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 @@ -9,13 +9,12 @@ EXPLAIN (ddl) rollback at post-commit stage 4 of 15; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 6 elements transitioning toward PUBLIC + │ ├── 5 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 4} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ ├── 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} + │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ ├── 6 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} @@ -23,19 +22,18 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} │ │ ├── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ └── 14 Mutation operations + │ └── 13 Mutation operations + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":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} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"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_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 d20d18596904..212fd475e2f0 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 @@ -9,13 +9,12 @@ EXPLAIN (ddl) rollback at post-commit stage 5 of 15; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 6 elements transitioning toward PUBLIC + │ ├── 5 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 4} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ ├── 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} + │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ ├── 6 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} @@ -23,18 +22,17 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} │ │ ├── MERGE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ └── 14 Mutation operations + │ └── 13 Mutation operations + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":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} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"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_6_of_15 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_6_of_15 index 0ea076dc449b..11c91449c755 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 @@ -9,13 +9,12 @@ EXPLAIN (ddl) rollback at post-commit stage 6 of 15; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 6 elements transitioning toward PUBLIC + │ ├── 5 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 4} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ ├── 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} + │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ ├── 6 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} @@ -23,18 +22,17 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} │ │ ├── MERGE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ └── 14 Mutation operations + │ └── 13 Mutation operations + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":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} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"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_7_of_15 b/pkg/sql/schemachanger/testdata/explain/drop_column_create_index_separate_statements.rollback_7_of_15 index 0ae511bd98be..8339fe3ba885 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 @@ -9,13 +9,12 @@ EXPLAIN (ddl) rollback at post-commit stage 7 of 15; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 6 elements transitioning toward PUBLIC + │ ├── 5 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 4} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ ├── 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} + │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ ├── 6 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} @@ -23,19 +22,18 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} │ │ ├── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ └── 14 Mutation operations + │ └── 13 Mutation operations + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":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} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"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_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 eaaf650b1f0b..69bab44b8b79 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 @@ -9,13 +9,12 @@ EXPLAIN (ddl) rollback at post-commit stage 8 of 15; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 6 elements transitioning toward PUBLIC + │ ├── 5 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 4} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ ├── 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} + │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ ├── 6 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} @@ -23,19 +22,18 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} │ │ ├── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ └── 14 Mutation operations + │ └── 13 Mutation operations + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":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} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"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_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 fdffa67b37ee..620487c24910 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 @@ -9,15 +9,14 @@ EXPLAIN (ddl) rollback at post-commit stage 9 of 15; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›); └── PostCommitNonRevertiblePhase ├── Stage 1 of 3 in PostCommitNonRevertiblePhase - │ ├── 8 elements transitioning toward PUBLIC + │ ├── 7 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 4} │ │ ├── VALIDATED → PUBLIC PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ ├── ABSENT → PUBLIC IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ ├── 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} + │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ ├── 14 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} @@ -33,11 +32,13 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 5, SourceIndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 6} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6} - │ └── 21 Mutation operations + │ └── 19 Mutation operations │ ├── SetIndexName {"IndexID":1,"Name":"t_pkey","TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":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} │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":3,"TableID":104} │ ├── SetIndexName {"IndexID":3,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} @@ -47,10 +48,6 @@ Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› D │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":1,"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} - │ ├── LogEvent {"TargetStatus":1} │ ├── MakeIndexAbsent {"IndexID":5,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":6,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":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 8cf9c7265378..8b3dee647060 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 @@ -16,19 +16,17 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── 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} - │ ├── 6 elements transitioning toward ABSENT + │ ├── 5 elements transitioning toward ABSENT │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104, ColumnID: 2} │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104, ColumnID: 4} │ │ ├── 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} - │ └── 14 Mutation operations + │ │ └── PUBLIC → VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ └── 13 Mutation operations │ ├── MakePublicColumnWriteOnly {"ColumnID":2,"TableID":104} │ ├── LogEvent {"TargetStatus":1} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":104} │ ├── MakePublicSecondaryIndexWriteOnly {"IndexID":2,"TableID":104} - │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeAbsentIndexBackfilling {"Index":{"ConstraintID":2,"IndexID":3,"IsUnique":true,"SourceIndexID":1,"TableID":104,"TemporaryIndexID":4}} │ ├── AddColumnToIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── AddColumnToIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} @@ -97,7 +95,7 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── 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} - │ ├── 11 elements transitioning toward ABSENT + │ ├── 12 elements transitioning toward ABSENT │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104, ColumnID: 4} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} @@ -108,15 +106,18 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} │ │ ├── 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} - │ └── 10 Mutation operations + │ │ ├── VALIDATED → DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ └── 12 Mutation operations │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":104} │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":4,"TableID":104} │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":1,"TableID":104} │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":104} │ ├── SetIndexName {"IndexID":3,"Name":"t_pkey","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":104} + │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} @@ -128,8 +129,7 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ └── 7 Mutation operations - │ ├── LogEvent {"TargetStatus":1} + │ └── 6 Mutation operations │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} │ ├── MakeDeleteOnlyColumnAbsent {"ColumnID":4,"TableID":104} 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 e5e60406d02f..864a87da5913 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,7 +141,7 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── WRITE_ONLY → TRANSIENT_DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 5, SourceIndexID: 3} │ │ ├── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 6} │ │ └── PUBLIC → TRANSIENT_ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6} - │ ├── 10 elements transitioning toward ABSENT + │ ├── 11 elements transitioning toward ABSENT │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104, ColumnID: 4} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} @@ -151,8 +151,9 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} │ │ ├── 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} - │ └── 11 Mutation operations + │ │ ├── VALIDATED → DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ └── 13 Mutation operations │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":104} │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":4,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} @@ -161,7 +162,9 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":5,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":6,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":1,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":104} + │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase @@ -179,10 +182,9 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── PUBLIC → ABSENT IndexData:{DescID: 104, IndexID: 1} │ ├── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ └── PUBLIC → ABSENT IndexData:{DescID: 104, IndexID: 2} - └── 13 Mutation operations + └── 12 Mutation operations ├── MakeIndexAbsent {"IndexID":1,"TableID":104} ├── CreateGCJobForIndex {"IndexID":1,"TableID":104} - ├── LogEvent {"TargetStatus":1} ├── MakeIndexAbsent {"IndexID":2,"TableID":104} ├── CreateGCJobForIndex {"IndexID":2,"TableID":104} ├── MakeIndexAbsent {"IndexID":4,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_column_with_index b/pkg/sql/schemachanger/testdata/explain/drop_column_with_index index 27deb7e0d52f..d567d9280b24 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_column_with_index +++ b/pkg/sql/schemachanger/testdata/explain/drop_column_with_index @@ -14,14 +14,12 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── 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} - │ ├── 4 elements transitioning toward ABSENT + │ ├── 3 elements transitioning toward ABSENT │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104, ColumnID: 2} │ │ ├── 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} - │ └── 9 Mutation operations + │ │ └── PUBLIC → VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ └── 8 Mutation operations │ ├── MakePublicSecondaryIndexWriteOnly {"IndexID":2,"TableID":104} - │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeAbsentIndexBackfilling {"Index":{"ConstraintID":2,"IndexID":3,"IsUnique":true,"SourceIndexID":1,"TableID":104,"TemporaryIndexID":4}} │ ├── AddColumnToIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── MakeAbsentTempIndexDeleteOnly {"Index":{"ConstraintID":3,"IndexID":4,"IsUnique":true,"SourceIndexID":1,"TableID":104}} @@ -87,7 +85,7 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── 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} - │ ├── 8 elements transitioning toward ABSENT + │ ├── 9 elements transitioning toward ABSENT │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104, ColumnID: 2} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 2, IndexID: 1} @@ -95,14 +93,17 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104, Name: t_pkey, IndexID: 1} │ │ ├── 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} - │ └── 9 Mutation operations + │ │ ├── VALIDATED → DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} + │ └── 11 Mutation operations │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":104} │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":1,"TableID":104} │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":104} │ ├── SetIndexName {"IndexID":3,"Name":"t_pkey","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":104} + │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} @@ -112,8 +113,7 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── 2 elements transitioning toward ABSENT │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ └── 6 Mutation operations - │ ├── LogEvent {"TargetStatus":1} + │ └── 5 Mutation operations │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":1,"TableID":104} 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 82779cb32fdd..983a5a1d8cdb 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 @@ -8,25 +8,23 @@ EXPLAIN (ddl) rollback at post-commit stage 1 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j›; └── PostCommitNonRevertiblePhase └── Stage 1 of 1 in PostCommitNonRevertiblePhase - ├── 4 elements transitioning toward PUBLIC + ├── 3 elements transitioning toward PUBLIC │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ ├── 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} + │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} ├── 5 elements transitioning toward ABSENT │ ├── BACKFILL_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ ├── PUBLIC → ABSENT IndexData:{DescID: 104, IndexID: 3} │ ├── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - └── 12 Mutation operations + └── 11 Mutation operations ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - ├── SetIndexName {"IndexID":2,"Name":"t_j_idx","TableID":104} - ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - ├── RefreshStats {"TableID":104} ├── RefreshStats {"TableID":104} ├── LogEvent {"TargetStatus":2} ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} + ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} + ├── RefreshStats {"TableID":104} ├── MakeIndexAbsent {"IndexID":3,"TableID":104} ├── CreateGCJobForIndex {"IndexID":3,"TableID":104} ├── MakeIndexAbsent {"IndexID":4,"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 baee739eb174..edcd1c5ee6d6 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 @@ -8,25 +8,23 @@ EXPLAIN (ddl) rollback at post-commit stage 2 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j›; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 4 elements transitioning toward PUBLIC + │ ├── 3 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── 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} + │ │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ ├── 4 elements transitioning toward ABSENT │ │ ├── BACKFILL_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ └── 11 Mutation operations + │ └── 10 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── SetIndexName {"IndexID":2,"Name":"t_j_idx","TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── LogEvent {"TargetStatus":2} │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} + │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} 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 00adb70fb9dd..d0a65cab81ce 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 @@ -8,25 +8,23 @@ EXPLAIN (ddl) rollback at post-commit stage 3 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j›; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 4 elements transitioning toward PUBLIC + │ ├── 3 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── 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} + │ │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ ├── 4 elements transitioning toward ABSENT │ │ ├── BACKFILL_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ └── 11 Mutation operations + │ └── 10 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── SetIndexName {"IndexID":2,"Name":"t_j_idx","TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── LogEvent {"TargetStatus":2} │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} + │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} 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 97cdccabf1af..9defef9b0747 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 @@ -8,25 +8,23 @@ EXPLAIN (ddl) rollback at post-commit stage 4 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j›; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 4 elements transitioning toward PUBLIC + │ ├── 3 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── 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} + │ │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ ├── 4 elements transitioning toward ABSENT │ │ ├── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ └── 11 Mutation operations + │ └── 10 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── SetIndexName {"IndexID":2,"Name":"t_j_idx","TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── LogEvent {"TargetStatus":2} │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} + │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} 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 1d645ce6472f..ee5d7b9b5229 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 @@ -8,25 +8,23 @@ EXPLAIN (ddl) rollback at post-commit stage 5 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j›; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 4 elements transitioning toward PUBLIC + │ ├── 3 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── 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} + │ │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ ├── 4 elements transitioning toward ABSENT │ │ ├── MERGE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ └── 11 Mutation operations + │ └── 10 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── SetIndexName {"IndexID":2,"Name":"t_j_idx","TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── LogEvent {"TargetStatus":2} │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} + │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} 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 2433a63ff533..0aafb43b5aa7 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 @@ -8,25 +8,23 @@ EXPLAIN (ddl) rollback at post-commit stage 6 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j›; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 4 elements transitioning toward PUBLIC + │ ├── 3 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── 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} + │ │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ ├── 4 elements transitioning toward ABSENT │ │ ├── MERGE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ └── 11 Mutation operations + │ └── 10 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── SetIndexName {"IndexID":2,"Name":"t_j_idx","TableID":104} - │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} - │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} - │ ├── RefreshStats {"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── LogEvent {"TargetStatus":2} │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} + │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} + │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} 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 513b88e7bd0c..e0c18797a8a4 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 @@ -8,26 +8,24 @@ EXPLAIN (ddl) rollback at post-commit stage 7 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j›; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 4 elements transitioning toward PUBLIC + │ ├── 3 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── 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} + │ │ └── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ ├── 4 elements transitioning toward ABSENT │ │ ├── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} - │ └── 11 Mutation operations + │ └── 10 Mutation operations │ ├── SetColumnName {"ColumnID":2,"Name":"j","TableID":104} - │ ├── SetIndexName {"IndexID":2,"Name":"t_j_idx","TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"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_index_hash_sharded_index b/pkg/sql/schemachanger/testdata/explain/drop_index_hash_sharded_index index b5173c19fc16..c5bfabb474e5 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_index_hash_sharded_index +++ b/pkg/sql/schemachanger/testdata/explain/drop_index_hash_sharded_index @@ -8,16 +8,14 @@ EXPLAIN (ddl) DROP INDEX idx CASCADE; Schema change plan for DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE; ├── StatementPhase │ └── Stage 1 of 1 in StatementPhase - │ ├── 6 elements transitioning toward ABSENT + │ ├── 5 elements transitioning toward ABSENT │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104, ColumnID: 3} │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104, Name: crdb_internal_j_shard_16, ColumnID: 3} │ │ ├── PUBLIC → VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104, Name: idx, IndexID: 2} │ │ ├── PUBLIC → VALIDATED CheckConstraint:{DescID: 104, IndexID: 0, ConstraintID: 2} │ │ └── PUBLIC → ABSENT ConstraintWithoutIndexName:{DescID: 104, Name: check_crdb_internal_j_shard_16, ConstraintID: 2} - │ └── 7 Mutation operations + │ └── 6 Mutation operations │ ├── MakePublicSecondaryIndexWriteOnly {"IndexID":2,"TableID":104} - │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── MakePublicCheckConstraintValidated {"ConstraintID":2,"TableID":104} │ ├── SetConstraintName {"ConstraintID":2,"Name":"crdb_internal_co...","TableID":104} │ ├── MakePublicColumnWriteOnly {"ColumnID":3,"TableID":104} @@ -34,14 +32,17 @@ Schema change plan for DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› │ └── CreateSchemaChangerJob {"NonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 3 elements transitioning toward ABSENT + │ ├── 4 elements transitioning toward ABSENT │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104, ColumnID: 3} │ │ ├── VALIDATED → DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104, Name: idx, IndexID: 2} │ │ └── VALIDATED → ABSENT CheckConstraint:{DescID: 104, IndexID: 0, ConstraintID: 2} - │ └── 5 Mutation operations + │ └── 7 Mutation operations │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":3,"TableID":104} │ ├── RemoveCheckConstraint {"ConstraintID":2,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":104} + │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase @@ -50,8 +51,7 @@ Schema change plan for DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 3} │ ├── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ └── PUBLIC → ABSENT IndexData:{DescID: 104, IndexID: 2} - └── 6 Mutation operations - ├── LogEvent {"TargetStatus":1} + └── 5 Mutation operations ├── MakeIndexAbsent {"IndexID":2,"TableID":104} ├── CreateGCJobForIndex {"IndexID":2,"TableID":104} ├── MakeDeleteOnlyColumnAbsent {"ColumnID":3,"TableID":104} 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 23925ac5bad9..d8fc8eb9c71e 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_index_partial_expression_index +++ b/pkg/sql/schemachanger/testdata/explain/drop_index_partial_expression_index @@ -8,14 +8,12 @@ EXPLAIN (ddl) DROP INDEX idx CASCADE; Schema change plan for DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE; ├── StatementPhase │ └── Stage 1 of 1 in StatementPhase - │ ├── 4 elements transitioning toward ABSENT + │ ├── 3 elements transitioning toward ABSENT │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104, ColumnID: 3} │ │ ├── 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: idx, IndexID: 2} - │ └── 5 Mutation operations + │ │ └── PUBLIC → VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ └── 4 Mutation operations │ ├── MakePublicSecondaryIndexWriteOnly {"IndexID":2,"TableID":104} - │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── MakePublicColumnWriteOnly {"ColumnID":3,"TableID":104} │ ├── LogEvent {"TargetStatus":1} │ └── SetColumnName {"ColumnID":3,"Name":"crdb_internal_co...","TableID":104} @@ -29,12 +27,15 @@ Schema change plan for DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› │ └── CreateSchemaChangerJob {"NonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 2 elements transitioning toward ABSENT + │ ├── 3 elements transitioning toward ABSENT │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104, ColumnID: 3} - │ │ └── VALIDATED → DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ └── 4 Mutation operations + │ │ ├── VALIDATED → DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104, Name: idx, IndexID: 2} + │ └── 6 Mutation operations │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":3,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":104} + │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase @@ -44,9 +45,8 @@ Schema change plan for DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› │ ├── PUBLIC → ABSENT SecondaryIndexPartial:{DescID: 104, IndexID: 2} │ ├── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ └── PUBLIC → ABSENT IndexData:{DescID: 104, IndexID: 2} - └── 7 Mutation operations + └── 6 Mutation operations ├── RemoveDroppedIndexPartialPredicate {"IndexID":2,"TableID":104} - ├── LogEvent {"TargetStatus":1} ├── MakeIndexAbsent {"IndexID":2,"TableID":104} ├── CreateGCJobForIndex {"IndexID":2,"TableID":104} ├── MakeDeleteOnlyColumnAbsent {"ColumnID":3,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_index_vanilla_index b/pkg/sql/schemachanger/testdata/explain/drop_index_vanilla_index index 77b46e011df5..d044be54ccd4 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_index_vanilla_index +++ b/pkg/sql/schemachanger/testdata/explain/drop_index_vanilla_index @@ -8,12 +8,10 @@ EXPLAIN (ddl) DROP INDEX idx CASCADE; Schema change plan for DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE; ├── StatementPhase │ └── Stage 1 of 1 in StatementPhase - │ ├── 2 elements transitioning toward ABSENT - │ │ ├── PUBLIC → VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104, Name: idx, IndexID: 2} - │ └── 2 Mutation operations - │ ├── MakePublicSecondaryIndexWriteOnly {"IndexID":2,"TableID":104} - │ └── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} + │ ├── 1 element transitioning toward ABSENT + │ │ └── PUBLIC → VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ └── 1 Mutation operation + │ └── MakePublicSecondaryIndexWriteOnly {"IndexID":2,"TableID":104} ├── PreCommitPhase │ └── Stage 1 of 1 in PreCommitPhase │ ├── 2 elements transitioning toward ABSENT @@ -24,18 +22,20 @@ Schema change plan for DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› │ └── CreateSchemaChangerJob {"NonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 1 element transitioning toward ABSENT - │ │ └── VALIDATED → DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ └── 3 Mutation operations + │ ├── 2 elements transitioning toward ABSENT + │ │ ├── VALIDATED → DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104, Name: idx, IndexID: 2} + │ └── 5 Mutation operations + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":104} + │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} └── Stage 2 of 2 in PostCommitNonRevertiblePhase ├── 2 elements transitioning toward ABSENT │ ├── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ └── PUBLIC → ABSENT IndexData:{DescID: 104, IndexID: 2} - └── 5 Mutation operations - ├── LogEvent {"TargetStatus":1} + └── 4 Mutation operations ├── MakeIndexAbsent {"IndexID":2,"TableID":104} ├── CreateGCJobForIndex {"IndexID":2,"TableID":104} ├── RemoveJobStateFromDescriptor {"DescriptorID":104} 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 4ee06d11e60c..6a81182c30b4 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 @@ -9,32 +9,30 @@ EXPLAIN (ddl) rollback at post-commit stage 1 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹k› CASCADE; └── PostCommitNonRevertiblePhase └── Stage 1 of 1 in PostCommitNonRevertiblePhase - ├── 8 elements transitioning toward PUBLIC + ├── 7 elements transitioning toward PUBLIC │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 3} │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: k, ColumnID: 3} │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 4} │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ ├── 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} + │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} ├── 5 elements transitioning toward ABSENT │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ ├── PUBLIC → ABSENT IndexData:{DescID: 104, IndexID: 3} │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} │ ├── BACKFILL_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ └── DELETE_ONLY → ABSENT TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - └── 18 Mutation operations + └── 17 Mutation operations ├── SetColumnName {"ColumnID":3,"Name":"k","TableID":104} + ├── RefreshStats {"TableID":104} + ├── LogEvent {"TargetStatus":2} + ├── MakeValidatedSecondaryIndexPublic {"IndexID":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} ├── MakeIndexAbsent {"IndexID":4,"TableID":104} ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} ├── RefreshStats {"TableID":104} - ├── RefreshStats {"TableID":104} - ├── LogEvent {"TargetStatus":2} - ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} ├── MakeIndexAbsent {"IndexID":3,"TableID":104} ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} ├── RefreshStats {"TableID":104} 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 1f34f6a3364a..539eb1dfde01 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 @@ -9,31 +9,29 @@ EXPLAIN (ddl) rollback at post-commit stage 2 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹k› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 8 elements transitioning toward PUBLIC + │ ├── 7 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 3} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: k, ColumnID: 3} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 4} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ ├── 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} + │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ ├── 4 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} │ │ ├── BACKFILL_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ └── 17 Mutation operations + │ └── 16 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"k","TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":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} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} 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 b4043637a981..f6fbf96ec20b 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 @@ -9,31 +9,29 @@ EXPLAIN (ddl) rollback at post-commit stage 3 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹k› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 8 elements transitioning toward PUBLIC + │ ├── 7 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 3} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: k, ColumnID: 3} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 4} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ ├── 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} + │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ ├── 4 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} │ │ ├── BACKFILL_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ └── 17 Mutation operations + │ └── 16 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"k","TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":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} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} 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 1870076a1a63..83f3722ac003 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 @@ -9,32 +9,30 @@ EXPLAIN (ddl) rollback at post-commit stage 4 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹k› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 8 elements transitioning toward PUBLIC + │ ├── 7 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 3} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: k, ColumnID: 3} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 4} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ ├── 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} + │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ ├── 4 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} │ │ ├── DELETE_ONLY → ABSENT PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ └── 17 Mutation operations + │ └── 16 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"k","TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":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} │ ├── MakeIndexAbsent {"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} 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 f16ee46fa27c..e408280f4d9c 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 @@ -9,31 +9,29 @@ EXPLAIN (ddl) rollback at post-commit stage 5 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹k› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 8 elements transitioning toward PUBLIC + │ ├── 7 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 3} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: k, ColumnID: 3} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 4} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ ├── 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} + │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ ├── 4 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} │ │ ├── MERGE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ └── 17 Mutation operations + │ └── 16 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"k","TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":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} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} 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 a376c613ea6e..d4e9603200c4 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 @@ -9,31 +9,29 @@ EXPLAIN (ddl) rollback at post-commit stage 6 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹k› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 8 elements transitioning toward PUBLIC + │ ├── 7 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 3} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: k, ColumnID: 3} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 4} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ ├── 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} + │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ ├── 4 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} │ │ ├── MERGE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ └── 17 Mutation operations + │ └── 16 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"k","TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":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} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} 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 93a34ffdcd6c..a523cfc13c89 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 @@ -9,32 +9,30 @@ EXPLAIN (ddl) rollback at post-commit stage 7 of 7; Schema change plan for rolling back ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE; ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹k› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase - │ ├── 8 elements transitioning toward PUBLIC + │ ├── 7 elements transitioning toward PUBLIC │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 3} │ │ ├── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: k, ColumnID: 3} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → PUBLIC Column:{DescID: 104, ColumnID: 4} │ │ ├── VALIDATED → PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ ├── 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} + │ │ └── ABSENT → PUBLIC ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ ├── 4 elements transitioning toward ABSENT │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 3} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 4} │ │ ├── WRITE_ONLY → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 3, ConstraintID: 2, TemporaryIndexID: 4, SourceIndexID: 1} │ │ └── WRITE_ONLY → DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} - │ └── 17 Mutation operations + │ └── 16 Mutation operations │ ├── SetColumnName {"ColumnID":3,"Name":"k","TableID":104} + │ ├── RefreshStats {"TableID":104} + │ ├── LogEvent {"TargetStatus":2} + │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":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} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":3,"TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":2,"TableID":104} │ ├── RefreshStats {"TableID":104} - │ ├── RefreshStats {"TableID":104} - │ ├── LogEvent {"TargetStatus":2} - │ ├── MakeValidatedSecondaryIndexPublic {"IndexID":2,"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":3,"TableID":104} │ ├── RefreshStats {"TableID":104} │ ├── MakeWriteOnlyColumnPublic {"ColumnID":4,"TableID":104} 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 8cf9c7265378..8b3dee647060 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 @@ -16,19 +16,17 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── 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} - │ ├── 6 elements transitioning toward ABSENT + │ ├── 5 elements transitioning toward ABSENT │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104, ColumnID: 2} │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 104, ColumnID: 4} │ │ ├── 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} - │ └── 14 Mutation operations + │ │ └── PUBLIC → VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ └── 13 Mutation operations │ ├── MakePublicColumnWriteOnly {"ColumnID":2,"TableID":104} │ ├── LogEvent {"TargetStatus":1} │ ├── SetColumnName {"ColumnID":2,"Name":"crdb_internal_co...","TableID":104} │ ├── MakePublicSecondaryIndexWriteOnly {"IndexID":2,"TableID":104} - │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeAbsentIndexBackfilling {"Index":{"ConstraintID":2,"IndexID":3,"IsUnique":true,"SourceIndexID":1,"TableID":104,"TemporaryIndexID":4}} │ ├── AddColumnToIndex {"ColumnID":1,"IndexID":3,"TableID":104} │ ├── AddColumnToIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} @@ -97,7 +95,7 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── 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} - │ ├── 11 elements transitioning toward ABSENT + │ ├── 12 elements transitioning toward ABSENT │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104, ColumnID: 4} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 1} @@ -108,15 +106,18 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 4, IndexID: 2} │ │ ├── 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} - │ └── 10 Mutation operations + │ │ ├── VALIDATED → DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ └── PUBLIC → ABSENT IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ └── 12 Mutation operations │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":104} │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":4,"TableID":104} │ ├── MakePublicPrimaryIndexWriteOnly {"IndexID":1,"TableID":104} │ ├── SetIndexName {"IndexID":1,"Name":"crdb_internal_in...","TableID":104} │ ├── SetIndexName {"IndexID":3,"Name":"t_pkey","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":104} + │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} @@ -128,8 +129,7 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ └── 7 Mutation operations - │ ├── LogEvent {"TargetStatus":1} + │ └── 6 Mutation operations │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} │ ├── MakeDeleteOnlyColumnAbsent {"ColumnID":4,"TableID":104} 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 8c22e1bde20e..854ca0738205 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 @@ -73,7 +73,7 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── 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} - │ ├── 14 elements transitioning toward ABSENT + │ ├── 15 elements transitioning toward ABSENT │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104, ColumnID: 3} │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104, ColumnID: 2} │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 104, ColumnID: 4} @@ -86,9 +86,10 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── 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} + │ │ ├── PUBLIC → ABSENT IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} │ │ └── PUBLIC → ABSENT IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 4} - │ └── 12 Mutation operations + │ └── 14 Mutation operations │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":3,"TableID":104} │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":2,"TableID":104} │ ├── MakeWriteOnlyColumnDeleteOnly {"ColumnID":4,"TableID":104} @@ -97,7 +98,9 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ ├── RemoveColumnFromIndex {"ColumnID":3,"IndexID":3,"Kind":2,"TableID":104} │ ├── SetIndexName {"IndexID":3,"Name":"t_pkey","TableID":104} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":4,"TableID":104} + │ ├── LogEvent {"TargetStatus":1} │ ├── MakeWriteOnlyIndexDeleteOnly {"IndexID":2,"TableID":104} + │ ├── SetIndexName {"IndexID":2,"Name":"crdb_internal_in...","TableID":104} │ ├── MakeValidatedPrimaryIndexPublic {"IndexID":3,"TableID":104} │ ├── SetJobStateOnDescriptor {"DescriptorID":104} │ └── UpdateSchemaChangerJob {"IsNonCancelable":true,"RunningStatus":"PostCommitNonRev..."} @@ -109,8 +112,7 @@ Schema change plan for ALTER TABLE ‹defaultdb›.‹public›.‹t› DROP COL │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 104, ColumnFamilyID: 0, ColumnID: 4} │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 104, IndexID: 1, ConstraintID: 1} │ │ └── DELETE_ONLY → ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ └── 7 Mutation operations - │ ├── LogEvent {"TargetStatus":1} + │ └── 6 Mutation operations │ ├── MakeIndexAbsent {"IndexID":2,"TableID":104} │ ├── MakeIndexAbsent {"IndexID":4,"TableID":104} │ ├── MakeDeleteOnlyColumnAbsent {"ColumnID":4,"TableID":104} diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_10_of_15 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_10_of_15 index 6d17c8220dc7..d6018a680e94 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_10_of_15 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_10_of_15 @@ -132,7 +132,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 10 of 15; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexName:{DescID: 106, Name: tbl_j_key, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} │ │ │ │ PUBLIC → ABSENT @@ -155,7 +158,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 10 of 15; │ │ └── • PreviousTransactionPrecedence dependency from WRITE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 5, SourceIndexID: 2} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: WRITE_ONLY->DELETE_ONLY" │ │ - │ └── • 13 Mutation operations + │ └── • 12 Mutation operations │ │ │ ├── • SetIndexName │ │ IndexID: 1 @@ -206,26 +209,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 10 of 15; │ │ IndexID: 1 │ │ TableID: 106 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ constraintId: 4 - │ │ indexId: 4 - │ │ isUnique: true - │ │ sourceIndexId: 2 - │ │ tableId: 106 - │ │ temporaryIndexId: 5 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹db›.public.‹tbl› ADD COLUMN ‹j› INT8 UNIQUE DEFAULT CAST(date_part(‹'year'›, - │ │ now()) AS INT8) - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 4 │ │ TableID: 106 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_11_of_15 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_11_of_15 index d7ba6ef197d5..9835db655408 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_11_of_15 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_11_of_15 @@ -132,7 +132,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 11 of 15; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexName:{DescID: 106, Name: tbl_j_key, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} │ │ │ │ PUBLIC → ABSENT @@ -155,7 +158,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 11 of 15; │ │ └── • PreviousTransactionPrecedence dependency from WRITE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 5, SourceIndexID: 2} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: WRITE_ONLY->DELETE_ONLY" │ │ - │ └── • 13 Mutation operations + │ └── • 12 Mutation operations │ │ │ ├── • SetIndexName │ │ IndexID: 1 @@ -206,26 +209,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 11 of 15; │ │ IndexID: 1 │ │ TableID: 106 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ constraintId: 4 - │ │ indexId: 4 - │ │ isUnique: true - │ │ sourceIndexId: 2 - │ │ tableId: 106 - │ │ temporaryIndexId: 5 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹db›.public.‹tbl› ADD COLUMN ‹j› INT8 UNIQUE DEFAULT CAST(date_part(‹'year'›, - │ │ now()) AS INT8) - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 4 │ │ TableID: 106 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_12_of_15 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_12_of_15 index 32c5e4c502b2..c58ad37eec55 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_12_of_15 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_12_of_15 @@ -132,7 +132,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 12 of 15; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexName:{DescID: 106, Name: tbl_j_key, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} │ │ │ │ PUBLIC → ABSENT @@ -155,7 +158,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 12 of 15; │ │ └── • PreviousTransactionPrecedence dependency from WRITE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 5, SourceIndexID: 2} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: WRITE_ONLY->DELETE_ONLY" │ │ - │ └── • 13 Mutation operations + │ └── • 12 Mutation operations │ │ │ ├── • SetIndexName │ │ IndexID: 1 @@ -206,26 +209,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 12 of 15; │ │ IndexID: 1 │ │ TableID: 106 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ constraintId: 4 - │ │ indexId: 4 - │ │ isUnique: true - │ │ sourceIndexId: 2 - │ │ tableId: 106 - │ │ temporaryIndexId: 5 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹db›.public.‹tbl› ADD COLUMN ‹j› INT8 UNIQUE DEFAULT CAST(date_part(‹'year'›, - │ │ now()) AS INT8) - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 4 │ │ TableID: 106 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_13_of_15 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_13_of_15 index 7efb451ebfd5..85d49e28a785 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_13_of_15 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_13_of_15 @@ -123,7 +123,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: MERGE_ONLY->WRITE_ONLY" │ │ │ │ │ ├── • IndexName:{DescID: 106, Name: tbl_j_key, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} │ │ │ │ PUBLIC → ABSENT @@ -146,7 +149,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ │ └── • PreviousTransactionPrecedence dependency from WRITE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 5, SourceIndexID: 2} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: WRITE_ONLY->DELETE_ONLY" │ │ - │ └── • 12 Mutation operations + │ └── • 13 Mutation operations │ │ │ ├── • SetIndexName │ │ IndexID: 1 @@ -175,11 +178,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • SetIndexName - │ │ IndexID: 4 - │ │ Name: crdb_internal_index_4_name_placeholder - │ │ TableID: 106 - │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 5 │ │ TableID: 106 @@ -197,17 +195,42 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ │ IndexID: 1 │ │ TableID: 106 │ │ + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ constraintId: 4 + │ │ indexId: 4 + │ │ isUnique: true + │ │ sourceIndexId: 2 + │ │ tableId: 106 + │ │ temporaryIndexId: 5 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹db›.public.‹tbl› ADD COLUMN ‹j› INT8 UNIQUE DEFAULT CAST(date_part(‹'year'›, + │ │ now()) AS INT8) + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TargetStatus: 1 + │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 106 │ │ + │ ├── • SetIndexName + │ │ IndexID: 4 + │ │ Name: crdb_internal_index_4_name_placeholder + │ │ TableID: 106 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 106 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 5 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 4 MutationType ops pending │ ├── • Stage 2 of 3 in PostCommitNonRevertiblePhase │ │ @@ -258,32 +281,12 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ │ └── • PreviousTransactionPrecedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 5, SourceIndexID: 2} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: DELETE_ONLY->ABSENT" │ │ - │ └── • 7 Mutation operations + │ └── • 6 Mutation operations │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ constraintId: 4 - │ │ indexId: 4 - │ │ isUnique: true - │ │ sourceIndexId: 2 - │ │ tableId: 106 - │ │ temporaryIndexId: 5 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹db›.public.‹tbl› ADD COLUMN ‹j› INT8 UNIQUE DEFAULT CAST(date_part(‹'year'›, - │ │ now()) AS INT8) - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 4 │ │ TableID: 106 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_14_of_15 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_14_of_15 index b18d72b34c23..baa905ff2543 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_14_of_15 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_14_of_15 @@ -123,7 +123,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: MERGE_ONLY->WRITE_ONLY" │ │ │ │ │ ├── • IndexName:{DescID: 106, Name: tbl_j_key, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} │ │ │ │ PUBLIC → ABSENT @@ -146,7 +149,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ │ └── • PreviousTransactionPrecedence dependency from WRITE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 5, SourceIndexID: 2} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: WRITE_ONLY->DELETE_ONLY" │ │ - │ └── • 12 Mutation operations + │ └── • 13 Mutation operations │ │ │ ├── • SetIndexName │ │ IndexID: 1 @@ -175,11 +178,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • SetIndexName - │ │ IndexID: 4 - │ │ Name: crdb_internal_index_4_name_placeholder - │ │ TableID: 106 - │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 5 │ │ TableID: 106 @@ -197,17 +195,42 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ │ IndexID: 1 │ │ TableID: 106 │ │ + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ constraintId: 4 + │ │ indexId: 4 + │ │ isUnique: true + │ │ sourceIndexId: 2 + │ │ tableId: 106 + │ │ temporaryIndexId: 5 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹db›.public.‹tbl› ADD COLUMN ‹j› INT8 UNIQUE DEFAULT CAST(date_part(‹'year'›, + │ │ now()) AS INT8) + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TargetStatus: 1 + │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 106 │ │ + │ ├── • SetIndexName + │ │ IndexID: 4 + │ │ Name: crdb_internal_index_4_name_placeholder + │ │ TableID: 106 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 106 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 5 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 4 MutationType ops pending │ ├── • Stage 2 of 3 in PostCommitNonRevertiblePhase │ │ @@ -258,32 +281,12 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ │ └── • PreviousTransactionPrecedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 5, SourceIndexID: 2} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: DELETE_ONLY->ABSENT" │ │ - │ └── • 7 Mutation operations + │ └── • 6 Mutation operations │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ constraintId: 4 - │ │ indexId: 4 - │ │ isUnique: true - │ │ sourceIndexId: 2 - │ │ tableId: 106 - │ │ temporaryIndexId: 5 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹db›.public.‹tbl› ADD COLUMN ‹j› INT8 UNIQUE DEFAULT CAST(date_part(‹'year'›, - │ │ now()) AS INT8) - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 4 │ │ TableID: 106 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_15_of_15 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_15_of_15 index 9119a132120f..60ac47811791 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_15_of_15 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_15_of_15 @@ -123,7 +123,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 15 of 15; │ │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: WRITE_ONLY->DELETE_ONLY" │ │ │ │ │ ├── • IndexName:{DescID: 106, Name: tbl_j_key, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} │ │ │ │ PUBLIC → ABSENT @@ -146,7 +149,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 15 of 15; │ │ └── • PreviousTransactionPrecedence dependency from WRITE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 5, SourceIndexID: 2} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: WRITE_ONLY->DELETE_ONLY" │ │ - │ └── • 12 Mutation operations + │ └── • 13 Mutation operations │ │ │ ├── • SetIndexName │ │ IndexID: 1 @@ -175,6 +178,26 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 15 of 15; │ │ IndexID: 3 │ │ TableID: 106 │ │ + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ constraintId: 4 + │ │ indexId: 4 + │ │ isUnique: true + │ │ sourceIndexId: 2 + │ │ tableId: 106 + │ │ temporaryIndexId: 5 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹db›.public.‹tbl› ADD COLUMN ‹j› INT8 UNIQUE DEFAULT CAST(date_part(‹'year'›, + │ │ now()) AS INT8) + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TargetStatus: 1 + │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 106 @@ -207,7 +230,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 15 of 15; │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 5 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 4 MutationType ops pending │ ├── • Stage 2 of 3 in PostCommitNonRevertiblePhase │ │ @@ -258,32 +281,12 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 15 of 15; │ │ └── • PreviousTransactionPrecedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 5, SourceIndexID: 2} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: DELETE_ONLY->ABSENT" │ │ - │ └── • 7 Mutation operations + │ └── • 6 Mutation operations │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ constraintId: 4 - │ │ indexId: 4 - │ │ isUnique: true - │ │ sourceIndexId: 2 - │ │ tableId: 106 - │ │ temporaryIndexId: 5 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹db›.public.‹tbl› ADD COLUMN ‹j› INT8 UNIQUE DEFAULT CAST(date_part(‹'year'›, - │ │ now()) AS INT8) - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 4 │ │ TableID: 106 diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_9_of_15 b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_9_of_15 index b574bca225ab..e34259e7338a 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_9_of_15 +++ b/pkg/sql/schemachanger/testdata/explain_verbose/add_column_default_unique.rollback_9_of_15 @@ -132,7 +132,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 9 of 15; │ │ │ rule: "dependents removed before index" │ │ │ │ │ ├── • IndexName:{DescID: 106, Name: tbl_j_key, IndexID: 4} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 2} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • IndexColumn:{DescID: 106, ColumnID: 2, IndexID: 5} │ │ │ │ PUBLIC → ABSENT @@ -161,7 +164,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 9 of 15; │ │ └── • PreviousTransactionPrecedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 106, IndexID: 5, ConstraintID: 5, SourceIndexID: 2} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: DELETE_ONLY->ABSENT" │ │ - │ └── • 13 Mutation operations + │ └── • 12 Mutation operations │ │ │ ├── • SetIndexName │ │ IndexID: 1 @@ -212,26 +215,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 9 of 15; │ │ IndexID: 1 │ │ TableID: 106 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ constraintId: 4 - │ │ indexId: 4 - │ │ isUnique: true - │ │ sourceIndexId: 2 - │ │ tableId: 106 - │ │ temporaryIndexId: 5 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹db›.public.‹tbl› ADD COLUMN ‹j› INT8 UNIQUE DEFAULT CAST(date_part(‹'year'›, - │ │ now()) AS INT8) - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 4 │ │ TableID: 106 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 a87ff41190a5..61dd1d095d75 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 @@ -131,9 +131,12 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ │ rule: "skip index-column removal ops on index removal" │ │ │ └── • IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} - │ PUBLIC → ABSENT + │ │ PUBLIC → ABSENT + │ │ + │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} + │ rule: "index no longer public before index name" │ - └── • 10 Mutation operations + └── • 9 Mutation operations │ ├── • SetIndexName │ IndexID: 4 @@ -163,25 +166,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ IndexID: 3 │ TableID: 104 │ - ├── • LogEvent - │ Element: - │ SecondaryIndex: - │ constraintId: 4 - │ indexId: 4 - │ isUnique: true - │ sourceIndexId: 1 - │ tableId: 104 - │ temporaryIndexId: 5 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› ALTER PRIMARY KEY USING COLUMNS (‹j›) - │ StatementTag: ALTER TABLE - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TargetStatus: 1 - │ ├── • MakeIndexAbsent │ IndexID: 4 │ TableID: 104 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 b226eca184c2..dda6fd330db0 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 @@ -104,9 +104,12 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} + │ │ rule: "index no longer public before index name" │ │ - │ └── • 8 Mutation operations + │ └── • 7 Mutation operations │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 3 @@ -133,25 +136,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ IndexID: 2 │ │ TableID: 104 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ constraintId: 4 - │ │ indexId: 4 - │ │ isUnique: true - │ │ sourceIndexId: 1 - │ │ tableId: 104 - │ │ temporaryIndexId: 5 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› ALTER PRIMARY KEY USING COLUMNS (‹j›) - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 4 │ │ TableID: 104 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 355ce4e02844..c4fa5015147b 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 @@ -104,9 +104,12 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} + │ │ rule: "index no longer public before index name" │ │ - │ └── • 8 Mutation operations + │ └── • 7 Mutation operations │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 3 @@ -133,25 +136,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ IndexID: 2 │ │ TableID: 104 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ constraintId: 4 - │ │ indexId: 4 - │ │ isUnique: true - │ │ sourceIndexId: 1 - │ │ tableId: 104 - │ │ temporaryIndexId: 5 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› ALTER PRIMARY KEY USING COLUMNS (‹j›) - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 4 │ │ TableID: 104 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 ccc45cc8f1cf..ddbea539e9ce 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 @@ -104,9 +104,12 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} + │ │ rule: "index no longer public before index name" │ │ - │ └── • 8 Mutation operations + │ └── • 7 Mutation operations │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 3 @@ -133,25 +136,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ IndexID: 2 │ │ TableID: 104 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ constraintId: 4 - │ │ indexId: 4 - │ │ isUnique: true - │ │ sourceIndexId: 1 - │ │ tableId: 104 - │ │ temporaryIndexId: 5 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› ALTER PRIMARY KEY USING COLUMNS (‹j›) - │ │ StatementTag: ALTER TABLE - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 4 │ │ TableID: 104 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 ad7de5662ffd..39ef3f4849ed 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 @@ -86,9 +86,12 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} + │ │ rule: "index no longer public before index name" │ │ - │ └── • 7 Mutation operations + │ └── • 8 Mutation operations │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 3 @@ -98,26 +101,45 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ IndexID: 5 │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 4 - │ │ Name: crdb_internal_index_4_name_placeholder - │ │ TableID: 104 - │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 │ │ + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ constraintId: 4 + │ │ indexId: 4 + │ │ isUnique: true + │ │ sourceIndexId: 1 + │ │ tableId: 104 + │ │ temporaryIndexId: 5 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› ALTER PRIMARY KEY USING COLUMNS (‹j›) + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TargetStatus: 1 + │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 104 │ │ + │ ├── • SetIndexName + │ │ IndexID: 4 + │ │ Name: crdb_internal_index_4_name_placeholder + │ │ TableID: 104 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 9 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 8 MutationType ops pending │ └── • Stage 2 of 2 in PostCommitNonRevertiblePhase │ @@ -219,7 +241,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ └── • Precedence dependency from ABSENT TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1} │ rule: "index removed before garbage collection" │ - └── • 11 Mutation operations + └── • 10 Mutation operations │ ├── • MakeIndexAbsent │ EventBase: @@ -251,25 +273,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ Statement: ALTER TABLE defaultdb.public.t ALTER PRIMARY KEY USING COLUMNS (j) │ TableID: 104 │ - ├── • LogEvent - │ Element: - │ SecondaryIndex: - │ constraintId: 4 - │ indexId: 4 - │ isUnique: true - │ sourceIndexId: 1 - │ tableId: 104 - │ temporaryIndexId: 5 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› ALTER PRIMARY KEY USING COLUMNS (‹j›) - │ StatementTag: ALTER TABLE - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TargetStatus: 1 - │ ├── • MakeIndexAbsent │ IndexID: 4 │ TableID: 104 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 5340ede5caa0..4726e0c82bae 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 @@ -86,9 +86,12 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} + │ │ rule: "index no longer public before index name" │ │ - │ └── • 7 Mutation operations + │ └── • 8 Mutation operations │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 3 @@ -98,26 +101,45 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ IndexID: 5 │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 4 - │ │ Name: crdb_internal_index_4_name_placeholder - │ │ TableID: 104 - │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 │ │ + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ constraintId: 4 + │ │ indexId: 4 + │ │ isUnique: true + │ │ sourceIndexId: 1 + │ │ tableId: 104 + │ │ temporaryIndexId: 5 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› ALTER PRIMARY KEY USING COLUMNS (‹j›) + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TargetStatus: 1 + │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 104 │ │ + │ ├── • SetIndexName + │ │ IndexID: 4 + │ │ Name: crdb_internal_index_4_name_placeholder + │ │ TableID: 104 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 9 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 8 MutationType ops pending │ └── • Stage 2 of 2 in PostCommitNonRevertiblePhase │ @@ -219,7 +241,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ └── • Precedence dependency from ABSENT TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1} │ rule: "index removed before garbage collection" │ - └── • 11 Mutation operations + └── • 10 Mutation operations │ ├── • MakeIndexAbsent │ EventBase: @@ -251,25 +273,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ Statement: ALTER TABLE defaultdb.public.t ALTER PRIMARY KEY USING COLUMNS (j) │ TableID: 104 │ - ├── • LogEvent - │ Element: - │ SecondaryIndex: - │ constraintId: 4 - │ indexId: 4 - │ isUnique: true - │ sourceIndexId: 1 - │ tableId: 104 - │ temporaryIndexId: 5 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› ALTER PRIMARY KEY USING COLUMNS (‹j›) - │ StatementTag: ALTER TABLE - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TargetStatus: 1 - │ ├── • MakeIndexAbsent │ IndexID: 4 │ TableID: 104 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 4de1f991fbba..fca319b81dc1 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 @@ -86,9 +86,12 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ └── • IndexName:{DescID: 104, Name: t_i_key, IndexID: 4} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 4, TemporaryIndexID: 5, SourceIndexID: 1} + │ │ rule: "index no longer public before index name" │ │ - │ └── • 7 Mutation operations + │ └── • 8 Mutation operations │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 2 @@ -98,6 +101,25 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ IndexID: 3 │ │ TableID: 104 │ │ + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ constraintId: 4 + │ │ indexId: 4 + │ │ isUnique: true + │ │ sourceIndexId: 1 + │ │ tableId: 104 + │ │ temporaryIndexId: 5 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› ALTER PRIMARY KEY USING COLUMNS (‹j›) + │ │ StatementTag: ALTER TABLE + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TargetStatus: 1 + │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 104 @@ -117,7 +139,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 9 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 8 MutationType ops pending │ └── • Stage 2 of 2 in PostCommitNonRevertiblePhase │ @@ -219,7 +241,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ └── • Precedence dependency from ABSENT TemporaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 5, SourceIndexID: 1} │ rule: "index removed before garbage collection" │ - └── • 11 Mutation operations + └── • 10 Mutation operations │ ├── • MakeIndexAbsent │ EventBase: @@ -251,25 +273,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ Statement: ALTER TABLE defaultdb.public.t ALTER PRIMARY KEY USING COLUMNS (j) │ TableID: 104 │ - ├── • LogEvent - │ Element: - │ SecondaryIndex: - │ constraintId: 4 - │ indexId: 4 - │ isUnique: true - │ sourceIndexId: 1 - │ tableId: 104 - │ temporaryIndexId: 5 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› ALTER PRIMARY KEY USING COLUMNS (‹j›) - │ StatementTag: ALTER TABLE - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TargetStatus: 1 - │ ├── • MakeIndexAbsent │ IndexID: 4 │ TableID: 104 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 28084f94355f..e080f6a66099 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 @@ -55,7 +55,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ │ rule: "index removed before garbage collection" │ │ │ ├── • IndexName:{DescID: 106, Name: idx1, IndexID: 2} - │ │ PUBLIC → ABSENT + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ rule: "index no longer public before index name" │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ │ │ DELETE_ONLY → ABSENT @@ -87,7 +90,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ └── • skip PUBLIC → ABSENT operations │ rule: "skip index-column removal ops on index removal" │ - └── • 9 Mutation operations + └── • 8 Mutation operations │ ├── • RemoveDroppedIndexPartialPredicate │ IndexID: 2 @@ -102,23 +105,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ IndexID: 3 │ TableID: 106 │ - ├── • LogEvent - │ Element: - │ SecondaryIndex: - │ indexId: 2 - │ sourceIndexId: 1 - │ tableId: 106 - │ temporaryIndexId: 3 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: CREATE INDEX ‹idx1› ON ‹defaultdb›.public.‹t› (‹v›) WHERE (‹v› = ‹'a'›) - │ StatementTag: CREATE INDEX - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TargetStatus: 1 - │ ├── • MakeIndexAbsent │ IndexID: 2 │ TableID: 106 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 9c31b7b0e904..b2f7c261e7bf 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 @@ -49,7 +49,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexName:{DescID: 106, Name: idx1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -72,7 +75,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 8 Mutation operations + │ └── • 7 Mutation operations │ │ │ ├── • RemoveDroppedIndexPartialPredicate │ │ IndexID: 2 @@ -91,23 +94,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ indexId: 2 - │ │ sourceIndexId: 1 - │ │ tableId: 106 - │ │ temporaryIndexId: 3 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: CREATE INDEX ‹idx1› ON ‹defaultdb›.public.‹t› (‹v›) WHERE (‹v› = ‹'a'›) - │ │ StatementTag: CREATE INDEX - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 2 │ │ TableID: 106 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 06de7eaf81cd..e14b53c2351d 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 @@ -49,7 +49,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexName:{DescID: 106, Name: idx1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -72,7 +75,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 8 Mutation operations + │ └── • 7 Mutation operations │ │ │ ├── • RemoveDroppedIndexPartialPredicate │ │ IndexID: 2 @@ -91,23 +94,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ indexId: 2 - │ │ sourceIndexId: 1 - │ │ tableId: 106 - │ │ temporaryIndexId: 3 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: CREATE INDEX ‹idx1› ON ‹defaultdb›.public.‹t› (‹v›) WHERE (‹v› = ‹'a'›) - │ │ StatementTag: CREATE INDEX - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 2 │ │ TableID: 106 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 de6ccc4203ea..da47a336a7c7 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 @@ -49,7 +49,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexName:{DescID: 106, Name: idx1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -72,7 +75,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 8 Mutation operations + │ └── • 7 Mutation operations │ │ │ ├── • RemoveDroppedIndexPartialPredicate │ │ IndexID: 2 @@ -91,23 +94,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ IndexID: 3 │ │ TableID: 106 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ indexId: 2 - │ │ sourceIndexId: 1 - │ │ tableId: 106 - │ │ temporaryIndexId: 3 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: CREATE INDEX ‹idx1› ON ‹defaultdb›.public.‹t› (‹v›) WHERE (‹v› = ‹'a'›) - │ │ StatementTag: CREATE INDEX - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 2 │ │ TableID: 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 057ba8fddca3..f662d30c3f80 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 @@ -33,7 +33,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexName:{DescID: 106, Name: idx1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -56,12 +59,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 6 Mutation operations - │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: crdb_internal_index_2_name_placeholder - │ │ TableID: 106 + │ └── • 7 Mutation operations │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 3 @@ -71,17 +69,39 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ IndexID: 3 │ │ TableID: 106 │ │ + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ sourceIndexId: 1 + │ │ tableId: 106 + │ │ temporaryIndexId: 3 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: CREATE INDEX ‹idx1› ON ‹defaultdb›.public.‹t› (‹v›) WHERE (‹v› = ‹'a'›) + │ │ StatementTag: CREATE INDEX + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TargetStatus: 1 + │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 106 │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: crdb_internal_index_2_name_placeholder + │ │ TableID: 106 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 106 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 6 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 5 MutationType ops pending │ └── • Stage 2 of 2 in PostCommitNonRevertiblePhase │ @@ -139,7 +159,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ └── • Precedence dependency from ABSENT TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ rule: "index removed before garbage collection" │ - └── • 8 Mutation operations + └── • 7 Mutation operations │ ├── • RemoveDroppedIndexPartialPredicate │ IndexID: 2 @@ -149,23 +169,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ IndexID: 3 │ TableID: 106 │ - ├── • LogEvent - │ Element: - │ SecondaryIndex: - │ indexId: 2 - │ sourceIndexId: 1 - │ tableId: 106 - │ temporaryIndexId: 3 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: CREATE INDEX ‹idx1› ON ‹defaultdb›.public.‹t› (‹v›) WHERE (‹v› = ‹'a'›) - │ StatementTag: CREATE INDEX - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TargetStatus: 1 - │ ├── • MakeIndexAbsent │ IndexID: 2 │ TableID: 106 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 22193ccfdaec..1acdd10aee7a 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 @@ -33,7 +33,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexName:{DescID: 106, Name: idx1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -56,12 +59,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 6 Mutation operations - │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: crdb_internal_index_2_name_placeholder - │ │ TableID: 106 + │ └── • 7 Mutation operations │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 3 @@ -71,17 +69,39 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ IndexID: 3 │ │ TableID: 106 │ │ + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ sourceIndexId: 1 + │ │ tableId: 106 + │ │ temporaryIndexId: 3 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: CREATE INDEX ‹idx1› ON ‹defaultdb›.public.‹t› (‹v›) WHERE (‹v› = ‹'a'›) + │ │ StatementTag: CREATE INDEX + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TargetStatus: 1 + │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 106 │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: crdb_internal_index_2_name_placeholder + │ │ TableID: 106 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 106 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 6 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 5 MutationType ops pending │ └── • Stage 2 of 2 in PostCommitNonRevertiblePhase │ @@ -139,7 +159,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ └── • Precedence dependency from ABSENT TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ rule: "index removed before garbage collection" │ - └── • 8 Mutation operations + └── • 7 Mutation operations │ ├── • RemoveDroppedIndexPartialPredicate │ IndexID: 2 @@ -149,23 +169,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ IndexID: 3 │ TableID: 106 │ - ├── • LogEvent - │ Element: - │ SecondaryIndex: - │ indexId: 2 - │ sourceIndexId: 1 - │ tableId: 106 - │ temporaryIndexId: 3 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: CREATE INDEX ‹idx1› ON ‹defaultdb›.public.‹t› (‹v›) WHERE (‹v› = ‹'a'›) - │ StatementTag: CREATE INDEX - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TargetStatus: 1 - │ ├── • MakeIndexAbsent │ IndexID: 2 │ TableID: 106 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 3bfb579c26b8..e519d75bc203 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 @@ -33,7 +33,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexName:{DescID: 106, Name: idx1, IndexID: 2} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 106, IndexID: 2, ConstraintID: 0, TemporaryIndexID: 3, SourceIndexID: 1} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -56,7 +59,24 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 6 Mutation operations + │ └── • 7 Mutation operations + │ │ + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ sourceIndexId: 1 + │ │ tableId: 106 + │ │ temporaryIndexId: 3 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: CREATE INDEX ‹idx1› ON ‹defaultdb›.public.‹t› (‹v›) WHERE (‹v› = ‹'a'›) + │ │ StatementTag: CREATE INDEX + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TargetStatus: 1 │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 2 @@ -81,7 +101,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 6 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 5 MutationType ops pending │ └── • Stage 2 of 2 in PostCommitNonRevertiblePhase │ @@ -139,7 +159,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ └── • Precedence dependency from ABSENT TemporaryIndex:{DescID: 106, IndexID: 3, ConstraintID: 1, SourceIndexID: 1} │ rule: "index removed before garbage collection" │ - └── • 8 Mutation operations + └── • 7 Mutation operations │ ├── • RemoveDroppedIndexPartialPredicate │ IndexID: 2 @@ -149,23 +169,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ IndexID: 3 │ TableID: 106 │ - ├── • LogEvent - │ Element: - │ SecondaryIndex: - │ indexId: 2 - │ sourceIndexId: 1 - │ tableId: 106 - │ temporaryIndexId: 3 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: CREATE INDEX ‹idx1› ON ‹defaultdb›.public.‹t› (‹v›) WHERE (‹v› = ‹'a'›) - │ StatementTag: CREATE INDEX - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TargetStatus: 1 - │ ├── • MakeIndexAbsent │ IndexID: 2 │ TableID: 106 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 b816b2fbd0b9..cdad1662782f 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_computed_index @@ -44,7 +44,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ rule: "temp index existence precedes index dependents" │ │ -│ ├── • 6 elements transitioning toward ABSENT +│ ├── • 5 elements transitioning toward ABSENT │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ PUBLIC → WRITE_ONLY @@ -73,19 +73,13 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 3} │ │ │ rule: "column no longer public before dependents" │ │ │ -│ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ │ │ PUBLIC → VALIDATED -│ │ │ │ -│ │ │ └── • PreviousTransactionPrecedence dependency from PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: PUBLIC->VALIDATED" -│ │ │ -│ │ └── • IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} -│ │ │ PUBLIC → ABSENT +│ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} +│ │ │ PUBLIC → VALIDATED │ │ │ -│ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ rule: "index no longer public before dependents" +│ │ └── • PreviousTransactionPrecedence dependency from PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} +│ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: PUBLIC->VALIDATED" │ │ -│ └── • 12 Mutation operations +│ └── • 11 Mutation operations │ │ │ ├── • MakePublicColumnWriteOnly │ │ ColumnID: 2 @@ -116,11 +110,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ IndexID: 2 │ │ TableID: 104 │ │ -│ ├── • SetIndexName -│ │ IndexID: 2 -│ │ Name: crdb_internal_index_2_name_placeholder -│ │ TableID: 104 -│ │ │ ├── • MakeAbsentIndexBackfilling │ │ Index: │ │ ConstraintID: 2 @@ -397,7 +386,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ ├── • 9 elements transitioning toward ABSENT + │ ├── • 10 elements transitioning toward ABSENT │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -465,13 +454,22 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ - │ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ VALIDATED → DELETE_ONLY + │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ VALIDATED → DELETE_ONLY + │ │ │ │ + │ │ │ └── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: VALIDATED->WRITE_ONLY" + │ │ │ + │ │ └── • IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} + │ │ │ PUBLIC → ABSENT │ │ │ - │ │ └── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: VALIDATED->WRITE_ONLY" + │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "index no longer public before index name" + │ │ │ + │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ rule: "index no longer public before dependents" │ │ - │ └── • 10 Mutation operations + │ └── • 12 Mutation operations │ │ │ ├── • MakeWriteOnlyColumnDeleteOnly │ │ ColumnID: 2 @@ -499,10 +497,30 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ IndexID: 4 │ │ 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 + │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: crdb_internal_index_2_name_placeholder + │ │ TableID: 104 + │ │ │ ├── • MakeValidatedPrimaryIndexPublic │ │ EventBase: │ │ Authorization: @@ -521,7 +539,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 5 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 4 MutationType ops pending │ ├── • Stage 2 of 3 in PostCommitNonRevertiblePhase │ │ @@ -584,22 +602,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} │ │ rule: "dependents removed before index" │ │ - │ └── • 7 Mutation operations - │ │ - │ ├── • 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 + │ └── • 6 Mutation operations │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 2 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 b3cddf39a8cb..ef192c0deebb 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 @@ -11,7 +11,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ └── • Stage 1 of 1 in PostCommitNonRevertiblePhase │ - ├── • 6 elements transitioning toward PUBLIC + ├── • 5 elements transitioning toward PUBLIC │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ WRITE_ONLY → PUBLIC @@ -52,23 +52,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ ├── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ ABSENT → PUBLIC │ │ - │ ├── • 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" - │ │ │ - │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" - │ │ │ - │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} - │ │ rule: "index dependents exist before index becomes public" - │ │ - │ └── • IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} - │ ABSENT → PUBLIC + │ └── • 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" + │ │ + │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" + │ │ + │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} + │ rule: "index dependents exist before index becomes public" │ ├── • 5 elements transitioning toward ABSENT │ │ @@ -111,7 +108,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ └── • skip PUBLIC → ABSENT operations │ rule: "skip index-column removal ops on index removal" │ - └── • 15 Mutation operations + └── • 14 Mutation operations │ ├── • SetColumnName │ ColumnID: 2 @@ -123,13 +120,14 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ Name: crdb_internal_idx_expr │ TableID: 104 │ - ├── • SetIndexName - │ IndexID: 2 - │ Name: t_expr_idx + ├── • RefreshStats │ TableID: 104 │ - ├── • MakeWriteOnlyColumnPublic - │ ColumnID: 2 + ├── • LogEvent + │ Element: + │ SecondaryIndex: + │ indexId: 2 + │ tableId: 104 │ EventBase: │ Authorization: │ UserName: root @@ -138,13 +136,14 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ TargetMetadata: │ SourceElementID: 1 │ SubWorkID: 1 - │ TableID: 104 + │ TargetStatus: 2 │ - ├── • RefreshStats + ├── • MakeValidatedSecondaryIndexPublic + │ IndexID: 2 │ TableID: 104 │ ├── • MakeWriteOnlyColumnPublic - │ ColumnID: 3 + │ ColumnID: 2 │ EventBase: │ Authorization: │ UserName: root @@ -158,14 +157,8 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; ├── • RefreshStats │ TableID: 104 │ - ├── • RefreshStats - │ TableID: 104 - │ - ├── • LogEvent - │ Element: - │ SecondaryIndex: - │ indexId: 2 - │ tableId: 104 + ├── • MakeWriteOnlyColumnPublic + │ ColumnID: 3 │ EventBase: │ Authorization: │ UserName: root @@ -174,10 +167,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ TargetMetadata: │ SourceElementID: 1 │ SubWorkID: 1 - │ TargetStatus: 2 + │ TableID: 104 │ - ├── • MakeValidatedSecondaryIndexPublic - │ IndexID: 2 + ├── • RefreshStats │ TableID: 104 │ ├── • MakeIndexAbsent 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 6538d875999d..c016a292e6c4 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 @@ -11,7 +11,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 6 elements transitioning toward PUBLIC + │ ├── • 5 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -52,23 +52,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ ├── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ │ ABSENT → PUBLIC │ │ │ - │ │ ├── • 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" - │ │ │ │ - │ │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" - │ │ │ │ - │ │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} - │ │ │ rule: "index dependents exist before index becomes public" - │ │ │ - │ │ └── • IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} - │ │ ABSENT → PUBLIC + │ │ └── • 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" + │ │ │ + │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" + │ │ │ + │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} + │ │ rule: "index dependents exist before index becomes public" │ │ │ ├── • 4 elements transitioning toward ABSENT │ │ │ @@ -102,7 +99,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 14 Mutation operations + │ └── • 13 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 2 @@ -114,17 +111,14 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_idx - │ │ TableID: 104 - │ │ - │ ├── • MakeWriteOnlyIndexDeleteOnly - │ │ IndexID: 4 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • MakeWriteOnlyColumnPublic - │ │ ColumnID: 2 + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ tableId: 104 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -133,13 +127,18 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 + │ │ TargetStatus: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 │ │ TableID: 104 │ │ - │ ├── • RefreshStats + │ ├── • MakeWriteOnlyIndexDeleteOnly + │ │ IndexID: 4 │ │ TableID: 104 │ │ │ ├── • MakeWriteOnlyColumnPublic - │ │ ColumnID: 3 + │ │ ColumnID: 2 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -153,14 +152,8 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ TableID: 104 - │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ indexId: 2 - │ │ tableId: 104 + │ ├── • MakeWriteOnlyColumnPublic + │ │ ColumnID: 3 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -169,10 +162,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ TargetStatus: 2 + │ │ TableID: 104 │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 + │ ├── • RefreshStats │ │ TableID: 104 │ │ │ ├── • MakeIndexAbsent 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 6ab408555f57..35e192388398 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 @@ -11,7 +11,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 6 elements transitioning toward PUBLIC + │ ├── • 5 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -52,23 +52,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ ├── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ │ ABSENT → PUBLIC │ │ │ - │ │ ├── • 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" - │ │ │ │ - │ │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" - │ │ │ │ - │ │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} - │ │ │ rule: "index dependents exist before index becomes public" - │ │ │ - │ │ └── • IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} - │ │ ABSENT → PUBLIC + │ │ └── • 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" + │ │ │ + │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" + │ │ │ + │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} + │ │ rule: "index dependents exist before index becomes public" │ │ │ ├── • 4 elements transitioning toward ABSENT │ │ │ @@ -102,7 +99,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 14 Mutation operations + │ └── • 13 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 2 @@ -114,17 +111,14 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_idx - │ │ TableID: 104 - │ │ - │ ├── • MakeWriteOnlyIndexDeleteOnly - │ │ IndexID: 4 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • MakeWriteOnlyColumnPublic - │ │ ColumnID: 2 + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ tableId: 104 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -133,13 +127,18 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 + │ │ TargetStatus: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 │ │ TableID: 104 │ │ - │ ├── • RefreshStats + │ ├── • MakeWriteOnlyIndexDeleteOnly + │ │ IndexID: 4 │ │ TableID: 104 │ │ │ ├── • MakeWriteOnlyColumnPublic - │ │ ColumnID: 3 + │ │ ColumnID: 2 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -153,14 +152,8 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ TableID: 104 - │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ indexId: 2 - │ │ tableId: 104 + │ ├── • MakeWriteOnlyColumnPublic + │ │ ColumnID: 3 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -169,10 +162,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ TargetStatus: 2 + │ │ TableID: 104 │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 + │ ├── • RefreshStats │ │ TableID: 104 │ │ │ ├── • MakeIndexAbsent 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 cd59fb3523c4..f0c7c2a8de90 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 @@ -11,7 +11,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 6 elements transitioning toward PUBLIC + │ ├── • 5 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -52,23 +52,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ ├── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ │ ABSENT → PUBLIC │ │ │ - │ │ ├── • 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" - │ │ │ │ - │ │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" - │ │ │ │ - │ │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} - │ │ │ rule: "index dependents exist before index becomes public" - │ │ │ - │ │ └── • IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} - │ │ ABSENT → PUBLIC + │ │ └── • 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" + │ │ │ + │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" + │ │ │ + │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} + │ │ rule: "index dependents exist before index becomes public" │ │ │ ├── • 4 elements transitioning toward ABSENT │ │ │ @@ -102,7 +99,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 14 Mutation operations + │ └── • 13 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 2 @@ -114,17 +111,14 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_idx - │ │ TableID: 104 - │ │ - │ ├── • MakeWriteOnlyIndexDeleteOnly - │ │ IndexID: 4 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • MakeWriteOnlyColumnPublic - │ │ ColumnID: 2 + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ tableId: 104 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -133,13 +127,18 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 + │ │ TargetStatus: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 │ │ TableID: 104 │ │ - │ ├── • RefreshStats + │ ├── • MakeWriteOnlyIndexDeleteOnly + │ │ IndexID: 4 │ │ TableID: 104 │ │ │ ├── • MakeWriteOnlyColumnPublic - │ │ ColumnID: 3 + │ │ ColumnID: 2 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -153,14 +152,8 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ TableID: 104 - │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ indexId: 2 - │ │ tableId: 104 + │ ├── • MakeWriteOnlyColumnPublic + │ │ ColumnID: 3 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -169,10 +162,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ TargetStatus: 2 + │ │ TableID: 104 │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 + │ ├── • RefreshStats │ │ TableID: 104 │ │ │ ├── • MakeIndexAbsent 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 792e84c33e68..dfba714d56d8 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 @@ -11,7 +11,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 6 elements transitioning toward PUBLIC + │ ├── • 5 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -52,23 +52,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ ├── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ │ ABSENT → PUBLIC │ │ │ - │ │ ├── • 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" - │ │ │ │ - │ │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" - │ │ │ │ - │ │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} - │ │ │ rule: "index dependents exist before index becomes public" - │ │ │ - │ │ └── • IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} - │ │ ABSENT → PUBLIC + │ │ └── • 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" + │ │ │ + │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" + │ │ │ + │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} + │ │ rule: "index dependents exist before index becomes public" │ │ │ ├── • 4 elements transitioning toward ABSENT │ │ │ @@ -96,7 +93,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 14 Mutation operations + │ └── • 13 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 2 @@ -108,17 +105,14 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_idx - │ │ TableID: 104 - │ │ - │ ├── • MakeWriteOnlyIndexDeleteOnly - │ │ IndexID: 4 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • MakeWriteOnlyColumnPublic - │ │ ColumnID: 2 + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ tableId: 104 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -127,13 +121,18 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 + │ │ TargetStatus: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 │ │ TableID: 104 │ │ - │ ├── • RefreshStats + │ ├── • MakeWriteOnlyIndexDeleteOnly + │ │ IndexID: 4 │ │ TableID: 104 │ │ │ ├── • MakeWriteOnlyColumnPublic - │ │ ColumnID: 3 + │ │ ColumnID: 2 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -147,14 +146,8 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ TableID: 104 - │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ indexId: 2 - │ │ tableId: 104 + │ ├── • MakeWriteOnlyColumnPublic + │ │ ColumnID: 3 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -163,10 +156,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ TargetStatus: 2 + │ │ TableID: 104 │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 + │ ├── • RefreshStats │ │ TableID: 104 │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly 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 2ebda3cc5074..f203468d675f 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 @@ -11,7 +11,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 6 elements transitioning toward PUBLIC + │ ├── • 5 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -52,23 +52,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ ├── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ │ ABSENT → PUBLIC │ │ │ - │ │ ├── • 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" - │ │ │ │ - │ │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" - │ │ │ │ - │ │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} - │ │ │ rule: "index dependents exist before index becomes public" - │ │ │ - │ │ └── • IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} - │ │ ABSENT → PUBLIC + │ │ └── • 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" + │ │ │ + │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" + │ │ │ + │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} + │ │ rule: "index dependents exist before index becomes public" │ │ │ ├── • 4 elements transitioning toward ABSENT │ │ │ @@ -96,7 +93,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 14 Mutation operations + │ └── • 13 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 2 @@ -108,17 +105,14 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_idx - │ │ TableID: 104 - │ │ - │ ├── • MakeWriteOnlyIndexDeleteOnly - │ │ IndexID: 4 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • MakeWriteOnlyColumnPublic - │ │ ColumnID: 2 + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ tableId: 104 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -127,13 +121,18 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 + │ │ TargetStatus: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 │ │ TableID: 104 │ │ - │ ├── • RefreshStats + │ ├── • MakeWriteOnlyIndexDeleteOnly + │ │ IndexID: 4 │ │ TableID: 104 │ │ │ ├── • MakeWriteOnlyColumnPublic - │ │ ColumnID: 3 + │ │ ColumnID: 2 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -147,14 +146,8 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ TableID: 104 - │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ indexId: 2 - │ │ tableId: 104 + │ ├── • MakeWriteOnlyColumnPublic + │ │ ColumnID: 3 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -163,10 +156,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ TargetStatus: 2 + │ │ TableID: 104 │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 + │ ├── • RefreshStats │ │ TableID: 104 │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly 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 774d742748a7..28babddca52a 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 @@ -11,7 +11,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 6 elements transitioning toward PUBLIC + │ ├── • 5 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -52,23 +52,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ ├── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 3} │ │ │ ABSENT → PUBLIC │ │ │ - │ │ ├── • 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" - │ │ │ │ - │ │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" - │ │ │ │ - │ │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} - │ │ │ rule: "index dependents exist before index becomes public" - │ │ │ - │ │ └── • IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} - │ │ ABSENT → PUBLIC + │ │ └── • 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" + │ │ │ + │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" + │ │ │ + │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_expr_idx, IndexID: 2} + │ │ rule: "index dependents exist before index becomes public" │ │ │ ├── • 4 elements transitioning toward ABSENT │ │ │ @@ -96,7 +93,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 14 Mutation operations + │ └── • 13 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 2 @@ -108,9 +105,26 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName + │ ├── • RefreshStats + │ │ 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: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic │ │ IndexID: 2 - │ │ Name: t_expr_idx │ │ TableID: 104 │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly @@ -151,28 +165,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ 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: 2 - │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 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 320129375eae..b4889da4e252 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 @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 10 of 15; │ ├── • Stage 1 of 3 in PostCommitNonRevertiblePhase │ │ - │ ├── • 8 elements transitioning toward PUBLIC + │ ├── • 7 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -93,10 +93,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 10 of 15; │ │ ├── • 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} + │ │ └── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ ABSENT → PUBLIC │ │ │ ├── • 14 elements transitioning toward ABSENT @@ -177,7 +174,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 10 of 15; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexName:{DescID: 104, Name: idx, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 5, SourceIndexID: 3} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -197,13 +197,35 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 10 of 15; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 21 Mutation operations + │ └── • 19 Mutation operations │ │ │ ├── • SetIndexName │ │ IndexID: 1 │ │ Name: t_pkey │ │ TableID: 104 │ │ + │ ├── • RefreshStats + │ │ 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: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 + │ │ TableID: 104 + │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -214,11 +236,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 10 of 15; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ │ ├── • MakePublicPrimaryIndexWriteOnly │ │ IndexID: 3 │ │ TableID: 104 @@ -283,48 +300,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 10 of 15; │ │ IndexID: 1 │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ 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: 2 - │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ constraintId: 4 - │ │ indexId: 5 - │ │ isUnique: true - │ │ sourceIndexId: 3 - │ │ tableId: 104 - │ │ temporaryIndexId: 6 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›) - │ │ StatementTag: CREATE INDEX - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ StatementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 5 │ │ TableID: 104 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 250709a78f1d..b6f71945f696 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 @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 11 of 15; │ ├── • Stage 1 of 3 in PostCommitNonRevertiblePhase │ │ - │ ├── • 8 elements transitioning toward PUBLIC + │ ├── • 7 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -93,10 +93,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 11 of 15; │ │ ├── • 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} + │ │ └── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ ABSENT → PUBLIC │ │ │ ├── • 14 elements transitioning toward ABSENT @@ -177,7 +174,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 11 of 15; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexName:{DescID: 104, Name: idx, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 5, SourceIndexID: 3} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -197,13 +197,35 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 11 of 15; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 21 Mutation operations + │ └── • 19 Mutation operations │ │ │ ├── • SetIndexName │ │ IndexID: 1 │ │ Name: t_pkey │ │ TableID: 104 │ │ + │ ├── • RefreshStats + │ │ 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: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 + │ │ TableID: 104 + │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -214,11 +236,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 11 of 15; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ │ ├── • MakePublicPrimaryIndexWriteOnly │ │ IndexID: 3 │ │ TableID: 104 @@ -283,48 +300,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 11 of 15; │ │ IndexID: 1 │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ 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: 2 - │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ constraintId: 4 - │ │ indexId: 5 - │ │ isUnique: true - │ │ sourceIndexId: 3 - │ │ tableId: 104 - │ │ temporaryIndexId: 6 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›) - │ │ StatementTag: CREATE INDEX - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ StatementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 5 │ │ TableID: 104 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 c24705c6cd0e..0673d9977a55 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 @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 12 of 15; │ ├── • Stage 1 of 3 in PostCommitNonRevertiblePhase │ │ - │ ├── • 8 elements transitioning toward PUBLIC + │ ├── • 7 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -93,10 +93,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 12 of 15; │ │ ├── • 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} + │ │ └── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ ABSENT → PUBLIC │ │ │ ├── • 14 elements transitioning toward ABSENT @@ -177,7 +174,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 12 of 15; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexName:{DescID: 104, Name: idx, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 5, SourceIndexID: 3} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -197,13 +197,35 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 12 of 15; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 21 Mutation operations + │ └── • 19 Mutation operations │ │ │ ├── • SetIndexName │ │ IndexID: 1 │ │ Name: t_pkey │ │ TableID: 104 │ │ + │ ├── • RefreshStats + │ │ 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: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 + │ │ TableID: 104 + │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -214,11 +236,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 12 of 15; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ │ ├── • MakePublicPrimaryIndexWriteOnly │ │ IndexID: 3 │ │ TableID: 104 @@ -283,48 +300,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 12 of 15; │ │ IndexID: 1 │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ 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: 2 - │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ constraintId: 4 - │ │ indexId: 5 - │ │ isUnique: true - │ │ sourceIndexId: 3 - │ │ tableId: 104 - │ │ temporaryIndexId: 6 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›) - │ │ StatementTag: CREATE INDEX - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ StatementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 5 │ │ TableID: 104 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 f36589436238..35de8bc35042 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 @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ ├── • Stage 1 of 3 in PostCommitNonRevertiblePhase │ │ - │ ├── • 8 elements transitioning toward PUBLIC + │ ├── • 7 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -93,10 +93,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ │ ├── • 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} + │ │ └── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ ABSENT → PUBLIC │ │ │ ├── • 14 elements transitioning toward ABSENT @@ -168,7 +165,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexName:{DescID: 104, Name: idx, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 5, SourceIndexID: 3} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -195,6 +195,28 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ │ Name: t_pkey │ │ TableID: 104 │ │ + │ ├── • RefreshStats + │ │ 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: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 + │ │ TableID: 104 + │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -205,11 +227,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ │ ├── • MakePublicPrimaryIndexWriteOnly │ │ IndexID: 3 │ │ TableID: 104 @@ -223,11 +240,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 5 - │ │ Name: crdb_internal_index_5_name_placeholder - │ │ TableID: 104 - │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 6 │ │ TableID: 104 @@ -274,30 +286,33 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ │ IndexID: 1 │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ TableID: 104 - │ │ │ ├── • LogEvent │ │ Element: │ │ SecondaryIndex: - │ │ indexId: 2 + │ │ constraintId: 4 + │ │ indexId: 5 + │ │ isUnique: true + │ │ sourceIndexId: 3 │ │ tableId: 104 + │ │ temporaryIndexId: 6 │ │ EventBase: │ │ Authorization: │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ │ StatementTag: ALTER TABLE + │ │ Statement: CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›) + │ │ StatementTag: CREATE INDEX │ │ TargetMetadata: │ │ SourceElementID: 1 + │ │ StatementID: 1 │ │ SubWorkID: 1 - │ │ TargetStatus: 2 + │ │ TargetStatus: 1 │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 + │ ├── • MakeWriteOnlyIndexDeleteOnly + │ │ IndexID: 5 │ │ TableID: 104 │ │ - │ ├── • MakeWriteOnlyIndexDeleteOnly + │ ├── • SetIndexName │ │ IndexID: 5 + │ │ Name: crdb_internal_index_5_name_placeholder │ │ TableID: 104 │ │ │ ├── • SetJobStateOnDescriptor @@ -306,7 +321,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 5 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 4 MutationType ops pending │ ├── • Stage 2 of 3 in PostCommitNonRevertiblePhase │ │ @@ -357,32 +372,12 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 13 of 15; │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6} │ │ rule: "dependents removed before index" │ │ - │ └── • 7 Mutation operations + │ └── • 6 Mutation operations │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ constraintId: 4 - │ │ indexId: 5 - │ │ isUnique: true - │ │ sourceIndexId: 3 - │ │ tableId: 104 - │ │ temporaryIndexId: 6 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›) - │ │ StatementTag: CREATE INDEX - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ StatementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 5 │ │ TableID: 104 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 282ff3b83f9e..dc73124c8762 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 @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ ├── • Stage 1 of 3 in PostCommitNonRevertiblePhase │ │ - │ ├── • 8 elements transitioning toward PUBLIC + │ ├── • 7 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -93,10 +93,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ │ ├── • 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} + │ │ └── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ ABSENT → PUBLIC │ │ │ ├── • 14 elements transitioning toward ABSENT @@ -168,7 +165,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexName:{DescID: 104, Name: idx, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 5, SourceIndexID: 3} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -195,6 +195,28 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ │ Name: t_pkey │ │ TableID: 104 │ │ + │ ├── • RefreshStats + │ │ 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: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 + │ │ TableID: 104 + │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -205,11 +227,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ │ ├── • MakePublicPrimaryIndexWriteOnly │ │ IndexID: 3 │ │ TableID: 104 @@ -223,11 +240,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 5 - │ │ Name: crdb_internal_index_5_name_placeholder - │ │ TableID: 104 - │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 6 │ │ TableID: 104 @@ -274,30 +286,33 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ │ IndexID: 1 │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ TableID: 104 - │ │ │ ├── • LogEvent │ │ Element: │ │ SecondaryIndex: - │ │ indexId: 2 + │ │ constraintId: 4 + │ │ indexId: 5 + │ │ isUnique: true + │ │ sourceIndexId: 3 │ │ tableId: 104 + │ │ temporaryIndexId: 6 │ │ EventBase: │ │ Authorization: │ │ UserName: root - │ │ Statement: ALTER TABLE ‹defaultdb›.public.‹t› DROP COLUMN ‹j› CASCADE - │ │ StatementTag: ALTER TABLE + │ │ Statement: CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›) + │ │ StatementTag: CREATE INDEX │ │ TargetMetadata: │ │ SourceElementID: 1 + │ │ StatementID: 1 │ │ SubWorkID: 1 - │ │ TargetStatus: 2 + │ │ TargetStatus: 1 │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 + │ ├── • MakeWriteOnlyIndexDeleteOnly + │ │ IndexID: 5 │ │ TableID: 104 │ │ - │ ├── • MakeWriteOnlyIndexDeleteOnly + │ ├── • SetIndexName │ │ IndexID: 5 + │ │ Name: crdb_internal_index_5_name_placeholder │ │ TableID: 104 │ │ │ ├── • SetJobStateOnDescriptor @@ -306,7 +321,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 5 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 4 MutationType ops pending │ ├── • Stage 2 of 3 in PostCommitNonRevertiblePhase │ │ @@ -357,32 +372,12 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 14 of 15; │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6} │ │ rule: "dependents removed before index" │ │ - │ └── • 7 Mutation operations + │ └── • 6 Mutation operations │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ constraintId: 4 - │ │ indexId: 5 - │ │ isUnique: true - │ │ sourceIndexId: 3 - │ │ tableId: 104 - │ │ temporaryIndexId: 6 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›) - │ │ StatementTag: CREATE INDEX - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ StatementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 5 │ │ TableID: 104 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 d5444494899b..9d18b19b50b1 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 @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 15 of 15; │ ├── • Stage 1 of 3 in PostCommitNonRevertiblePhase │ │ - │ ├── • 8 elements transitioning toward PUBLIC + │ ├── • 7 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -93,10 +93,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 15 of 15; │ │ ├── • 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} + │ │ └── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ ABSENT → PUBLIC │ │ │ ├── • 14 elements transitioning toward ABSENT @@ -168,7 +165,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 15 of 15; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexName:{DescID: 104, Name: idx, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 5, SourceIndexID: 3} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -195,6 +195,28 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 15 of 15; │ │ Name: t_pkey │ │ TableID: 104 │ │ + │ ├── • RefreshStats + │ │ 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: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 + │ │ TableID: 104 + │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -205,11 +227,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 15 of 15; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ │ ├── • MakePublicPrimaryIndexWriteOnly │ │ IndexID: 3 │ │ TableID: 104 @@ -223,6 +240,26 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 15 of 15; │ │ IndexID: 4 │ │ TableID: 104 │ │ + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ constraintId: 4 + │ │ indexId: 5 + │ │ isUnique: true + │ │ sourceIndexId: 3 + │ │ tableId: 104 + │ │ temporaryIndexId: 6 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›) + │ │ StatementTag: CREATE INDEX + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ StatementID: 1 + │ │ SubWorkID: 1 + │ │ TargetStatus: 1 + │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 5 │ │ TableID: 104 @@ -278,35 +315,13 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 15 of 15; │ │ IndexID: 1 │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ 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: 2 - │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 5 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 4 MutationType ops pending │ ├── • Stage 2 of 3 in PostCommitNonRevertiblePhase │ │ @@ -357,32 +372,12 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 15 of 15; │ │ └── • Precedence dependency from ABSENT IndexColumn:{DescID: 104, ColumnID: 1, IndexID: 6} │ │ rule: "dependents removed before index" │ │ - │ └── • 7 Mutation operations + │ └── • 6 Mutation operations │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ constraintId: 4 - │ │ indexId: 5 - │ │ isUnique: true - │ │ sourceIndexId: 3 - │ │ tableId: 104 - │ │ temporaryIndexId: 6 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›) - │ │ StatementTag: CREATE INDEX - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ StatementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 5 │ │ TableID: 104 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 94c9f4f5cb54..df96a401f2be 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 @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 15; │ └── • Stage 1 of 1 in PostCommitNonRevertiblePhase │ - ├── • 6 elements transitioning toward PUBLIC + ├── • 5 elements transitioning toward PUBLIC │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ WRITE_ONLY → PUBLIC @@ -68,10 +68,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 15; │ ├── • 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} + │ └── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ ABSENT → PUBLIC │ ├── • 7 elements transitioning toward ABSENT @@ -133,7 +130,29 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 15; │ └── • PreviousTransactionPrecedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: DELETE_ONLY->ABSENT" │ - └── • 15 Mutation operations + └── • 14 Mutation operations + │ + ├── • RefreshStats + │ 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: 2 + │ + ├── • MakeValidatedSecondaryIndexPublic + │ IndexID: 2 + │ TableID: 104 │ ├── • SetColumnName │ ColumnID: 2 @@ -145,11 +164,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 15; │ Name: crdb_internal_idx_expr │ TableID: 104 │ - ├── • SetIndexName - │ IndexID: 2 - │ Name: t_expr_k_idx - │ TableID: 104 - │ ├── • MakeIndexAbsent │ IndexID: 4 │ TableID: 104 @@ -184,28 +198,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 15; ├── • RefreshStats │ TableID: 104 │ - ├── • RefreshStats - │ 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: 2 - │ - ├── • MakeValidatedSecondaryIndexPublic - │ IndexID: 2 - │ TableID: 104 - │ ├── • MakeIndexAbsent │ EventBase: │ Authorization: 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 d9608fcdb1ba..5895ec594902 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 @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 15; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 6 elements transitioning toward PUBLIC + │ ├── • 5 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -68,10 +68,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 15; │ │ ├── • 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} + │ │ └── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ ABSENT → PUBLIC │ │ │ ├── • 6 elements transitioning toward ABSENT @@ -121,7 +118,29 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 15; │ │ └── • PreviousTransactionPrecedence dependency from WRITE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: WRITE_ONLY->DELETE_ONLY" │ │ - │ └── • 14 Mutation operations + │ └── • 13 Mutation operations + │ │ + │ ├── • RefreshStats + │ │ 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: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 + │ │ TableID: 104 │ │ │ ├── • SetColumnName │ │ ColumnID: 2 @@ -133,11 +152,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 15; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 104 @@ -172,28 +186,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 15; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ 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: 2 - │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeIndexAbsent │ │ EventBase: │ │ Authorization: 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 5be96326d92a..f5da6af4adf1 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 @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 15; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 6 elements transitioning toward PUBLIC + │ ├── • 5 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -68,10 +68,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 15; │ │ ├── • 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} + │ │ └── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ ABSENT → PUBLIC │ │ │ ├── • 6 elements transitioning toward ABSENT @@ -121,7 +118,29 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 15; │ │ └── • PreviousTransactionPrecedence dependency from WRITE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: WRITE_ONLY->DELETE_ONLY" │ │ - │ └── • 14 Mutation operations + │ └── • 13 Mutation operations + │ │ + │ ├── • RefreshStats + │ │ 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: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 + │ │ TableID: 104 │ │ │ ├── • SetColumnName │ │ ColumnID: 2 @@ -133,11 +152,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 15; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 104 @@ -172,28 +186,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 15; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ 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: 2 - │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeIndexAbsent │ │ EventBase: │ │ Authorization: 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 eff9e3973833..b7aac6a1ec57 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 @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 15; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 6 elements transitioning toward PUBLIC + │ ├── • 5 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -68,10 +68,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 15; │ │ ├── • 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} + │ │ └── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ ABSENT → PUBLIC │ │ │ ├── • 6 elements transitioning toward ABSENT @@ -121,7 +118,29 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 15; │ │ └── • PreviousTransactionPrecedence dependency from WRITE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: WRITE_ONLY->DELETE_ONLY" │ │ - │ └── • 14 Mutation operations + │ └── • 13 Mutation operations + │ │ + │ ├── • RefreshStats + │ │ 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: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 + │ │ TableID: 104 │ │ │ ├── • SetColumnName │ │ ColumnID: 2 @@ -133,11 +152,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 15; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ │ ├── • MakeIndexAbsent │ │ EventBase: │ │ Authorization: @@ -184,28 +198,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 15; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ 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: 2 - │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ 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 2cd2c84c01e9..254adf097530 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 @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 15; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 6 elements transitioning toward PUBLIC + │ ├── • 5 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -68,10 +68,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 15; │ │ ├── • 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} + │ │ └── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ ABSENT → PUBLIC │ │ │ ├── • 6 elements transitioning toward ABSENT @@ -112,7 +109,29 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 15; │ │ └── • PreviousTransactionPrecedence dependency from WRITE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: WRITE_ONLY->DELETE_ONLY" │ │ - │ └── • 14 Mutation operations + │ └── • 13 Mutation operations + │ │ + │ ├── • RefreshStats + │ │ 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: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 + │ │ TableID: 104 │ │ │ ├── • SetColumnName │ │ ColumnID: 2 @@ -124,11 +143,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 15; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 104 @@ -163,28 +177,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 15; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ 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: 2 - │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 3 │ │ 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 3f6e14bb59ef..194cfa1c7c24 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 @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 15; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 6 elements transitioning toward PUBLIC + │ ├── • 5 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -68,10 +68,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 15; │ │ ├── • 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} + │ │ └── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ ABSENT → PUBLIC │ │ │ ├── • 6 elements transitioning toward ABSENT @@ -112,7 +109,29 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 15; │ │ └── • PreviousTransactionPrecedence dependency from WRITE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: WRITE_ONLY->DELETE_ONLY" │ │ - │ └── • 14 Mutation operations + │ └── • 13 Mutation operations + │ │ + │ ├── • RefreshStats + │ │ 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: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 + │ │ TableID: 104 │ │ │ ├── • SetColumnName │ │ ColumnID: 2 @@ -124,11 +143,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 15; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 104 @@ -163,28 +177,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 15; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ 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: 2 - │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 3 │ │ 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 13ccab2b4b76..57b7a4b15ccb 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 @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 15; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 6 elements transitioning toward PUBLIC + │ ├── • 5 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -68,10 +68,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 15; │ │ ├── • 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} + │ │ └── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ ABSENT → PUBLIC │ │ │ ├── • 6 elements transitioning toward ABSENT @@ -112,7 +109,29 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 15; │ │ └── • PreviousTransactionPrecedence dependency from WRITE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: WRITE_ONLY->DELETE_ONLY" │ │ - │ └── • 14 Mutation operations + │ └── • 13 Mutation operations + │ │ + │ ├── • RefreshStats + │ │ 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: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 + │ │ TableID: 104 │ │ │ ├── • SetColumnName │ │ ColumnID: 2 @@ -124,11 +143,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 15; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 104 @@ -167,28 +181,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 15; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ 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: 2 - │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 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 8c53c3bd6edd..1d79f6628f57 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 @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 8 of 15; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 6 elements transitioning toward PUBLIC + │ ├── • 5 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -68,10 +68,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 8 of 15; │ │ ├── • 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} + │ │ └── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ ABSENT → PUBLIC │ │ │ ├── • 6 elements transitioning toward ABSENT @@ -112,7 +109,29 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 8 of 15; │ │ └── • PreviousTransactionPrecedence dependency from WRITE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: WRITE_ONLY->DELETE_ONLY" │ │ - │ └── • 14 Mutation operations + │ └── • 13 Mutation operations + │ │ + │ ├── • RefreshStats + │ │ 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: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 + │ │ TableID: 104 │ │ │ ├── • SetColumnName │ │ ColumnID: 2 @@ -124,11 +143,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 8 of 15; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 104 @@ -167,28 +181,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 8 of 15; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ 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: 2 - │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 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 8ebb6a6eeaa8..8dfbedb07c7b 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 @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 9 of 15; │ ├── • Stage 1 of 3 in PostCommitNonRevertiblePhase │ │ - │ ├── • 8 elements transitioning toward PUBLIC + │ ├── • 7 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -93,10 +93,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 9 of 15; │ │ ├── • 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} + │ │ └── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ ABSENT → PUBLIC │ │ │ ├── • 14 elements transitioning toward ABSENT @@ -177,7 +174,10 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 9 of 15; │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ │ │ ├── • IndexName:{DescID: 104, Name: idx, IndexID: 5} - │ │ │ PUBLIC → ABSENT + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ └── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 5, ConstraintID: 4, TemporaryIndexID: 6, SourceIndexID: 3} + │ │ │ rule: "index no longer public before index name" │ │ │ │ │ ├── • TemporaryIndex:{DescID: 104, IndexID: 6, ConstraintID: 5, SourceIndexID: 3} │ │ │ │ DELETE_ONLY → ABSENT @@ -203,13 +203,35 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 9 of 15; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 21 Mutation operations + │ └── • 19 Mutation operations │ │ │ ├── • SetIndexName │ │ IndexID: 1 │ │ Name: t_pkey │ │ TableID: 104 │ │ + │ ├── • RefreshStats + │ │ 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: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 + │ │ TableID: 104 + │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -220,11 +242,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 9 of 15; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ │ ├── • MakePublicPrimaryIndexWriteOnly │ │ IndexID: 3 │ │ TableID: 104 @@ -285,48 +302,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 9 of 15; │ │ IndexID: 1 │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ 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: 2 - │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ constraintId: 4 - │ │ indexId: 5 - │ │ isUnique: true - │ │ sourceIndexId: 3 - │ │ tableId: 104 - │ │ temporaryIndexId: 6 - │ │ EventBase: - │ │ Authorization: - │ │ UserName: root - │ │ Statement: CREATE UNIQUE INDEX ‹idx› ON ‹defaultdb›.public.‹t› (‹k›) - │ │ StatementTag: CREATE INDEX - │ │ TargetMetadata: - │ │ SourceElementID: 1 - │ │ StatementID: 1 - │ │ SubWorkID: 1 - │ │ TargetStatus: 1 - │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 5 │ │ TableID: 104 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 de98fbbd4c42..a69edab76643 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 @@ -56,7 +56,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ rule: "temp index existence precedes index dependents" │ │ -│ ├── • 6 elements transitioning toward ABSENT +│ ├── • 5 elements transitioning toward ABSENT │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ PUBLIC → WRITE_ONLY @@ -85,19 +85,13 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 4} │ │ │ rule: "column no longer public before dependents" │ │ │ -│ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ │ │ PUBLIC → VALIDATED -│ │ │ │ -│ │ │ └── • PreviousTransactionPrecedence dependency from PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: PUBLIC->VALIDATED" -│ │ │ -│ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} -│ │ │ PUBLIC → ABSENT +│ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} +│ │ │ PUBLIC → VALIDATED │ │ │ -│ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ rule: "index no longer public before dependents" +│ │ └── • PreviousTransactionPrecedence dependency from PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} +│ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: PUBLIC->VALIDATED" │ │ -│ └── • 14 Mutation operations +│ └── • 13 Mutation operations │ │ │ ├── • MakePublicColumnWriteOnly │ │ ColumnID: 2 @@ -128,11 +122,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ IndexID: 2 │ │ TableID: 104 │ │ -│ ├── • SetIndexName -│ │ IndexID: 2 -│ │ Name: crdb_internal_index_2_name_placeholder -│ │ TableID: 104 -│ │ │ ├── • MakeAbsentIndexBackfilling │ │ Index: │ │ ConstraintID: 2 @@ -436,7 +425,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ ├── • 11 elements transitioning toward ABSENT + │ ├── • 12 elements transitioning toward ABSENT │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -522,13 +511,22 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ - │ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ VALIDATED → DELETE_ONLY + │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ VALIDATED → DELETE_ONLY + │ │ │ │ + │ │ │ └── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: VALIDATED->WRITE_ONLY" + │ │ │ + │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ PUBLIC → ABSENT │ │ │ - │ │ └── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: VALIDATED->WRITE_ONLY" + │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "index no longer public before index name" + │ │ │ + │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ rule: "index no longer public before dependents" │ │ - │ └── • 10 Mutation operations + │ └── • 12 Mutation operations │ │ │ ├── • MakeWriteOnlyColumnDeleteOnly │ │ ColumnID: 2 @@ -556,10 +554,30 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ IndexID: 4 │ │ 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 + │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: crdb_internal_index_2_name_placeholder + │ │ TableID: 104 + │ │ │ ├── • MakeValidatedPrimaryIndexPublic │ │ EventBase: │ │ Authorization: @@ -578,7 +596,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 5 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 4 MutationType ops pending │ ├── • Stage 2 of 3 in PostCommitNonRevertiblePhase │ │ @@ -647,22 +665,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ rule: "dependents removed before index" │ │ - │ └── • 7 Mutation operations - │ │ - │ ├── • 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 + │ └── • 6 Mutation operations │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 2 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 9d81d7346b93..050ce1cb9015 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 @@ -602,7 +602,7 @@ EXPLAIN (ddl, verbose) CREATE UNIQUE INDEX idx ON t(k); │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ ├── • 10 elements transitioning toward ABSENT + │ ├── • 11 elements transitioning toward ABSENT │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -682,13 +682,22 @@ EXPLAIN (ddl, verbose) CREATE UNIQUE INDEX idx ON t(k); │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ - │ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ VALIDATED → DELETE_ONLY + │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ VALIDATED → DELETE_ONLY + │ │ │ │ + │ │ │ └── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: VALIDATED->WRITE_ONLY" + │ │ │ + │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "index no longer public before index name" │ │ │ - │ │ └── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: VALIDATED->WRITE_ONLY" + │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ rule: "index no longer public before dependents" │ │ - │ └── • 11 Mutation operations + │ └── • 13 Mutation operations │ │ │ ├── • MakeWriteOnlyColumnDeleteOnly │ │ ColumnID: 2 @@ -737,17 +746,37 @@ EXPLAIN (ddl, verbose) CREATE UNIQUE INDEX idx ON t(k); │ │ 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 + │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: crdb_internal_index_2_name_placeholder + │ │ TableID: 104 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 11 MutationType ops + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 10 MutationType ops │ pending │ └── • Stage 2 of 2 in PostCommitNonRevertiblePhase @@ -908,7 +937,7 @@ EXPLAIN (ddl, verbose) CREATE UNIQUE INDEX idx ON t(k); │ └── • Precedence dependency from ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ rule: "index removed before garbage collection" │ - └── • 13 Mutation operations + └── • 12 Mutation operations │ ├── • MakeIndexAbsent │ EventBase: @@ -928,21 +957,6 @@ EXPLAIN (ddl, verbose) CREATE UNIQUE INDEX idx ON t(k); │ Statement: ALTER TABLE defaultdb.public.t DROP COLUMN j CASCADE │ 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 - │ ├── • MakeIndexAbsent │ IndexID: 2 │ TableID: 104 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 6818607eabb3..cac97c461485 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_column_with_index @@ -44,7 +44,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ rule: "temp index existence precedes index dependents" │ │ -│ ├── • 4 elements transitioning toward ABSENT +│ ├── • 3 elements transitioning toward ABSENT │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ PUBLIC → WRITE_ONLY @@ -61,29 +61,18 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 2} │ │ │ rule: "column no longer public before dependents" │ │ │ -│ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ │ │ PUBLIC → VALIDATED -│ │ │ │ -│ │ │ └── • PreviousTransactionPrecedence dependency from PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: PUBLIC->VALIDATED" -│ │ │ -│ │ └── • IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} -│ │ │ PUBLIC → ABSENT +│ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} +│ │ │ PUBLIC → VALIDATED │ │ │ -│ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ rule: "index no longer public before dependents" +│ │ └── • PreviousTransactionPrecedence dependency from PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} +│ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: PUBLIC->VALIDATED" │ │ -│ └── • 9 Mutation operations +│ └── • 8 Mutation operations │ │ │ ├── • MakePublicSecondaryIndexWriteOnly │ │ IndexID: 2 │ │ TableID: 104 │ │ -│ ├── • SetIndexName -│ │ IndexID: 2 -│ │ Name: crdb_internal_index_2_name_placeholder -│ │ TableID: 104 -│ │ │ ├── • MakeAbsentIndexBackfilling │ │ Index: │ │ ConstraintID: 2 @@ -359,7 +348,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ ├── • 8 elements transitioning toward ABSENT + │ ├── • 9 elements transitioning toward ABSENT │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -421,13 +410,22 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ - │ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ VALIDATED → DELETE_ONLY + │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ VALIDATED → DELETE_ONLY + │ │ │ │ + │ │ │ └── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: VALIDATED->WRITE_ONLY" + │ │ │ + │ │ └── • IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} + │ │ │ PUBLIC → ABSENT │ │ │ - │ │ └── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: VALIDATED->WRITE_ONLY" + │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "index no longer public before index name" + │ │ │ + │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ rule: "index no longer public before dependents" │ │ - │ └── • 9 Mutation operations + │ └── • 11 Mutation operations │ │ │ ├── • MakeWriteOnlyColumnDeleteOnly │ │ ColumnID: 2 @@ -451,10 +449,30 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ │ IndexID: 4 │ │ 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 + │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: crdb_internal_index_2_name_placeholder + │ │ TableID: 104 + │ │ │ ├── • MakeValidatedPrimaryIndexPublic │ │ EventBase: │ │ Authorization: @@ -473,7 +491,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 4 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 3 MutationType ops pending │ ├── • Stage 2 of 3 in PostCommitNonRevertiblePhase │ │ @@ -511,22 +529,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j; │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} │ │ rule: "dependents removed before index" │ │ - │ └── • 6 Mutation operations - │ │ - │ ├── • 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 + │ └── • 5 Mutation operations │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 2 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 0ee7527c5817..5abf70cb0253 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 @@ -11,7 +11,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ └── • Stage 1 of 1 in PostCommitNonRevertiblePhase │ - ├── • 4 elements transitioning toward PUBLIC + ├── • 3 elements transitioning toward PUBLIC │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ WRITE_ONLY → PUBLIC @@ -34,23 +34,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ ABSENT → PUBLIC │ │ - │ ├── • 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" - │ │ │ - │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" - │ │ │ - │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} - │ │ rule: "index dependents exist before index becomes public" - │ │ - │ └── • IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} - │ ABSENT → PUBLIC + │ └── • 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" + │ │ + │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" + │ │ + │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} + │ rule: "index dependents exist before index becomes public" │ ├── • 5 elements transitioning toward ABSENT │ │ @@ -93,20 +90,21 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ └── • skip PUBLIC → ABSENT operations │ rule: "skip index-column removal ops on index removal" │ - └── • 12 Mutation operations + └── • 11 Mutation operations │ ├── • SetColumnName │ ColumnID: 2 │ Name: j │ TableID: 104 │ - ├── • SetIndexName - │ IndexID: 2 - │ Name: t_j_idx + ├── • RefreshStats │ TableID: 104 │ - ├── • MakeWriteOnlyColumnPublic - │ ColumnID: 2 + ├── • LogEvent + │ Element: + │ SecondaryIndex: + │ indexId: 2 + │ tableId: 104 │ EventBase: │ Authorization: │ UserName: root @@ -115,19 +113,14 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ TargetMetadata: │ SourceElementID: 1 │ SubWorkID: 1 - │ TableID: 104 - │ - ├── • RefreshStats - │ TableID: 104 + │ TargetStatus: 2 │ - ├── • RefreshStats + ├── • MakeValidatedSecondaryIndexPublic + │ IndexID: 2 │ TableID: 104 │ - ├── • LogEvent - │ Element: - │ SecondaryIndex: - │ indexId: 2 - │ tableId: 104 + ├── • MakeWriteOnlyColumnPublic + │ ColumnID: 2 │ EventBase: │ Authorization: │ UserName: root @@ -136,10 +129,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ TargetMetadata: │ SourceElementID: 1 │ SubWorkID: 1 - │ TargetStatus: 2 + │ TableID: 104 │ - ├── • MakeValidatedSecondaryIndexPublic - │ IndexID: 2 + ├── • RefreshStats │ TableID: 104 │ ├── • MakeIndexAbsent 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 51a3759b1c5a..7911e0e9f872 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 @@ -11,7 +11,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 4 elements transitioning toward PUBLIC + │ ├── • 3 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -34,23 +34,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ │ ABSENT → PUBLIC │ │ │ - │ │ ├── • 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" - │ │ │ │ - │ │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" - │ │ │ │ - │ │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} - │ │ │ rule: "index dependents exist before index becomes public" - │ │ │ - │ │ └── • IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} - │ │ ABSENT → PUBLIC + │ │ └── • 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" + │ │ │ + │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" + │ │ │ + │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} + │ │ rule: "index dependents exist before index becomes public" │ │ │ ├── • 4 elements transitioning toward ABSENT │ │ │ @@ -84,24 +81,21 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 11 Mutation operations + │ └── • 10 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_j_idx - │ │ TableID: 104 - │ │ - │ ├── • MakeWriteOnlyIndexDeleteOnly - │ │ IndexID: 4 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • MakeWriteOnlyColumnPublic - │ │ ColumnID: 2 + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ tableId: 104 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -110,19 +104,18 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ TableID: 104 + │ │ TargetStatus: 2 │ │ - │ ├── • RefreshStats + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 │ │ TableID: 104 │ │ - │ ├── • RefreshStats + │ ├── • MakeWriteOnlyIndexDeleteOnly + │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ indexId: 2 - │ │ tableId: 104 + │ ├── • MakeWriteOnlyColumnPublic + │ │ ColumnID: 2 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -131,10 +124,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ TargetStatus: 2 + │ │ TableID: 104 │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 + │ ├── • RefreshStats │ │ TableID: 104 │ │ │ ├── • MakeIndexAbsent 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 072778441dae..36e345eb56aa 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 @@ -11,7 +11,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 4 elements transitioning toward PUBLIC + │ ├── • 3 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -34,23 +34,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ │ ABSENT → PUBLIC │ │ │ - │ │ ├── • 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" - │ │ │ │ - │ │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" - │ │ │ │ - │ │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} - │ │ │ rule: "index dependents exist before index becomes public" - │ │ │ - │ │ └── • IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} - │ │ ABSENT → PUBLIC + │ │ └── • 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" + │ │ │ + │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" + │ │ │ + │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} + │ │ rule: "index dependents exist before index becomes public" │ │ │ ├── • 4 elements transitioning toward ABSENT │ │ │ @@ -84,24 +81,21 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 11 Mutation operations + │ └── • 10 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_j_idx - │ │ TableID: 104 - │ │ - │ ├── • MakeWriteOnlyIndexDeleteOnly - │ │ IndexID: 4 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • MakeWriteOnlyColumnPublic - │ │ ColumnID: 2 + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ tableId: 104 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -110,19 +104,18 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ TableID: 104 + │ │ TargetStatus: 2 │ │ - │ ├── • RefreshStats + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 │ │ TableID: 104 │ │ - │ ├── • RefreshStats + │ ├── • MakeWriteOnlyIndexDeleteOnly + │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ indexId: 2 - │ │ tableId: 104 + │ ├── • MakeWriteOnlyColumnPublic + │ │ ColumnID: 2 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -131,10 +124,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ TargetStatus: 2 + │ │ TableID: 104 │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 + │ ├── • RefreshStats │ │ TableID: 104 │ │ │ ├── • MakeIndexAbsent 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 6203b522225b..c8671da39207 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 @@ -11,7 +11,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 4 elements transitioning toward PUBLIC + │ ├── • 3 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -34,23 +34,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ │ ABSENT → PUBLIC │ │ │ - │ │ ├── • 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" - │ │ │ │ - │ │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" - │ │ │ │ - │ │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} - │ │ │ rule: "index dependents exist before index becomes public" - │ │ │ - │ │ └── • IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} - │ │ ABSENT → PUBLIC + │ │ └── • 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" + │ │ │ + │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" + │ │ │ + │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} + │ │ rule: "index dependents exist before index becomes public" │ │ │ ├── • 4 elements transitioning toward ABSENT │ │ │ @@ -84,24 +81,21 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 11 Mutation operations + │ └── • 10 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_j_idx - │ │ TableID: 104 - │ │ - │ ├── • MakeWriteOnlyIndexDeleteOnly - │ │ IndexID: 4 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • MakeWriteOnlyColumnPublic - │ │ ColumnID: 2 + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ tableId: 104 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -110,19 +104,18 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ TableID: 104 + │ │ TargetStatus: 2 │ │ - │ ├── • RefreshStats + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 │ │ TableID: 104 │ │ - │ ├── • RefreshStats + │ ├── • MakeWriteOnlyIndexDeleteOnly + │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ indexId: 2 - │ │ tableId: 104 + │ ├── • MakeWriteOnlyColumnPublic + │ │ ColumnID: 2 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -131,10 +124,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ TargetStatus: 2 + │ │ TableID: 104 │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 + │ ├── • RefreshStats │ │ TableID: 104 │ │ │ ├── • MakeIndexAbsent 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 e0da3bae46d5..52c81adbf38f 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 @@ -11,7 +11,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 4 elements transitioning toward PUBLIC + │ ├── • 3 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -34,23 +34,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ │ ABSENT → PUBLIC │ │ │ - │ │ ├── • 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" - │ │ │ │ - │ │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" - │ │ │ │ - │ │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} - │ │ │ rule: "index dependents exist before index becomes public" - │ │ │ - │ │ └── • IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} - │ │ ABSENT → PUBLIC + │ │ └── • 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" + │ │ │ + │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" + │ │ │ + │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} + │ │ rule: "index dependents exist before index becomes public" │ │ │ ├── • 4 elements transitioning toward ABSENT │ │ │ @@ -78,24 +75,21 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 11 Mutation operations + │ └── • 10 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_j_idx - │ │ TableID: 104 - │ │ - │ ├── • MakeWriteOnlyIndexDeleteOnly - │ │ IndexID: 4 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • MakeWriteOnlyColumnPublic - │ │ ColumnID: 2 + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ tableId: 104 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -104,19 +98,18 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ TableID: 104 + │ │ TargetStatus: 2 │ │ - │ ├── • RefreshStats + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 │ │ TableID: 104 │ │ - │ ├── • RefreshStats + │ ├── • MakeWriteOnlyIndexDeleteOnly + │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ indexId: 2 - │ │ tableId: 104 + │ ├── • MakeWriteOnlyColumnPublic + │ │ ColumnID: 2 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -125,10 +118,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ TargetStatus: 2 + │ │ TableID: 104 │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 + │ ├── • RefreshStats │ │ TableID: 104 │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly 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 871c46003b3f..a10264d84d21 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 @@ -11,7 +11,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 4 elements transitioning toward PUBLIC + │ ├── • 3 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -34,23 +34,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ │ ABSENT → PUBLIC │ │ │ - │ │ ├── • 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" - │ │ │ │ - │ │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" - │ │ │ │ - │ │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} - │ │ │ rule: "index dependents exist before index becomes public" - │ │ │ - │ │ └── • IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} - │ │ ABSENT → PUBLIC + │ │ └── • 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" + │ │ │ + │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" + │ │ │ + │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} + │ │ rule: "index dependents exist before index becomes public" │ │ │ ├── • 4 elements transitioning toward ABSENT │ │ │ @@ -78,24 +75,21 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 11 Mutation operations + │ └── • 10 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_j_idx - │ │ TableID: 104 - │ │ - │ ├── • MakeWriteOnlyIndexDeleteOnly - │ │ IndexID: 4 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • MakeWriteOnlyColumnPublic - │ │ ColumnID: 2 + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ tableId: 104 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -104,19 +98,18 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ TableID: 104 + │ │ TargetStatus: 2 │ │ - │ ├── • RefreshStats + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 │ │ TableID: 104 │ │ - │ ├── • RefreshStats + │ ├── • MakeWriteOnlyIndexDeleteOnly + │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ indexId: 2 - │ │ tableId: 104 + │ ├── • MakeWriteOnlyColumnPublic + │ │ ColumnID: 2 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -125,10 +118,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ TargetStatus: 2 + │ │ TableID: 104 │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 + │ ├── • RefreshStats │ │ TableID: 104 │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly 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 21298b51aef8..e5054c412442 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 @@ -11,7 +11,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 4 elements transitioning toward PUBLIC + │ ├── • 3 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → PUBLIC @@ -34,23 +34,20 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ ├── • ColumnName:{DescID: 104, Name: j, ColumnID: 2} │ │ │ ABSENT → PUBLIC │ │ │ - │ │ ├── • 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" - │ │ │ │ - │ │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" - │ │ │ │ - │ │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} - │ │ │ rule: "index dependents exist before index becomes public" - │ │ │ - │ │ └── • IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} - │ │ ABSENT → PUBLIC + │ │ └── • 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" + │ │ │ + │ │ ├── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "SecondaryIndex transitions to PUBLIC uphold 2-version invariant: VALIDATED->PUBLIC" + │ │ │ + │ │ └── • Precedence dependency from PUBLIC IndexName:{DescID: 104, Name: t_j_idx, IndexID: 2} + │ │ rule: "index dependents exist before index becomes public" │ │ │ ├── • 4 elements transitioning toward ABSENT │ │ │ @@ -78,28 +75,21 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 11 Mutation operations + │ └── • 10 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_j_idx - │ │ TableID: 104 - │ │ - │ ├── • MakeWriteOnlyIndexDeleteOnly - │ │ IndexID: 3 - │ │ TableID: 104 - │ │ - │ ├── • MakeWriteOnlyIndexDeleteOnly - │ │ IndexID: 4 + │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • MakeWriteOnlyColumnPublic - │ │ ColumnID: 2 + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ tableId: 104 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -108,19 +98,22 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 + │ │ TargetStatus: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 │ │ TableID: 104 │ │ - │ ├── • RefreshStats + │ ├── • MakeWriteOnlyIndexDeleteOnly + │ │ IndexID: 3 │ │ TableID: 104 │ │ - │ ├── • RefreshStats + │ ├── • MakeWriteOnlyIndexDeleteOnly + │ │ IndexID: 4 │ │ TableID: 104 │ │ - │ ├── • LogEvent - │ │ Element: - │ │ SecondaryIndex: - │ │ indexId: 2 - │ │ tableId: 104 + │ ├── • MakeWriteOnlyColumnPublic + │ │ ColumnID: 2 │ │ EventBase: │ │ Authorization: │ │ UserName: root @@ -129,10 +122,9 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ TargetMetadata: │ │ SourceElementID: 1 │ │ SubWorkID: 1 - │ │ TargetStatus: 2 + │ │ TableID: 104 │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 + │ ├── • RefreshStats │ │ TableID: 104 │ │ │ ├── • SetJobStateOnDescriptor 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 c7b4a5d4ece3..6bef9a8e3049 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 @@ -11,7 +11,7 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ │ └── • Stage 1 of 1 in StatementPhase │ │ -│ ├── • 6 elements transitioning toward ABSENT +│ ├── • 5 elements transitioning toward ABSENT │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ PUBLIC → WRITE_ONLY @@ -34,12 +34,6 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ │ └── • PreviousTransactionPrecedence dependency from PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: PUBLIC->VALIDATED" │ │ │ -│ │ ├── • IndexName:{DescID: 104, Name: idx, IndexID: 2} -│ │ │ │ PUBLIC → ABSENT -│ │ │ │ -│ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ │ rule: "index no longer public before dependents" -│ │ │ │ │ ├── • CheckConstraint:{DescID: 104, IndexID: 0, ConstraintID: 2} │ │ │ │ PUBLIC → VALIDATED │ │ │ │ @@ -52,17 +46,12 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ └── • Precedence dependency from VALIDATED CheckConstraint:{DescID: 104, IndexID: 0, ConstraintID: 2} │ │ rule: "constraint no longer public before dependents" │ │ -│ └── • 7 Mutation operations +│ └── • 6 Mutation operations │ │ │ ├── • MakePublicSecondaryIndexWriteOnly │ │ IndexID: 2 │ │ TableID: 104 │ │ -│ ├── • SetIndexName -│ │ IndexID: 2 -│ │ Name: crdb_internal_index_2_name_placeholder -│ │ TableID: 104 -│ │ │ ├── • MakePublicCheckConstraintValidated │ │ ConstraintID: 2 │ │ TableID: 104 @@ -89,7 +78,7 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ Statement: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE │ │ StatementTag: DROP INDEX │ │ TargetMetadata: -│ │ SourceElementID: 1 +│ │ SourceElementID: 2 │ │ SubWorkID: 1 │ │ TargetStatus: 1 │ │ @@ -147,7 +136,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 5 MutationType ops pending │ Statements: │ - statement: DROP INDEX idx CASCADE │ redactedstatement: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE @@ -157,7 +146,7 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 3 elements transitioning toward ABSENT + │ ├── • 4 elements transitioning toward ABSENT │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -171,6 +160,15 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ │ └── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: VALIDATED->WRITE_ONLY" │ │ │ + │ │ ├── • IndexName:{DescID: 104, Name: idx, IndexID: 2} + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before index name" + │ │ │ │ + │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "index no longer public before dependents" + │ │ │ │ │ └── • CheckConstraint:{DescID: 104, IndexID: 0, ConstraintID: 2} │ │ │ VALIDATED → ABSENT │ │ │ @@ -180,7 +178,7 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ └── • Precedence dependency from ABSENT ConstraintWithoutIndexName:{DescID: 104, Name: check_crdb_internal_j_shard_16, ConstraintID: 2} │ │ rule: "dependents removed before constraint" │ │ - │ └── • 5 Mutation operations + │ └── • 7 Mutation operations │ │ │ ├── • MakeWriteOnlyColumnDeleteOnly │ │ ColumnID: 3 @@ -190,17 +188,44 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ ConstraintID: 2 │ │ TableID: 104 │ │ + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ isCreatedExplicitly: true + │ │ sharding: + │ │ columnNames: + │ │ - j + │ │ isSharded: true + │ │ name: crdb_internal_j_shard_16 + │ │ shardBuckets: 16 + │ │ tableId: 104 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE + │ │ StatementTag: DROP INDEX + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TargetStatus: 1 + │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: crdb_internal_index_2_name_placeholder + │ │ TableID: 104 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 4 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 3 MutationType ops pending │ └── • Stage 2 of 2 in PostCommitNonRevertiblePhase │ @@ -255,29 +280,7 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ └── • Precedence dependency from ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ rule: "index removed before garbage collection" │ - └── • 6 Mutation operations - │ - ├── • LogEvent - │ Element: - │ SecondaryIndex: - │ indexId: 2 - │ isCreatedExplicitly: true - │ sharding: - │ columnNames: - │ - j - │ isSharded: true - │ name: crdb_internal_j_shard_16 - │ shardBuckets: 16 - │ tableId: 104 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE - │ StatementTag: DROP INDEX - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TargetStatus: 1 + └── • 5 Mutation operations │ ├── • MakeIndexAbsent │ IndexID: 2 @@ -297,7 +300,7 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ Statement: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE │ StatementTag: DROP INDEX │ TargetMetadata: - │ SourceElementID: 1 + │ SourceElementID: 2 │ SubWorkID: 1 │ TableID: 104 │ 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 85d559a750a0..f6a23e10cedd 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 @@ -11,7 +11,7 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ │ └── • Stage 1 of 1 in StatementPhase │ │ -│ ├── • 4 elements transitioning toward ABSENT +│ ├── • 3 elements transitioning toward ABSENT │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ PUBLIC → WRITE_ONLY @@ -28,29 +28,18 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 3} │ │ │ rule: "column no longer public before dependents" │ │ │ -│ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ │ │ PUBLIC → VALIDATED -│ │ │ │ -│ │ │ └── • PreviousTransactionPrecedence dependency from PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: PUBLIC->VALIDATED" -│ │ │ -│ │ └── • IndexName:{DescID: 104, Name: idx, IndexID: 2} -│ │ │ PUBLIC → ABSENT +│ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} +│ │ │ PUBLIC → VALIDATED │ │ │ -│ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ rule: "index no longer public before dependents" +│ │ └── • PreviousTransactionPrecedence dependency from PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} +│ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: PUBLIC->VALIDATED" │ │ -│ └── • 5 Mutation operations +│ └── • 4 Mutation operations │ │ │ ├── • MakePublicSecondaryIndexWriteOnly │ │ IndexID: 2 │ │ TableID: 104 │ │ -│ ├── • SetIndexName -│ │ IndexID: 2 -│ │ Name: crdb_internal_index_2_name_placeholder -│ │ TableID: 104 -│ │ │ ├── • MakePublicColumnWriteOnly │ │ ColumnID: 3 │ │ TableID: 104 @@ -68,7 +57,7 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ Statement: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE │ │ StatementTag: DROP INDEX │ │ TargetMetadata: -│ │ SourceElementID: 1 +│ │ SourceElementID: 2 │ │ SubWorkID: 1 │ │ TargetStatus: 1 │ │ @@ -117,7 +106,7 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ - 104 │ JobID: 1 │ NonCancelable: true -│ RunningStatus: PostCommitNonRevertiblePhase stage 1 of 2 with 2 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 @@ -127,7 +116,7 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 2 elements transitioning toward ABSENT + │ ├── • 3 elements transitioning toward ABSENT │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -135,29 +124,59 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ │ └── • PreviousTransactionPrecedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 3} │ │ │ rule: "Column transitions to ABSENT uphold 2-version invariant: WRITE_ONLY->DELETE_ONLY" │ │ │ - │ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ VALIDATED → DELETE_ONLY + │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ VALIDATED → DELETE_ONLY + │ │ │ │ + │ │ │ └── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: VALIDATED->WRITE_ONLY" + │ │ │ + │ │ └── • IndexName:{DescID: 104, Name: idx, IndexID: 2} + │ │ │ PUBLIC → ABSENT + │ │ │ + │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "index no longer public before index name" │ │ │ - │ │ └── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: VALIDATED->WRITE_ONLY" + │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ rule: "index no longer public before dependents" │ │ - │ └── • 4 Mutation operations + │ └── • 6 Mutation operations │ │ │ ├── • MakeWriteOnlyColumnDeleteOnly │ │ ColumnID: 3 │ │ TableID: 104 │ │ + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ isCreatedExplicitly: true + │ │ tableId: 104 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE + │ │ StatementTag: DROP INDEX + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TargetStatus: 1 + │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: crdb_internal_index_2_name_placeholder + │ │ TableID: 104 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 5 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 4 MutationType ops pending │ └── • Stage 2 of 2 in PostCommitNonRevertiblePhase │ @@ -219,28 +238,12 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ └── • Precedence dependency from ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ rule: "index removed before garbage collection" │ - └── • 7 Mutation operations + └── • 6 Mutation operations │ ├── • RemoveDroppedIndexPartialPredicate │ IndexID: 2 │ TableID: 104 │ - ├── • LogEvent - │ Element: - │ SecondaryIndex: - │ indexId: 2 - │ isCreatedExplicitly: true - │ tableId: 104 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE - │ StatementTag: DROP INDEX - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TargetStatus: 1 - │ ├── • MakeIndexAbsent │ IndexID: 2 │ TableID: 104 @@ -259,7 +262,7 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ Statement: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE │ StatementTag: DROP INDEX │ TargetMetadata: - │ SourceElementID: 1 + │ SourceElementID: 2 │ SubWorkID: 1 │ TableID: 104 │ 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 361da6a15e68..668cf5540606 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_index_vanilla_index +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_index_vanilla_index @@ -11,29 +11,18 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ │ │ └── • Stage 1 of 1 in StatementPhase │ │ -│ ├── • 2 elements transitioning toward ABSENT -│ │ │ -│ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ │ │ PUBLIC → VALIDATED -│ │ │ │ -│ │ │ └── • PreviousTransactionPrecedence dependency from PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: PUBLIC->VALIDATED" +│ ├── • 1 element transitioning toward ABSENT │ │ │ -│ │ └── • IndexName:{DescID: 104, Name: idx, IndexID: 2} -│ │ │ PUBLIC → ABSENT +│ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} +│ │ │ PUBLIC → VALIDATED │ │ │ -│ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ rule: "index no longer public before dependents" +│ │ └── • PreviousTransactionPrecedence dependency from PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} +│ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: PUBLIC->VALIDATED" │ │ -│ └── • 2 Mutation operations -│ │ -│ ├── • MakePublicSecondaryIndexWriteOnly -│ │ IndexID: 2 -│ │ TableID: 104 +│ └── • 1 Mutation operation │ │ -│ └── • SetIndexName +│ └── • MakePublicSecondaryIndexWriteOnly │ IndexID: 2 -│ Name: crdb_internal_index_2_name_placeholder │ TableID: 104 │ ├── • PreCommitPhase @@ -73,7 +62,7 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ - 104 │ JobID: 1 │ NonCancelable: true -│ RunningStatus: PostCommitNonRevertiblePhase stage 1 of 2 with 1 MutationType op pending +│ RunningStatus: PostCommitNonRevertiblePhase stage 1 of 2 with 3 MutationType ops pending │ Statements: │ - statement: DROP INDEX idx CASCADE │ redactedstatement: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE @@ -83,27 +72,57 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 1 element transitioning toward ABSENT + │ ├── • 2 elements transitioning toward ABSENT + │ │ │ + │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ VALIDATED → DELETE_ONLY + │ │ │ │ + │ │ │ └── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: VALIDATED->WRITE_ONLY" │ │ │ - │ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ VALIDATED → DELETE_ONLY + │ │ └── • IndexName:{DescID: 104, Name: idx, IndexID: 2} + │ │ │ PUBLIC → ABSENT │ │ │ - │ │ └── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: VALIDATED->WRITE_ONLY" + │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "index no longer public before index name" + │ │ │ + │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ rule: "index no longer public before dependents" │ │ - │ └── • 3 Mutation operations + │ └── • 5 Mutation operations + │ │ + │ ├── • LogEvent + │ │ Element: + │ │ SecondaryIndex: + │ │ indexId: 2 + │ │ isCreatedExplicitly: true + │ │ tableId: 104 + │ │ EventBase: + │ │ Authorization: + │ │ UserName: root + │ │ Statement: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE + │ │ StatementTag: DROP INDEX + │ │ TargetMetadata: + │ │ SourceElementID: 1 + │ │ SubWorkID: 1 + │ │ TargetStatus: 1 │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: crdb_internal_index_2_name_placeholder + │ │ TableID: 104 + │ │ │ ├── • SetJobStateOnDescriptor │ │ DescriptorID: 104 │ │ │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 3 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 2 with 2 MutationType ops pending │ └── • Stage 2 of 2 in PostCommitNonRevertiblePhase │ @@ -130,23 +149,7 @@ EXPLAIN (ddl, verbose) DROP INDEX idx CASCADE; │ └── • Precedence dependency from ABSENT SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ rule: "index removed before garbage collection" │ - └── • 5 Mutation operations - │ - ├── • LogEvent - │ Element: - │ SecondaryIndex: - │ indexId: 2 - │ isCreatedExplicitly: true - │ tableId: 104 - │ EventBase: - │ Authorization: - │ UserName: root - │ Statement: DROP INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CASCADE - │ StatementTag: DROP INDEX - │ TargetMetadata: - │ SourceElementID: 1 - │ SubWorkID: 1 - │ TargetStatus: 1 + └── • 4 Mutation operations │ ├── • MakeIndexAbsent │ 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 c13970e12f43..70bda70e235b 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 @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ └── • Stage 1 of 1 in PostCommitNonRevertiblePhase │ - ├── • 8 elements transitioning toward PUBLIC + ├── • 7 elements transitioning toward PUBLIC │ │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ WRITE_ONLY → PUBLIC @@ -107,10 +107,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ ├── • 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} + │ └── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ ABSENT → PUBLIC │ ├── • 5 elements transitioning toward ABSENT @@ -154,13 +151,35 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ └── • PreviousTransactionPrecedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: DELETE_ONLY->ABSENT" │ - └── • 18 Mutation operations + └── • 17 Mutation operations │ ├── • SetColumnName │ ColumnID: 3 │ Name: k │ TableID: 104 │ + ├── • RefreshStats + │ 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: 2 + │ + ├── • MakeValidatedSecondaryIndexPublic + │ IndexID: 2 + │ TableID: 104 + │ ├── • SetColumnName │ ColumnID: 2 │ Name: j @@ -171,11 +190,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; │ Name: crdb_internal_idx_expr │ TableID: 104 │ - ├── • SetIndexName - │ IndexID: 2 - │ Name: t_expr_k_idx - │ TableID: 104 - │ ├── • MakeIndexAbsent │ IndexID: 4 │ TableID: 104 @@ -195,28 +209,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 1 of 7; ├── • RefreshStats │ TableID: 104 │ - ├── • RefreshStats - │ 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: 2 - │ - ├── • MakeValidatedSecondaryIndexPublic - │ IndexID: 2 - │ TableID: 104 - │ ├── • MakeIndexAbsent │ EventBase: │ Authorization: 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 a33f845db222..659874a40d8b 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 @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 8 elements transitioning toward PUBLIC + │ ├── • 7 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ WRITE_ONLY → PUBLIC @@ -107,10 +107,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ ├── • 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} + │ │ └── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ ABSENT → PUBLIC │ │ │ ├── • 4 elements transitioning toward ABSENT @@ -145,13 +142,35 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ └── • PreviousTransactionPrecedence dependency from WRITE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: WRITE_ONLY->DELETE_ONLY" │ │ - │ └── • 17 Mutation operations + │ └── • 16 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 3 │ │ Name: k │ │ TableID: 104 │ │ + │ ├── • RefreshStats + │ │ 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: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 + │ │ TableID: 104 + │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -162,11 +181,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 104 @@ -186,28 +200,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 2 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ 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: 2 - │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeIndexAbsent │ │ EventBase: │ │ Authorization: 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 e6ad65c85198..04defae2b749 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 @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 8 elements transitioning toward PUBLIC + │ ├── • 7 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ WRITE_ONLY → PUBLIC @@ -107,10 +107,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ ├── • 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} + │ │ └── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ ABSENT → PUBLIC │ │ │ ├── • 4 elements transitioning toward ABSENT @@ -145,13 +142,35 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ └── • PreviousTransactionPrecedence dependency from WRITE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: WRITE_ONLY->DELETE_ONLY" │ │ - │ └── • 17 Mutation operations + │ └── • 16 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 3 │ │ Name: k │ │ TableID: 104 │ │ + │ ├── • RefreshStats + │ │ 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: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 + │ │ TableID: 104 + │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -162,11 +181,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 104 @@ -186,28 +200,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 3 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ 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: 2 - │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeIndexAbsent │ │ EventBase: │ │ Authorization: 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 498d4cb07abb..319a80e98ce7 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 @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 8 elements transitioning toward PUBLIC + │ ├── • 7 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ WRITE_ONLY → PUBLIC @@ -107,10 +107,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ ├── • 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} + │ │ └── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ ABSENT → PUBLIC │ │ │ ├── • 4 elements transitioning toward ABSENT @@ -145,13 +142,35 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ └── • PreviousTransactionPrecedence dependency from WRITE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: WRITE_ONLY->DELETE_ONLY" │ │ - │ └── • 17 Mutation operations + │ └── • 16 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 3 │ │ Name: k │ │ TableID: 104 │ │ + │ ├── • RefreshStats + │ │ 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: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 + │ │ TableID: 104 + │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -162,11 +181,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ │ ├── • MakeIndexAbsent │ │ EventBase: │ │ Authorization: @@ -198,28 +212,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 4 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ 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: 2 - │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeWriteOnlyColumnPublic │ │ ColumnID: 3 │ │ EventBase: 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 0f8df806bdef..4f15b9060d4a 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 @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 8 elements transitioning toward PUBLIC + │ ├── • 7 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ WRITE_ONLY → PUBLIC @@ -107,10 +107,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ ├── • 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} + │ │ └── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ ABSENT → PUBLIC │ │ │ ├── • 4 elements transitioning toward ABSENT @@ -139,13 +136,35 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ └── • PreviousTransactionPrecedence dependency from WRITE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: WRITE_ONLY->DELETE_ONLY" │ │ - │ └── • 17 Mutation operations + │ └── • 16 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 3 │ │ Name: k │ │ TableID: 104 │ │ + │ ├── • RefreshStats + │ │ 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: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 + │ │ TableID: 104 + │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -156,11 +175,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 104 @@ -180,28 +194,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 5 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ 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: 2 - │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 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 1f648ad09e04..f219a8a5bec8 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 @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 8 elements transitioning toward PUBLIC + │ ├── • 7 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ WRITE_ONLY → PUBLIC @@ -107,10 +107,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ ├── • 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} + │ │ └── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ ABSENT → PUBLIC │ │ │ ├── • 4 elements transitioning toward ABSENT @@ -139,13 +136,35 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ └── • PreviousTransactionPrecedence dependency from WRITE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: WRITE_ONLY->DELETE_ONLY" │ │ - │ └── • 17 Mutation operations + │ └── • 16 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 3 │ │ Name: k │ │ TableID: 104 │ │ + │ ├── • RefreshStats + │ │ 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: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 + │ │ TableID: 104 + │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -156,11 +175,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 4 │ │ TableID: 104 @@ -180,28 +194,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 6 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ 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: 2 - │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 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 9bb1ff0b1a8f..d6f183a54902 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 @@ -12,7 +12,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ ├── • Stage 1 of 2 in PostCommitNonRevertiblePhase │ │ - │ ├── • 8 elements transitioning toward PUBLIC + │ ├── • 7 elements transitioning toward PUBLIC │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ WRITE_ONLY → PUBLIC @@ -107,10 +107,7 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ ├── • 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} + │ │ └── • ColumnName:{DescID: 104, Name: crdb_internal_idx_expr, ColumnID: 4} │ │ ABSENT → PUBLIC │ │ │ ├── • 4 elements transitioning toward ABSENT @@ -139,13 +136,35 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ └── • PreviousTransactionPrecedence dependency from WRITE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ rule: "TemporaryIndex transitions to ABSENT uphold 2-version invariant: WRITE_ONLY->DELETE_ONLY" │ │ - │ └── • 17 Mutation operations + │ └── • 16 Mutation operations │ │ │ ├── • SetColumnName │ │ ColumnID: 3 │ │ Name: k │ │ TableID: 104 │ │ + │ ├── • RefreshStats + │ │ 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: 2 + │ │ + │ ├── • MakeValidatedSecondaryIndexPublic + │ │ IndexID: 2 + │ │ TableID: 104 + │ │ │ ├── • SetColumnName │ │ ColumnID: 2 │ │ Name: j @@ -156,11 +175,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ │ Name: crdb_internal_idx_expr │ │ TableID: 104 │ │ - │ ├── • SetIndexName - │ │ IndexID: 2 - │ │ Name: t_expr_k_idx - │ │ TableID: 104 - │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 3 │ │ TableID: 104 @@ -184,28 +198,6 @@ EXPLAIN (ddl, verbose) rollback at post-commit stage 7 of 7; │ ├── • RefreshStats │ │ TableID: 104 │ │ - │ ├── • RefreshStats - │ │ 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: 2 - │ │ - │ ├── • MakeValidatedSecondaryIndexPublic - │ │ IndexID: 2 - │ │ TableID: 104 - │ │ │ ├── • MakeWriteOnlyColumnPublic │ │ ColumnID: 3 │ │ EventBase: 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 de98fbbd4c42..a69edab76643 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 @@ -56,7 +56,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ └── • Precedence dependency from DELETE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ rule: "temp index existence precedes index dependents" │ │ -│ ├── • 6 elements transitioning toward ABSENT +│ ├── • 5 elements transitioning toward ABSENT │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ PUBLIC → WRITE_ONLY @@ -85,19 +85,13 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ └── • Precedence dependency from WRITE_ONLY Column:{DescID: 104, ColumnID: 4} │ │ │ rule: "column no longer public before dependents" │ │ │ -│ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ │ │ PUBLIC → VALIDATED -│ │ │ │ -│ │ │ └── • PreviousTransactionPrecedence dependency from PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: PUBLIC->VALIDATED" -│ │ │ -│ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} -│ │ │ PUBLIC → ABSENT +│ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} +│ │ │ PUBLIC → VALIDATED │ │ │ -│ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} -│ │ rule: "index no longer public before dependents" +│ │ └── • PreviousTransactionPrecedence dependency from PUBLIC SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} +│ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: PUBLIC->VALIDATED" │ │ -│ └── • 14 Mutation operations +│ └── • 13 Mutation operations │ │ │ ├── • MakePublicColumnWriteOnly │ │ ColumnID: 2 @@ -128,11 +122,6 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ IndexID: 2 │ │ TableID: 104 │ │ -│ ├── • SetIndexName -│ │ IndexID: 2 -│ │ Name: crdb_internal_index_2_name_placeholder -│ │ TableID: 104 -│ │ │ ├── • MakeAbsentIndexBackfilling │ │ Index: │ │ ConstraintID: 2 @@ -436,7 +425,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ └── • skip PUBLIC → TRANSIENT_ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ ├── • 11 elements transitioning toward ABSENT + │ ├── • 12 elements transitioning toward ABSENT │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 2} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -522,13 +511,22 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ │ └── • skip PUBLIC → ABSENT operations │ │ │ rule: "skip index-column removal ops on index removal" │ │ │ - │ │ └── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ │ VALIDATED → DELETE_ONLY + │ │ ├── • SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ VALIDATED → DELETE_ONLY + │ │ │ │ + │ │ │ └── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: VALIDATED->WRITE_ONLY" + │ │ │ + │ │ └── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ PUBLIC → ABSENT │ │ │ - │ │ └── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} - │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: VALIDATED->WRITE_ONLY" + │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "index no longer public before index name" + │ │ │ + │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ rule: "index no longer public before dependents" │ │ - │ └── • 10 Mutation operations + │ └── • 12 Mutation operations │ │ │ ├── • MakeWriteOnlyColumnDeleteOnly │ │ ColumnID: 2 @@ -556,10 +554,30 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ IndexID: 4 │ │ 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 + │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: crdb_internal_index_2_name_placeholder + │ │ TableID: 104 + │ │ │ ├── • MakeValidatedPrimaryIndexPublic │ │ EventBase: │ │ Authorization: @@ -578,7 +596,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 5 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 4 MutationType ops pending │ ├── • Stage 2 of 3 in PostCommitNonRevertiblePhase │ │ @@ -647,22 +665,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN j CASCADE; │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ rule: "dependents removed before index" │ │ - │ └── • 7 Mutation operations - │ │ - │ ├── • 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 + │ └── • 6 Mutation operations │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 2 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 1a75ff780d99..4847bba3e09d 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 @@ -282,7 +282,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN k CASCADE; │ │ └── • PreviousTransactionPrecedence dependency from WRITE_ONLY TemporaryIndex:{DescID: 104, IndexID: 4, ConstraintID: 3, SourceIndexID: 1} │ │ rule: "TemporaryIndex transitions to TRANSIENT_ABSENT uphold 2-version invariant: WRITE_ONLY->TRANSIENT_DELETE_ONLY" │ │ - │ ├── • 14 elements transitioning toward ABSENT + │ ├── • 15 elements transitioning toward ABSENT │ │ │ │ │ ├── • Column:{DescID: 104, ColumnID: 3} │ │ │ │ WRITE_ONLY → DELETE_ONLY @@ -386,6 +386,15 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN k CASCADE; │ │ │ └── • PreviousTransactionPrecedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} │ │ │ rule: "SecondaryIndex transitions to ABSENT uphold 2-version invariant: VALIDATED->WRITE_ONLY" │ │ │ + │ │ ├── • IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} + │ │ │ │ PUBLIC → ABSENT + │ │ │ │ + │ │ │ ├── • Precedence dependency from DELETE_ONLY SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ │ rule: "index no longer public before index name" + │ │ │ │ + │ │ │ └── • Precedence dependency from VALIDATED SecondaryIndex:{DescID: 104, IndexID: 2, ConstraintID: 0} + │ │ │ rule: "index no longer public before dependents" + │ │ │ │ │ ├── • IndexColumn:{DescID: 104, ColumnID: 3, IndexID: 3} │ │ │ │ PUBLIC → ABSENT │ │ │ │ @@ -401,7 +410,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN k CASCADE; │ │ └── • skip PUBLIC → ABSENT operations │ │ rule: "skip index-column removal ops on index removal" │ │ - │ └── • 12 Mutation operations + │ └── • 14 Mutation operations │ │ │ ├── • MakeWriteOnlyColumnDeleteOnly │ │ ColumnID: 3 @@ -439,10 +448,30 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN k CASCADE; │ │ IndexID: 4 │ │ 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 + │ │ │ ├── • MakeWriteOnlyIndexDeleteOnly │ │ IndexID: 2 │ │ TableID: 104 │ │ + │ ├── • SetIndexName + │ │ IndexID: 2 + │ │ Name: crdb_internal_index_2_name_placeholder + │ │ TableID: 104 + │ │ │ ├── • MakeValidatedPrimaryIndexPublic │ │ EventBase: │ │ Authorization: @@ -461,7 +490,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN k CASCADE; │ └── • UpdateSchemaChangerJob │ IsNonCancelable: true │ JobID: 1 - │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 5 MutationType ops pending + │ RunningStatus: PostCommitNonRevertiblePhase stage 2 of 3 with 4 MutationType ops pending │ ├── • Stage 2 of 3 in PostCommitNonRevertiblePhase │ │ @@ -530,22 +559,7 @@ EXPLAIN (ddl, verbose) ALTER TABLE t DROP COLUMN k CASCADE; │ │ └── • Precedence dependency from ABSENT IndexName:{DescID: 104, Name: t_expr_k_idx, IndexID: 2} │ │ rule: "dependents removed before index" │ │ - │ └── • 7 Mutation operations - │ │ - │ ├── • 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 + │ └── • 6 Mutation operations │ │ │ ├── • MakeIndexAbsent │ │ IndexID: 2