From f5e74cccd5b5542b1970a87d456a322fe3c862ac Mon Sep 17 00:00:00 2001 From: Andrew Werner Date: Tue, 16 Aug 2022 01:02:10 -0400 Subject: [PATCH] sql/schemachanger: add back TXN_DROPPED, stop using OFFLINE We added the `OFFLINE` and performed write operations during drops to move the descriptor into that state in order to deal with the fact that synthetically dropped descriptors would not appear so in virtual tables. Fortunately, this shortcoming has been rectified. We now revive the TXN_DROPPED state. This proves to be important because the `OFFLINE` state is not backwards compatible, and the `TXN_DROPPED` state is. Ideally we'd find a way to move the descriptors straight to `DROPPED` in the pre-commit case for all the cases we today support, but doing that would require an overhaul of the dependency rules which,at this point in the cycle, feels risky. Fixes #86626 Release justification: Fixes a release-blocking backwards incompatibility. Release note: None --- .../testdata/benchmark_expectations | 26 +-- .../drop_database_multiregion_primary_region | 166 +++--------------- .../end_to_end/drop_table_multiregion | 43 +---- .../drop_table_multiregion_primary_region | 43 +---- .../drop_database_multiregion_primary_region | 132 +++++++------- .../testdata/explain/drop_table_multiregion | 66 +++---- .../drop_table_multiregion_primary_region | 52 +++--- .../drop_database_multiregion_primary_region | 35 ++-- .../explain_verbose/drop_table_multiregion | 7 +- .../drop_table_multiregion_primary_region | 7 +- .../testdata/logic_test/new_schema_changer | 23 ++- pkg/sql/schemachanger/scdeps/exec_deps.go | 4 + .../scdeps/sctestdeps/test_deps.go | 9 + .../scdeps/sctestdeps/test_state.go | 5 +- pkg/sql/schemachanger/scexec/dependencies.go | 7 + pkg/sql/schemachanger/scexec/exec_mutation.go | 15 ++ .../scexec/mocks_generated_test.go | 12 ++ .../scexec/scmutationexec/dependencies.go | 2 + .../scexec/scmutationexec/drop.go | 7 +- pkg/sql/schemachanger/scop/mutation.go | 6 +- .../scop/mutation_visitor_generated.go | 6 +- pkg/sql/schemachanger/scpb/scpb.proto | 7 +- .../scplan/internal/opgen/opgen_alias_type.go | 9 +- .../scplan/internal/opgen/opgen_database.go | 9 +- .../scplan/internal/opgen/opgen_enum_type.go | 9 +- .../scplan/internal/opgen/opgen_schema.go | 9 +- .../scplan/internal/opgen/opgen_sequence.go | 9 +- .../scplan/internal/opgen/opgen_table.go | 9 +- .../scplan/internal/opgen/opgen_view.go | 9 +- .../scplan/internal/rules/assertions_test.go | 2 +- .../scplan/testdata/alter_table_drop_column | 14 +- .../scplan/testdata/drop_database | 98 +++++------ .../schemachanger/scplan/testdata/drop_index | 7 +- .../scplan/testdata/drop_owned_by | 63 +++---- .../schemachanger/scplan/testdata/drop_schema | 70 ++++---- .../scplan/testdata/drop_sequence | 14 +- .../schemachanger/scplan/testdata/drop_table | 28 ++- .../schemachanger/scplan/testdata/drop_type | 14 +- .../schemachanger/scplan/testdata/drop_view | 42 ++--- .../testdata/end_to_end/drop_schema | 30 +--- .../testdata/end_to_end/drop_table | 43 +---- .../testdata/explain/drop_schema | 16 +- .../schemachanger/testdata/explain/drop_table | 72 ++++---- .../testdata/explain_verbose/drop_schema | 7 +- .../testdata/explain_verbose/drop_table | 7 +- 45 files changed, 529 insertions(+), 741 deletions(-) diff --git a/pkg/bench/rttanalysis/testdata/benchmark_expectations b/pkg/bench/rttanalysis/testdata/benchmark_expectations index bdfdb1772794..9c448964a81a 100644 --- a/pkg/bench/rttanalysis/testdata/benchmark_expectations +++ b/pkg/bench/rttanalysis/testdata/benchmark_expectations @@ -31,22 +31,22 @@ exp,benchmark 16,CreateRole/create_role_with_2_options 19,CreateRole/create_role_with_3_options 14,CreateRole/create_role_with_no_options -15,DropDatabase/drop_database_0_tables -17,DropDatabase/drop_database_1_table -19,DropDatabase/drop_database_2_tables -21,DropDatabase/drop_database_3_tables +13,DropDatabase/drop_database_0_tables +15,DropDatabase/drop_database_1_table +17,DropDatabase/drop_database_2_tables +19,DropDatabase/drop_database_3_tables 19,DropRole/drop_1_role 27,DropRole/drop_2_roles 35,DropRole/drop_3_roles -17,DropSequence/drop_1_sequence -19,DropSequence/drop_2_sequences -21,DropSequence/drop_3_sequences -18,DropTable/drop_1_table -21,DropTable/drop_2_tables -24,DropTable/drop_3_tables -19,DropView/drop_1_view -20,DropView/drop_2_views -20,DropView/drop_3_views +15,DropSequence/drop_1_sequence +17,DropSequence/drop_2_sequences +19,DropSequence/drop_3_sequences +16,DropTable/drop_1_table +19,DropTable/drop_2_tables +22,DropTable/drop_3_tables +17,DropView/drop_1_view +18,DropView/drop_2_views +18,DropView/drop_3_views 13,Grant/grant_all_on_1_table 14,Grant/grant_all_on_2_tables 14,Grant/grant_all_on_3_tables diff --git a/pkg/ccl/schemachangerccl/testdata/end_to_end/drop_database_multiregion_primary_region b/pkg/ccl/schemachangerccl/testdata/end_to_end/drop_database_multiregion_primary_region index 0959657c4b31..fedc118447bf 100644 --- a/pkg/ccl/schemachangerccl/testdata/end_to_end/drop_database_multiregion_primary_region +++ b/pkg/ccl/schemachangerccl/testdata/end_to_end/drop_database_multiregion_primary_region @@ -19,94 +19,11 @@ begin transaction #1 checking for feature: DROP DATABASE increment telemetry for sql.schema.drop_database ## StatementPhase stage 1 of 1 with 5 MutationType ops -upsert descriptor #104 - database: - id: 104 - - modificationTime: - - wallTime: "1640995200000000000" - + modificationTime: {} - name: multi_region_test_db - + offlineReason: DROP DATABASE multi_region_test_db CASCADE - privileges: - ownerProto: root - ... - public: - id: 106 - - version: "1" - + state: OFFLINE - + version: "2" -upsert descriptor #105 - ... - id: 105 - kind: MULTIREGION_ENUM - - modificationTime: - - wallTime: "1640995200000000000" - + modificationTime: {} - name: crdb_internal_region - + offlineReason: DROP DATABASE multi_region_test_db CASCADE - parentId: 104 - parentSchemaId: 106 - ... - primaryRegion: us-east1 - zoneConfigExtensions: {} - - version: "2" - + state: OFFLINE - + version: "3" -upsert descriptor #106 - schema: - id: 106 - - modificationTime: - - wallTime: "1640995200000000000" - + modificationTime: {} - name: public - + offlineReason: DROP DATABASE multi_region_test_db CASCADE - parentId: 104 - privileges: - ... - withGrantOption: 2 - version: 2 - - version: "1" - + state: OFFLINE - + version: "2" -upsert descriptor #107 - ... - id: 107 - kind: ALIAS - - modificationTime: - - wallTime: "1640995200000000000" - + modificationTime: {} - name: _crdb_internal_region - + offlineReason: DROP DATABASE multi_region_test_db CASCADE - parentId: 104 - parentSchemaId: 106 - ... - withGrantOption: 2 - version: 2 - - version: "1" - + state: OFFLINE - + version: "2" -upsert descriptor #108 - ... - regionalByTable: - region: us-east2 - - modificationTime: - - wallTime: "1640995200000000000" - + modificationTime: {} - name: table_regional_by_table - nextColumnId: 2 - ... - nextIndexId: 2 - nextMutationId: 1 - + offlineReason: DROP DATABASE multi_region_test_db CASCADE - parentId: 104 - primaryIndex: - ... - replacementOf: - time: {} - + state: OFFLINE - unexposedParentSchemaId: 106 - - version: "1" - + version: "2" +added synthetic descriptor: name:"multi_region_test_db" id:104 modification_time:<> version:2 privileges: users: users: owner_proto:"root" version:2 > schemas: > state:DROP offline_reason:"" region_config: +added synthetic descriptor: name:"crdb_internal_region" id:105 version:3 modification_time:<> privileges: users: users: owner_proto:"root" version:2 > parent_id:104 parent_schema_id:106 array_type_id:107 state:DROP offline_reason:"" kind:MULTIREGION_ENUM referencing_descriptor_ids:108 enum_members: enum_members: enum_members: region_config: secondary_region:"" > +added synthetic descriptor: name:"public" id:106 state:DROP offline_reason:"" modification_time:<> version:2 parent_id:104 privileges: users: users: owner_proto:"admin" version:2 > +added synthetic descriptor: name:"_crdb_internal_region" id:107 version:2 modification_time:<> privileges: users: users: owner_proto:"root" version:2 > parent_id:104 parent_schema_id:106 array_type_id:0 state:DROP offline_reason:"" kind:ALIAS alias: > time_precision_is_set: false > +added synthetic descriptor: name:"table_regional_by_table" id:108 version:2 modification_time:<> parent_id:104 unexposed_parent_schema_id:106 columns: nullable:false hidden:false inaccessible:false generated_as_identity_type:NOT_IDENTITY_COLUMN virtual:false pg_attribute_num:0 alter_column_type_in_progress:false system_column_kind:NONE > next_column_id:2 families: next_family_id:1 primary_index: interleave:<> partitioning: type:FORWARD created_explicitly:false encoding_type:1 sharded: disabled:false geo_config:<> predicate:"" use_delete_preserving_encoding:false created_at_nanos:1640995200000000000 constraint_id:1 not_visible:false > next_index_id:2 privileges: users: owner_proto:"root" version:2 > next_mutation_id:1 format_version:3 state:DROP offline_reason:"" view_query:"" is_materialized_view:false refresh_view_required:false drop_time:0 replacement_of: > audit_mode:DISABLED drop_job_id:0 create_query:"" create_as_of_time: temporary:false locality_config: > partition_all_by:false exclude_data_from_backup:false next_constraint_id:2 import_start_wall_time:0 # end StatementPhase # begin PreCommitPhase ## PreCommitPhase stage 1 of 1 with 6 MutationType ops @@ -125,12 +42,12 @@ upsert descriptor #104 + targetRanks: + targets: id: 104 - - modificationTime: {} - + modificationTime: - + wallTime: "1640995200000000001" - name: multi_region_test_db - offlineReason: DROP DATABASE multi_region_test_db CASCADE + modificationTime: {} ... + public: + id: 106 + - state: DROP + version: "2" upsert descriptor #105 type: arrayTypeId: 107 @@ -149,14 +66,10 @@ upsert descriptor #105 enumMembers: - logicalRepresentation: us-east1 ... - id: 105 - kind: MULTIREGION_ENUM - - modificationTime: {} - + modificationTime: - + wallTime: "1640995200000000001" - name: crdb_internal_region - offlineReason: DROP DATABASE multi_region_test_db CASCADE - ... + primaryRegion: us-east1 + zoneConfigExtensions: {} + - state: DROP + version: "3" upsert descriptor #106 schema: + declarativeSchemaChangerState: @@ -172,12 +85,12 @@ upsert descriptor #106 + targetRanks: + targets: id: 106 - - modificationTime: {} - + modificationTime: - + wallTime: "1640995200000000001" - name: public - offlineReason: DROP DATABASE multi_region_test_db CASCADE + modificationTime: {} ... + withGrantOption: 2 + version: 2 + - state: DROP + version: "2" upsert descriptor #107 ... family: ArrayFamily @@ -196,12 +109,11 @@ upsert descriptor #107 + targets: id: 107 kind: ALIAS - - modificationTime: {} - + modificationTime: - + wallTime: "1640995200000000001" - name: _crdb_internal_region - offlineReason: DROP DATABASE multi_region_test_db CASCADE ... + withGrantOption: 2 + version: 2 + - state: DROP + version: "2" upsert descriptor #108 ... createAsOfTime: @@ -221,14 +133,11 @@ upsert descriptor #108 families: - columnIds: ... - regionalByTable: - region: us-east2 - - modificationTime: {} - + modificationTime: - + wallTime: "1640995200000000001" - name: table_regional_by_table - nextColumnId: 2 - ... + replacementOf: + time: {} + - state: DROP + unexposedParentSchemaId: 106 + version: "2" create job #1 (non-cancelable: true): "DROP DATABASE multi_region_test_db CASCADE" descriptor IDs: [104 105 106 107 108] # end PreCommitPhase @@ -252,13 +161,10 @@ upsert descriptor #104 - wallTime: "1640995200000000001" + modificationTime: {} name: multi_region_test_db - - offlineReason: DROP DATABASE multi_region_test_db CASCADE privileges: - ownerProto: root ... public: id: 106 - - state: OFFLINE - version: "2" + state: DROP + version: "3" @@ -270,13 +176,10 @@ upsert descriptor #105 - wallTime: "1640995200000000001" + modificationTime: {} name: crdb_internal_region - - offlineReason: DROP DATABASE multi_region_test_db CASCADE parentId: 104 - parentSchemaId: 106 ... primaryRegion: us-east1 zoneConfigExtensions: {} - - state: OFFLINE - version: "3" + state: DROP + version: "4" @@ -288,13 +191,10 @@ upsert descriptor #106 - wallTime: "1640995200000000001" + modificationTime: {} name: public - - offlineReason: DROP DATABASE multi_region_test_db CASCADE parentId: 104 - privileges: ... withGrantOption: 2 version: 2 - - state: OFFLINE - version: "2" + state: DROP + version: "3" @@ -306,13 +206,10 @@ upsert descriptor #107 - wallTime: "1640995200000000001" + modificationTime: {} name: _crdb_internal_region - - offlineReason: DROP DATABASE multi_region_test_db CASCADE parentId: 104 - parentSchemaId: 106 ... withGrantOption: 2 version: 2 - - state: OFFLINE - version: "2" + state: DROP + version: "3" @@ -331,16 +228,9 @@ upsert descriptor #108 + modificationTime: {} name: table_regional_by_table nextColumnId: 2 - ... - nextIndexId: 2 - nextMutationId: 1 - - offlineReason: DROP DATABASE multi_region_test_db CASCADE - parentId: 104 - primaryIndex: ... replacementOf: time: {} - - state: OFFLINE + state: DROP unexposedParentSchemaId: 106 - version: "2" diff --git a/pkg/ccl/schemachangerccl/testdata/end_to_end/drop_table_multiregion b/pkg/ccl/schemachangerccl/testdata/end_to_end/drop_table_multiregion index 9614c8d31349..4b00027acf0b 100644 --- a/pkg/ccl/schemachangerccl/testdata/end_to_end/drop_table_multiregion +++ b/pkg/ccl/schemachangerccl/testdata/end_to_end/drop_table_multiregion @@ -19,28 +19,7 @@ begin transaction #1 checking for feature: DROP TABLE increment telemetry for sql.schema.drop_table ## StatementPhase stage 1 of 1 with 1 MutationType op -upsert descriptor #108 - ... - localityConfig: - regionalByRow: {} - - modificationTime: - - wallTime: "1640995200000000000" - + modificationTime: {} - name: table_regional_by_row - nextColumnId: 3 - ... - nextIndexId: 2 - nextMutationId: 1 - + offlineReason: DROP TABLE multi_region_test_db.public.table_regional_by_row - parentId: 104 - partitionAllBy: true - ... - replacementOf: - time: {} - + state: OFFLINE - unexposedParentSchemaId: 106 - - version: "1" - + version: "2" +added synthetic descriptor: name:"table_regional_by_row" id:108 version:2 modification_time:<> parent_id:104 unexposed_parent_schema_id:106 columns: nullable:false hidden:false inaccessible:false generated_as_identity_type:NOT_IDENTITY_COLUMN virtual:false pg_attribute_num:0 alter_column_type_in_progress:false system_column_kind:NONE > columns: > nullable:false default_expr:"default_to_database_primary_region(gateway_region())::@100105" hidden:true inaccessible:false generated_as_identity_type:NOT_IDENTITY_COLUMN virtual:false pg_attribute_num:0 alter_column_type_in_progress:false system_column_kind:NONE > next_column_id:3 families: next_family_id:1 primary_index: interleave:<> partitioning: > list: > list: > > type:FORWARD created_explicitly:false encoding_type:1 sharded: disabled:false geo_config:<> predicate:"" use_delete_preserving_encoding:false created_at_nanos:1640995200000000000 constraint_id:1 not_visible:false > next_index_id:2 privileges: users: owner_proto:"root" version:2 > next_mutation_id:1 format_version:3 state:DROP offline_reason:"" view_query:"" is_materialized_view:false refresh_view_required:false drop_time:0 replacement_of: > audit_mode:DISABLED drop_job_id:0 create_query:"" create_as_of_time: temporary:false locality_config: > partition_all_by:true exclude_data_from_backup:false next_constraint_id:2 import_start_wall_time:0 # end StatementPhase # begin PreCommitPhase ## PreCommitPhase stage 1 of 1 with 4 MutationType ops @@ -105,14 +84,11 @@ upsert descriptor #108 families: - columnIds: ... - localityConfig: - regionalByRow: {} - - modificationTime: {} - + modificationTime: - + wallTime: "1640995200000000001" - name: table_regional_by_row - nextColumnId: 3 - ... + replacementOf: + time: {} + - state: DROP + unexposedParentSchemaId: 106 + version: "2" create job #1 (non-cancelable: true): "DROP TABLE multi_region_test_db.public.table_regional_by_row" descriptor IDs: [105 107 108] # end PreCommitPhase @@ -174,16 +150,9 @@ upsert descriptor #108 + modificationTime: {} name: table_regional_by_row nextColumnId: 3 - ... - nextIndexId: 2 - nextMutationId: 1 - - offlineReason: DROP TABLE multi_region_test_db.public.table_regional_by_row - parentId: 104 - partitionAllBy: true ... replacementOf: time: {} - - state: OFFLINE + state: DROP unexposedParentSchemaId: 106 - version: "2" diff --git a/pkg/ccl/schemachangerccl/testdata/end_to_end/drop_table_multiregion_primary_region b/pkg/ccl/schemachangerccl/testdata/end_to_end/drop_table_multiregion_primary_region index f559d0ec7d16..11363952b0ca 100644 --- a/pkg/ccl/schemachangerccl/testdata/end_to_end/drop_table_multiregion_primary_region +++ b/pkg/ccl/schemachangerccl/testdata/end_to_end/drop_table_multiregion_primary_region @@ -19,28 +19,7 @@ begin transaction #1 checking for feature: DROP TABLE increment telemetry for sql.schema.drop_table ## StatementPhase stage 1 of 1 with 1 MutationType op -upsert descriptor #108 - ... - regionalByTable: - region: us-east2 - - modificationTime: - - wallTime: "1640995200000000000" - + modificationTime: {} - name: table_regional_by_table - nextColumnId: 2 - ... - nextIndexId: 2 - nextMutationId: 1 - + offlineReason: DROP TABLE multi_region_test_db.public.table_regional_by_table CASCADE - parentId: 104 - primaryIndex: - ... - replacementOf: - time: {} - + state: OFFLINE - unexposedParentSchemaId: 106 - - version: "1" - + version: "2" +added synthetic descriptor: name:"table_regional_by_table" id:108 version:2 modification_time:<> parent_id:104 unexposed_parent_schema_id:106 columns: nullable:false hidden:false inaccessible:false generated_as_identity_type:NOT_IDENTITY_COLUMN virtual:false pg_attribute_num:0 alter_column_type_in_progress:false system_column_kind:NONE > next_column_id:2 families: next_family_id:1 primary_index: interleave:<> partitioning: type:FORWARD created_explicitly:false encoding_type:1 sharded: disabled:false geo_config:<> predicate:"" use_delete_preserving_encoding:false created_at_nanos:1640995200000000000 constraint_id:1 not_visible:false > next_index_id:2 privileges: users: owner_proto:"root" version:2 > next_mutation_id:1 format_version:3 state:DROP offline_reason:"" view_query:"" is_materialized_view:false refresh_view_required:false drop_time:0 replacement_of: > audit_mode:DISABLED drop_job_id:0 create_query:"" create_as_of_time: temporary:false locality_config: > partition_all_by:false exclude_data_from_backup:false next_constraint_id:2 import_start_wall_time:0 # end StatementPhase # begin PreCommitPhase ## PreCommitPhase stage 1 of 1 with 3 MutationType ops @@ -87,14 +66,11 @@ upsert descriptor #108 families: - columnIds: ... - regionalByTable: - region: us-east2 - - modificationTime: {} - + modificationTime: - + wallTime: "1640995200000000001" - name: table_regional_by_table - nextColumnId: 2 - ... + replacementOf: + time: {} + - state: DROP + unexposedParentSchemaId: 106 + version: "2" create job #1 (non-cancelable: true): "DROP TABLE multi_region_test_db.public.table_regional_by_table CASCADE" descriptor IDs: [105 108] # end PreCommitPhase @@ -140,16 +116,9 @@ upsert descriptor #108 + modificationTime: {} name: table_regional_by_table nextColumnId: 2 - ... - nextIndexId: 2 - nextMutationId: 1 - - offlineReason: DROP TABLE multi_region_test_db.public.table_regional_by_table CASCADE - parentId: 104 - primaryIndex: ... replacementOf: time: {} - - state: OFFLINE + state: DROP unexposedParentSchemaId: 106 - version: "2" diff --git a/pkg/ccl/schemachangerccl/testdata/explain/drop_database_multiregion_primary_region b/pkg/ccl/schemachangerccl/testdata/explain/drop_database_multiregion_primary_region index 130e5c8346b7..92bbc2d28595 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain/drop_database_multiregion_primary_region +++ b/pkg/ccl/schemachangerccl/testdata/explain/drop_database_multiregion_primary_region @@ -11,21 +11,21 @@ Schema change plan for DROP DATABASE ‹multi_region_test_db› CASCADE; ├── StatementPhase │ └── Stage 1 of 1 in StatementPhase │ ├── 9 elements transitioning toward ABSENT - │ │ ├── PUBLIC → OFFLINE Database:{DescID: 104} - │ │ ├── PUBLIC → OFFLINE Schema:{DescID: 106} - │ │ ├── PUBLIC → OFFLINE EnumType:{DescID: 105} - │ │ ├── PUBLIC → OFFLINE AliasType:{DescID: 107} - │ │ ├── PUBLIC → OFFLINE Table:{DescID: 108} - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 108, ColumnID: 1} - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967295} - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967294} - │ │ └── PUBLIC → VALIDATED PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} + │ │ ├── PUBLIC → TXN_DROPPED Database:{DescID: 104} + │ │ ├── PUBLIC → TXN_DROPPED Schema:{DescID: 106} + │ │ ├── PUBLIC → TXN_DROPPED EnumType:{DescID: 105} + │ │ ├── PUBLIC → TXN_DROPPED AliasType:{DescID: 107} + │ │ ├── PUBLIC → TXN_DROPPED Table:{DescID: 108} + │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 108, ColumnID: 1} + │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967295} + │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967294} + │ │ └── PUBLIC → VALIDATED PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} │ └── 5 Mutation operations - │ ├── MarkDescriptorAsOffline {"DescID":104,"Reason":"DROP DATABASE mu..."} - │ ├── MarkDescriptorAsOffline {"DescID":106,"Reason":"DROP DATABASE mu..."} - │ ├── MarkDescriptorAsOffline {"DescID":105,"Reason":"DROP DATABASE mu..."} - │ ├── MarkDescriptorAsOffline {"DescID":107,"Reason":"DROP DATABASE mu..."} - │ └── MarkDescriptorAsOffline {"DescID":108,"Reason":"DROP DATABASE mu..."} + │ ├── MarkDescriptorAsSyntheticallyDropped {"DescID":104} + │ ├── MarkDescriptorAsSyntheticallyDropped {"DescID":106} + │ ├── MarkDescriptorAsSyntheticallyDropped {"DescID":105} + │ ├── MarkDescriptorAsSyntheticallyDropped {"DescID":107} + │ └── MarkDescriptorAsSyntheticallyDropped {"DescID":108} ├── PreCommitPhase │ └── Stage 1 of 1 in PreCommitPhase │ └── 6 Mutation operations @@ -38,58 +38,58 @@ Schema change plan for DROP DATABASE ‹multi_region_test_db› CASCADE; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase │ ├── 52 elements transitioning toward ABSENT - │ │ ├── PUBLIC → ABSENT Namespace:{DescID: 104, Name: multi_region_test_db, ReferencedDescID: 0} - │ │ ├── PUBLIC → ABSENT Owner:{DescID: 104} - │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 104, Name: admin} - │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 104, Name: public} - │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 104, Name: root} - │ │ ├── OFFLINE → DROPPED Database:{DescID: 104} - │ │ ├── PUBLIC → ABSENT DatabaseRoleSetting:{DescID: 104, Name: __placeholder_role_name__} - │ │ ├── PUBLIC → ABSENT DatabaseRegionConfig:{DescID: 104, ReferencedDescID: 105} - │ │ ├── PUBLIC → ABSENT Namespace:{DescID: 106, Name: public, ReferencedDescID: 104} - │ │ ├── PUBLIC → ABSENT Owner:{DescID: 106} - │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 106, Name: admin} - │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 106, Name: public} - │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 106, Name: root} - │ │ ├── OFFLINE → DROPPED Schema:{DescID: 106} - │ │ ├── PUBLIC → ABSENT SchemaParent:{DescID: 106, ReferencedDescID: 104} - │ │ ├── PUBLIC → ABSENT Namespace:{DescID: 105, Name: crdb_internal_region, ReferencedDescID: 104} - │ │ ├── PUBLIC → ABSENT Owner:{DescID: 105} - │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 105, Name: admin} - │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 105, Name: public} - │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 105, Name: root} - │ │ ├── OFFLINE → DROPPED EnumType:{DescID: 105} - │ │ ├── PUBLIC → ABSENT EnumTypeValue:{DescID: 105, Name: us-east1} - │ │ ├── PUBLIC → ABSENT EnumTypeValue:{DescID: 105, Name: us-east2} - │ │ ├── PUBLIC → ABSENT EnumTypeValue:{DescID: 105, Name: us-east3} - │ │ ├── PUBLIC → ABSENT ObjectParent:{DescID: 105, ReferencedDescID: 106} - │ │ ├── PUBLIC → ABSENT Namespace:{DescID: 107, Name: _crdb_internal_region, ReferencedDescID: 104} - │ │ ├── PUBLIC → ABSENT Owner:{DescID: 107} - │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 107, Name: admin} - │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 107, Name: public} - │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 107, Name: root} - │ │ ├── OFFLINE → DROPPED AliasType:{DescID: 107} - │ │ ├── PUBLIC → ABSENT ObjectParent:{DescID: 107, ReferencedDescID: 106} - │ │ ├── PUBLIC → ABSENT Namespace:{DescID: 108, Name: table_regional_by_table, ReferencedDescID: 104} - │ │ ├── PUBLIC → ABSENT Owner:{DescID: 108} - │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 108, Name: admin} - │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 108, Name: root} - │ │ ├── OFFLINE → DROPPED Table:{DescID: 108} - │ │ ├── PUBLIC → ABSENT ObjectParent:{DescID: 108, ReferencedDescID: 106} - │ │ ├── PUBLIC → ABSENT TableLocalitySecondaryRegion:{DescID: 108, ReferencedDescID: 105} - │ │ ├── PUBLIC → ABSENT ColumnFamily:{DescID: 108, Name: primary, ColumnFamilyID: 0} - │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 108, ColumnID: 1} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 108, Name: a, ColumnID: 1} - │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 1} - │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 108, ColumnID: 4294967295} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 108, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295} - │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 4294967295} - │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 108, ColumnID: 4294967294} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 108, Name: tableoid, ColumnID: 4294967294} - │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 4294967294} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 108, ColumnID: 1, IndexID: 1} - │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} - │ │ └── PUBLIC → ABSENT IndexName:{DescID: 108, Name: table_regional_by_table_pkey, IndexID: 1} + │ │ ├── PUBLIC → ABSENT Namespace:{DescID: 104, Name: multi_region_test_db, ReferencedDescID: 0} + │ │ ├── PUBLIC → ABSENT Owner:{DescID: 104} + │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 104, Name: admin} + │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 104, Name: public} + │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 104, Name: root} + │ │ ├── TXN_DROPPED → DROPPED Database:{DescID: 104} + │ │ ├── PUBLIC → ABSENT DatabaseRoleSetting:{DescID: 104, Name: __placeholder_role_name__} + │ │ ├── PUBLIC → ABSENT DatabaseRegionConfig:{DescID: 104, ReferencedDescID: 105} + │ │ ├── PUBLIC → ABSENT Namespace:{DescID: 106, Name: public, ReferencedDescID: 104} + │ │ ├── PUBLIC → ABSENT Owner:{DescID: 106} + │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 106, Name: admin} + │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 106, Name: public} + │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 106, Name: root} + │ │ ├── TXN_DROPPED → DROPPED Schema:{DescID: 106} + │ │ ├── PUBLIC → ABSENT SchemaParent:{DescID: 106, ReferencedDescID: 104} + │ │ ├── PUBLIC → ABSENT Namespace:{DescID: 105, Name: crdb_internal_region, ReferencedDescID: 104} + │ │ ├── PUBLIC → ABSENT Owner:{DescID: 105} + │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 105, Name: admin} + │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 105, Name: public} + │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 105, Name: root} + │ │ ├── TXN_DROPPED → DROPPED EnumType:{DescID: 105} + │ │ ├── PUBLIC → ABSENT EnumTypeValue:{DescID: 105, Name: us-east1} + │ │ ├── PUBLIC → ABSENT EnumTypeValue:{DescID: 105, Name: us-east2} + │ │ ├── PUBLIC → ABSENT EnumTypeValue:{DescID: 105, Name: us-east3} + │ │ ├── PUBLIC → ABSENT ObjectParent:{DescID: 105, ReferencedDescID: 106} + │ │ ├── PUBLIC → ABSENT Namespace:{DescID: 107, Name: _crdb_internal_region, ReferencedDescID: 104} + │ │ ├── PUBLIC → ABSENT Owner:{DescID: 107} + │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 107, Name: admin} + │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 107, Name: public} + │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 107, Name: root} + │ │ ├── TXN_DROPPED → DROPPED AliasType:{DescID: 107} + │ │ ├── PUBLIC → ABSENT ObjectParent:{DescID: 107, ReferencedDescID: 106} + │ │ ├── PUBLIC → ABSENT Namespace:{DescID: 108, Name: table_regional_by_table, ReferencedDescID: 104} + │ │ ├── PUBLIC → ABSENT Owner:{DescID: 108} + │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 108, Name: admin} + │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 108, Name: root} + │ │ ├── TXN_DROPPED → DROPPED Table:{DescID: 108} + │ │ ├── PUBLIC → ABSENT ObjectParent:{DescID: 108, ReferencedDescID: 106} + │ │ ├── PUBLIC → ABSENT TableLocalitySecondaryRegion:{DescID: 108, ReferencedDescID: 105} + │ │ ├── PUBLIC → ABSENT ColumnFamily:{DescID: 108, Name: primary, ColumnFamilyID: 0} + │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 108, ColumnID: 1} + │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 108, Name: a, ColumnID: 1} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 1} + │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 108, ColumnID: 4294967295} + │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 108, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 4294967295} + │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 108, ColumnID: 4294967294} + │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 108, Name: tableoid, ColumnID: 4294967294} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 4294967294} + │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 108, ColumnID: 1, IndexID: 1} + │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} + │ │ └── PUBLIC → ABSENT IndexName:{DescID: 108, Name: table_regional_by_table_pkey, IndexID: 1} │ └── 20 Mutation operations │ ├── MarkDescriptorAsDropped {"DescID":104} │ ├── RemoveDatabaseRoleSettings {"DatabaseID":104} diff --git a/pkg/ccl/schemachangerccl/testdata/explain/drop_table_multiregion b/pkg/ccl/schemachangerccl/testdata/explain/drop_table_multiregion index 2170e4d25738..4fe14de4e023 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain/drop_table_multiregion +++ b/pkg/ccl/schemachangerccl/testdata/explain/drop_table_multiregion @@ -11,14 +11,14 @@ Schema change plan for DROP TABLE ‹multi_region_test_db›.‹public›.‹tab ├── StatementPhase │ └── Stage 1 of 1 in StatementPhase │ ├── 6 elements transitioning toward ABSENT - │ │ ├── PUBLIC → OFFLINE Table:{DescID: 108} - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 108, ColumnID: 1} - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 108, ColumnID: 2} - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967295} - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967294} - │ │ └── PUBLIC → VALIDATED PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} + │ │ ├── PUBLIC → TXN_DROPPED Table:{DescID: 108} + │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 108, ColumnID: 1} + │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 108, ColumnID: 2} + │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967295} + │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967294} + │ │ └── PUBLIC → VALIDATED PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} │ └── 1 Mutation operation - │ └── MarkDescriptorAsOffline {"DescID":108,"Reason":"DROP TABLE multi..."} + │ └── MarkDescriptorAsSyntheticallyDropped {"DescID":108} ├── PreCommitPhase │ └── Stage 1 of 1 in PreCommitPhase │ └── 4 Mutation operations @@ -29,32 +29,32 @@ Schema change plan for DROP TABLE ‹multi_region_test_db›.‹public›.‹tab └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase │ ├── 26 elements transitioning toward ABSENT - │ │ ├── PUBLIC → ABSENT Namespace:{DescID: 108, Name: table_regional_by_row, ReferencedDescID: 104} - │ │ ├── PUBLIC → ABSENT Owner:{DescID: 108} - │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 108, Name: admin} - │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 108, Name: root} - │ │ ├── OFFLINE → DROPPED Table:{DescID: 108} - │ │ ├── PUBLIC → ABSENT ObjectParent:{DescID: 108, ReferencedDescID: 106} - │ │ ├── PUBLIC → ABSENT TableLocalityRegionalByRow:{DescID: 108} - │ │ ├── PUBLIC → ABSENT ColumnFamily:{DescID: 108, Name: primary, ColumnFamilyID: 0} - │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 108, ColumnID: 1} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 108, Name: k, ColumnID: 1} - │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 1} - │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 108, ColumnID: 2} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 108, Name: crdb_region, ColumnID: 2} - │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 2} - │ │ ├── PUBLIC → ABSENT ColumnDefaultExpression:{DescID: 108, ColumnID: 2} - │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 108, ColumnID: 4294967295} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 108, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295} - │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 4294967295} - │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 108, ColumnID: 4294967294} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 108, Name: tableoid, ColumnID: 4294967294} - │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 4294967294} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 108, ColumnID: 2, IndexID: 1} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 108, ColumnID: 1, IndexID: 1} - │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} - │ │ ├── PUBLIC → ABSENT IndexPartitioning:{DescID: 108, IndexID: 1} - │ │ └── PUBLIC → ABSENT IndexName:{DescID: 108, Name: table_regional_by_row_pkey, IndexID: 1} + │ │ ├── PUBLIC → ABSENT Namespace:{DescID: 108, Name: table_regional_by_row, ReferencedDescID: 104} + │ │ ├── PUBLIC → ABSENT Owner:{DescID: 108} + │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 108, Name: admin} + │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 108, Name: root} + │ │ ├── TXN_DROPPED → DROPPED Table:{DescID: 108} + │ │ ├── PUBLIC → ABSENT ObjectParent:{DescID: 108, ReferencedDescID: 106} + │ │ ├── PUBLIC → ABSENT TableLocalityRegionalByRow:{DescID: 108} + │ │ ├── PUBLIC → ABSENT ColumnFamily:{DescID: 108, Name: primary, ColumnFamilyID: 0} + │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 108, ColumnID: 1} + │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 108, Name: k, ColumnID: 1} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 1} + │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 108, ColumnID: 2} + │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 108, Name: crdb_region, ColumnID: 2} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 2} + │ │ ├── PUBLIC → ABSENT ColumnDefaultExpression:{DescID: 108, ColumnID: 2} + │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 108, ColumnID: 4294967295} + │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 108, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 4294967295} + │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 108, ColumnID: 4294967294} + │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 108, Name: tableoid, ColumnID: 4294967294} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 4294967294} + │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 108, ColumnID: 2, IndexID: 1} + │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 108, ColumnID: 1, IndexID: 1} + │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} + │ │ ├── PUBLIC → ABSENT IndexPartitioning:{DescID: 108, IndexID: 1} + │ │ └── PUBLIC → ABSENT IndexName:{DescID: 108, Name: table_regional_by_row_pkey, IndexID: 1} │ └── 11 Mutation operations │ ├── MarkDescriptorAsDropped {"DescID":108} │ ├── RemoveAllTableComments {"TableID":108} diff --git a/pkg/ccl/schemachangerccl/testdata/explain/drop_table_multiregion_primary_region b/pkg/ccl/schemachangerccl/testdata/explain/drop_table_multiregion_primary_region index 2919846f9d13..369a03a7ffbe 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain/drop_table_multiregion_primary_region +++ b/pkg/ccl/schemachangerccl/testdata/explain/drop_table_multiregion_primary_region @@ -11,13 +11,13 @@ Schema change plan for DROP TABLE ‹multi_region_test_db›.‹public›.‹tab ├── StatementPhase │ └── Stage 1 of 1 in StatementPhase │ ├── 5 elements transitioning toward ABSENT - │ │ ├── PUBLIC → OFFLINE Table:{DescID: 108} - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 108, ColumnID: 1} - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967295} - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967294} - │ │ └── PUBLIC → VALIDATED PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} + │ │ ├── PUBLIC → TXN_DROPPED Table:{DescID: 108} + │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 108, ColumnID: 1} + │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967295} + │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 108, ColumnID: 4294967294} + │ │ └── PUBLIC → VALIDATED PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} │ └── 1 Mutation operation - │ └── MarkDescriptorAsOffline {"DescID":108,"Reason":"DROP TABLE multi..."} + │ └── MarkDescriptorAsSyntheticallyDropped {"DescID":108} ├── PreCommitPhase │ └── Stage 1 of 1 in PreCommitPhase │ └── 3 Mutation operations @@ -27,26 +27,26 @@ Schema change plan for DROP TABLE ‹multi_region_test_db›.‹public›.‹tab └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase │ ├── 20 elements transitioning toward ABSENT - │ │ ├── PUBLIC → ABSENT Namespace:{DescID: 108, Name: table_regional_by_table, ReferencedDescID: 104} - │ │ ├── PUBLIC → ABSENT Owner:{DescID: 108} - │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 108, Name: admin} - │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 108, Name: root} - │ │ ├── OFFLINE → DROPPED Table:{DescID: 108} - │ │ ├── PUBLIC → ABSENT ObjectParent:{DescID: 108, ReferencedDescID: 106} - │ │ ├── PUBLIC → ABSENT TableLocalitySecondaryRegion:{DescID: 108, ReferencedDescID: 105} - │ │ ├── PUBLIC → ABSENT ColumnFamily:{DescID: 108, Name: primary, ColumnFamilyID: 0} - │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 108, ColumnID: 1} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 108, Name: a, ColumnID: 1} - │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 1} - │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 108, ColumnID: 4294967295} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 108, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295} - │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 4294967295} - │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 108, ColumnID: 4294967294} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 108, Name: tableoid, ColumnID: 4294967294} - │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 4294967294} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 108, ColumnID: 1, IndexID: 1} - │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} - │ │ └── PUBLIC → ABSENT IndexName:{DescID: 108, Name: table_regional_by_table_pkey, IndexID: 1} + │ │ ├── PUBLIC → ABSENT Namespace:{DescID: 108, Name: table_regional_by_table, ReferencedDescID: 104} + │ │ ├── PUBLIC → ABSENT Owner:{DescID: 108} + │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 108, Name: admin} + │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 108, Name: root} + │ │ ├── TXN_DROPPED → DROPPED Table:{DescID: 108} + │ │ ├── PUBLIC → ABSENT ObjectParent:{DescID: 108, ReferencedDescID: 106} + │ │ ├── PUBLIC → ABSENT TableLocalitySecondaryRegion:{DescID: 108, ReferencedDescID: 105} + │ │ ├── PUBLIC → ABSENT ColumnFamily:{DescID: 108, Name: primary, ColumnFamilyID: 0} + │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 108, ColumnID: 1} + │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 108, Name: a, ColumnID: 1} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 1} + │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 108, ColumnID: 4294967295} + │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 108, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 4294967295} + │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 108, ColumnID: 4294967294} + │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 108, Name: tableoid, ColumnID: 4294967294} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 108, ColumnFamilyID: 0, ColumnID: 4294967294} + │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 108, ColumnID: 1, IndexID: 1} + │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1} + │ │ └── PUBLIC → ABSENT IndexName:{DescID: 108, Name: table_regional_by_table_pkey, IndexID: 1} │ └── 7 Mutation operations │ ├── MarkDescriptorAsDropped {"DescID":108} │ ├── RemoveAllTableComments {"TableID":108} diff --git a/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_database_multiregion_primary_region b/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_database_multiregion_primary_region index 53bfdcd28f21..7aa126612805 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_database_multiregion_primary_region +++ b/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_database_multiregion_primary_region @@ -16,19 +16,19 @@ EXPLAIN (ddl, verbose) DROP DATABASE multi_region_test_db CASCADE; │ ├── • 9 elements transitioning toward ABSENT │ │ │ │ │ ├── • Database:{DescID: 104} -│ │ │ PUBLIC → OFFLINE +│ │ │ PUBLIC → TXN_DROPPED │ │ │ │ │ ├── • Schema:{DescID: 106} -│ │ │ PUBLIC → OFFLINE +│ │ │ PUBLIC → TXN_DROPPED │ │ │ │ │ ├── • EnumType:{DescID: 105} -│ │ │ PUBLIC → OFFLINE +│ │ │ PUBLIC → TXN_DROPPED │ │ │ │ │ ├── • AliasType:{DescID: 107} -│ │ │ PUBLIC → OFFLINE +│ │ │ PUBLIC → TXN_DROPPED │ │ │ │ │ ├── • Table:{DescID: 108} -│ │ │ PUBLIC → OFFLINE +│ │ │ PUBLIC → TXN_DROPPED │ │ │ │ │ ├── • Column:{DescID: 108, ColumnID: 1} │ │ │ │ PUBLIC → WRITE_ONLY @@ -56,25 +56,20 @@ EXPLAIN (ddl, verbose) DROP DATABASE multi_region_test_db CASCADE; │ │ │ └── • 5 Mutation operations │ │ -│ ├── • MarkDescriptorAsOffline +│ ├── • MarkDescriptorAsSyntheticallyDropped │ │ DescID: 104 -│ │ Reason: DROP DATABASE multi_region_test_db CASCADE │ │ -│ ├── • MarkDescriptorAsOffline +│ ├── • MarkDescriptorAsSyntheticallyDropped │ │ DescID: 106 -│ │ Reason: DROP DATABASE multi_region_test_db CASCADE │ │ -│ ├── • MarkDescriptorAsOffline +│ ├── • MarkDescriptorAsSyntheticallyDropped │ │ DescID: 105 -│ │ Reason: DROP DATABASE multi_region_test_db CASCADE │ │ -│ ├── • MarkDescriptorAsOffline +│ ├── • MarkDescriptorAsSyntheticallyDropped │ │ DescID: 107 -│ │ Reason: DROP DATABASE multi_region_test_db CASCADE │ │ -│ └── • MarkDescriptorAsOffline +│ └── • MarkDescriptorAsSyntheticallyDropped │ DescID: 108 -│ Reason: DROP DATABASE multi_region_test_db CASCADE │ ├── • PreCommitPhase │ │ @@ -169,7 +164,7 @@ EXPLAIN (ddl, verbose) DROP DATABASE multi_region_test_db CASCADE; │ │ │ rule: "skip element removal ops on descriptor drop" │ │ │ │ │ ├── • Database:{DescID: 104} - │ │ │ OFFLINE → DROPPED + │ │ │ TXN_DROPPED → DROPPED │ │ │ │ │ ├── • DatabaseRoleSetting:{DescID: 104, Name: __placeholder_role_name__} │ │ │ │ PUBLIC → ABSENT @@ -232,7 +227,7 @@ EXPLAIN (ddl, verbose) DROP DATABASE multi_region_test_db CASCADE; │ │ │ rule: "skip element removal ops on descriptor drop" │ │ │ │ │ ├── • Schema:{DescID: 106} - │ │ │ OFFLINE → DROPPED + │ │ │ TXN_DROPPED → DROPPED │ │ │ │ │ ├── • SchemaParent:{DescID: 106, ReferencedDescID: 104} │ │ │ │ PUBLIC → ABSENT @@ -289,7 +284,7 @@ EXPLAIN (ddl, verbose) DROP DATABASE multi_region_test_db CASCADE; │ │ │ rule: "skip element removal ops on descriptor drop" │ │ │ │ │ ├── • EnumType:{DescID: 105} - │ │ │ OFFLINE → DROPPED + │ │ │ TXN_DROPPED → DROPPED │ │ │ │ │ ├── • EnumTypeValue:{DescID: 105, Name: us-east1} │ │ │ │ PUBLIC → ABSENT @@ -373,7 +368,7 @@ EXPLAIN (ddl, verbose) DROP DATABASE multi_region_test_db CASCADE; │ │ │ rule: "skip element removal ops on descriptor drop" │ │ │ │ │ ├── • AliasType:{DescID: 107} - │ │ │ OFFLINE → DROPPED + │ │ │ TXN_DROPPED → DROPPED │ │ │ │ │ ├── • ObjectParent:{DescID: 107, ReferencedDescID: 106} │ │ │ │ PUBLIC → ABSENT @@ -421,7 +416,7 @@ EXPLAIN (ddl, verbose) DROP DATABASE multi_region_test_db CASCADE; │ │ │ rule: "skip element removal ops on descriptor drop" │ │ │ │ │ ├── • Table:{DescID: 108} - │ │ │ OFFLINE → DROPPED + │ │ │ TXN_DROPPED → DROPPED │ │ │ │ │ ├── • ObjectParent:{DescID: 108, ReferencedDescID: 106} │ │ │ │ PUBLIC → ABSENT diff --git a/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_table_multiregion b/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_table_multiregion index bb3167762916..e583c718f24a 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_table_multiregion +++ b/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_table_multiregion @@ -16,7 +16,7 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ ├── • 6 elements transitioning toward ABSENT │ │ │ │ │ ├── • Table:{DescID: 108} -│ │ │ PUBLIC → OFFLINE +│ │ │ PUBLIC → TXN_DROPPED │ │ │ │ │ ├── • Column:{DescID: 108, ColumnID: 1} │ │ │ │ PUBLIC → WRITE_ONLY @@ -50,9 +50,8 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ └── • 1 Mutation operation │ │ -│ └── • MarkDescriptorAsOffline +│ └── • MarkDescriptorAsSyntheticallyDropped │ DescID: 108 -│ Reason: DROP TABLE multi_region_test_db.public.table_regional_by_row │ ├── • PreCommitPhase │ │ @@ -127,7 +126,7 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ rule: "skip element removal ops on descriptor drop" │ │ │ │ │ ├── • Table:{DescID: 108} - │ │ │ OFFLINE → DROPPED + │ │ │ TXN_DROPPED → DROPPED │ │ │ │ │ ├── • ObjectParent:{DescID: 108, ReferencedDescID: 106} │ │ │ │ PUBLIC → ABSENT diff --git a/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_table_multiregion_primary_region b/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_table_multiregion_primary_region index b4fb0300d297..ce9a70f51316 100644 --- a/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_table_multiregion_primary_region +++ b/pkg/ccl/schemachangerccl/testdata/explain_verbose/drop_table_multiregion_primary_region @@ -16,7 +16,7 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ ├── • 5 elements transitioning toward ABSENT │ │ │ │ │ ├── • Table:{DescID: 108} -│ │ │ PUBLIC → OFFLINE +│ │ │ PUBLIC → TXN_DROPPED │ │ │ │ │ ├── • Column:{DescID: 108, ColumnID: 1} │ │ │ │ PUBLIC → WRITE_ONLY @@ -44,9 +44,8 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ └── • 1 Mutation operation │ │ -│ └── • MarkDescriptorAsOffline +│ └── • MarkDescriptorAsSyntheticallyDropped │ DescID: 108 -│ Reason: DROP TABLE multi_region_test_db.public.table_regional_by_table CASCADE │ ├── • PreCommitPhase │ │ @@ -117,7 +116,7 @@ EXPLAIN (ddl, verbose) DROP TABLE multi_region_test_db.public.table_regional_by_ │ │ │ rule: "skip element removal ops on descriptor drop" │ │ │ │ │ ├── • Table:{DescID: 108} - │ │ │ OFFLINE → DROPPED + │ │ │ TXN_DROPPED → DROPPED │ │ │ │ │ ├── • ObjectParent:{DescID: 108, ReferencedDescID: 106} │ │ │ │ PUBLIC → ABSENT diff --git a/pkg/sql/logictest/testdata/logic_test/new_schema_changer b/pkg/sql/logictest/testdata/logic_test/new_schema_changer index 901df3d8dbee..63b8aeff5625 100644 --- a/pkg/sql/logictest/testdata/logic_test/new_schema_changer +++ b/pkg/sql/logictest/testdata/logic_test/new_schema_changer @@ -560,6 +560,27 @@ DROP TABLE defaultdb.ttyp; statement ok DROP TYPE defaultdb.typ; +# Demonstrate that descriptors dropped in a transaction figure appropriately +# into virtual tables. Most virtual tables omit the dropped descriptors, some +# show their status. + +query I +SELECT count(*) + FROM information_schema.tables + WHERE table_schema = 'public' + AND table_name LIKE '%typ%'; +---- +0 + +query TT + SELECT name, state + FROM crdb_internal.tables + WHERE schema_name = 'public' + AND name LIKE '%typ%' + ORDER BY name; +---- +ttyp DROP + statement ok COMMIT; @@ -727,7 +748,7 @@ BEGIN statement ok DROP DATABASE db1 CASCADE -statement error database "db1" is offline: DROP DATABASE db1 CASCADE +statement error pgcode 3D000 database "db1" does not exist SELECT * from db1.sc1.v1 statement ok diff --git a/pkg/sql/schemachanger/scdeps/exec_deps.go b/pkg/sql/schemachanger/scdeps/exec_deps.go index e2d3356e9c17..48f7db695417 100644 --- a/pkg/sql/schemachanger/scdeps/exec_deps.go +++ b/pkg/sql/schemachanger/scdeps/exec_deps.go @@ -213,6 +213,10 @@ func (d *txnDeps) MustReadMutableDescriptor( return d.descsCollection.GetMutableDescriptorByID(ctx, d.txn, id) } +func (d *txnDeps) AddSyntheticDescriptor(desc catalog.MutableDescriptor) { + d.descsCollection.AddSyntheticDescriptor(desc) +} + // NewCatalogChangeBatcher implements the scexec.Catalog interface. func (d *txnDeps) NewCatalogChangeBatcher() scexec.CatalogChangeBatcher { return &catalogChangeBatcher{ diff --git a/pkg/sql/schemachanger/scdeps/sctestdeps/test_deps.go b/pkg/sql/schemachanger/scdeps/sctestdeps/test_deps.go index 6927648172b9..345e54e23919 100644 --- a/pkg/sql/schemachanger/scdeps/sctestdeps/test_deps.go +++ b/pkg/sql/schemachanger/scdeps/sctestdeps/test_deps.go @@ -560,9 +560,18 @@ func (s *TestState) MustReadDescriptor(ctx context.Context, id descpb.ID) catalo return desc } +// AddSyntheticDescriptor is part of the scexec.Catalog interface. +func (s *TestState) AddSyntheticDescriptor(desc catalog.MutableDescriptor) { + s.LogSideEffectf("added synthetic descriptor: %v", desc) + s.synthetic.UpsertDescriptorEntry(desc) +} + // mustReadImmutableDescriptor looks up a descriptor and returns a immutable // deep copy. func (s *TestState) mustReadImmutableDescriptor(id descpb.ID) (catalog.Descriptor, error) { + if u := s.synthetic.LookupDescriptorEntry(id); u != nil { + return u.NewBuilder().BuildImmutable(), nil + } if u := s.uncommitted.LookupDescriptorEntry(id); u != nil { return u.NewBuilder().BuildImmutable(), nil } diff --git a/pkg/sql/schemachanger/scdeps/sctestdeps/test_state.go b/pkg/sql/schemachanger/scdeps/sctestdeps/test_state.go index 512acecf32f5..677c73ec0afb 100644 --- a/pkg/sql/schemachanger/scdeps/sctestdeps/test_state.go +++ b/pkg/sql/schemachanger/scdeps/sctestdeps/test_state.go @@ -54,7 +54,7 @@ type TestState struct { // change statement will probably alter the contents of uncommitted and these // will not be reflected in committed until the transaction commits, i.e. the // WithTxn method returns. - committed, uncommitted nstree.MutableCatalog + committed, uncommitted, synthetic nstree.MutableCatalog comments map[descmetadata.CommentKey]string zoneConfigs map[catid.DescID]*zonepb.ZoneConfig @@ -114,7 +114,8 @@ func (s *TestState) WithTxn(fn func(s *TestState)) { s.txnCounter++ defer func() { u := s.uncommitted - s.committed, s.uncommitted = nstree.MutableCatalog{}, nstree.MutableCatalog{} + s.committed, s.uncommitted, s.synthetic = nstree.MutableCatalog{}, + nstree.MutableCatalog{}, nstree.MutableCatalog{} _ = u.ForEachNamespaceEntry(func(e catalog.NameEntry) error { s.committed.UpsertNamespaceEntry(e, e.GetID()) s.uncommitted.UpsertNamespaceEntry(e, e.GetID()) diff --git a/pkg/sql/schemachanger/scexec/dependencies.go b/pkg/sql/schemachanger/scexec/dependencies.go index c8ae741d5fda..70fa74dc086b 100644 --- a/pkg/sql/schemachanger/scexec/dependencies.go +++ b/pkg/sql/schemachanger/scexec/dependencies.go @@ -66,6 +66,13 @@ type Catalog interface { // NewCatalogChangeBatcher is equivalent to creating a new kv.Batch for the // current kv.Txn. NewCatalogChangeBatcher() CatalogChangeBatcher + + // AddSyntheticDescriptor adds a synthetic descriptor to the catalog. It + // clears any changes to the descriptor stored in the Catalog such that + // subsequent attempts to retrieve the descriptor with the same ID will not + // see any side effects which might have been applied to the mutable which + // is here stored as a synthetic descriptor. + AddSyntheticDescriptor(desc catalog.MutableDescriptor) } // EventLogger encapsulates the operations for emitting event log entries. diff --git a/pkg/sql/schemachanger/scexec/exec_mutation.go b/pkg/sql/schemachanger/scexec/exec_mutation.go index 27b237585f30..8f052a33c8ca 100644 --- a/pkg/sql/schemachanger/scexec/exec_mutation.go +++ b/pkg/sql/schemachanger/scexec/exec_mutation.go @@ -61,6 +61,7 @@ func executeDescriptorMutationOps(ctx context.Context, deps Dependencies, ops [] ctx, mvs.descriptorsToDelete, dbZoneConfigsToDelete, + mvs.syntheticDescriptors, mvs.modifiedDescriptors, mvs.drainedNames, deps.Catalog(), @@ -94,6 +95,7 @@ func performBatchedCatalogWrites( ctx context.Context, descriptorsToDelete catalog.DescriptorIDSet, dbZoneConfigsToDelete catalog.DescriptorIDSet, + syntheticDescriptors catalog.DescriptorIDSet, modifiedDescriptors nstree.Map, drainedNames map[descpb.ID][]descpb.NameInfo, cat Catalog, @@ -103,8 +105,13 @@ func performBatchedCatalogWrites( modifiedDescriptors.Remove(id) }) err := modifiedDescriptors.IterateByID(func(entry catalog.NameEntry) error { + if syntheticDescriptors.Contains(entry.GetID()) { + cat.AddSyntheticDescriptor(entry.(catalog.MutableDescriptor)) + return nil + } return b.CreateOrUpdateDescriptor(ctx, entry.(catalog.MutableDescriptor)) }) + if err != nil { return err } @@ -401,6 +408,10 @@ type mutationVisitorState struct { scheduleIDsToDelete []int64 statsToRefresh map[descpb.ID]struct{} + // syntheticDescriptors are entries in modifiedDescriptors which should not + // be written, but rather should be added as synthetic descriptors. + syntheticDescriptors catalog.DescriptorIDSet + gcJobs } @@ -554,6 +565,10 @@ func (mvs *mutationVisitorState) RefreshStats(descriptorID descpb.ID) { mvs.statsToRefresh[descriptorID] = struct{}{} } +func (mvs *mutationVisitorState) MarkDescriptorSynthetic(id descpb.ID) { + mvs.syntheticDescriptors.Add(id) +} + func (mvs *mutationVisitorState) AddDrainedName(id descpb.ID, nameInfo descpb.NameInfo) { mvs.drainedNames[id] = append(mvs.drainedNames[id], nameInfo) } diff --git a/pkg/sql/schemachanger/scexec/mocks_generated_test.go b/pkg/sql/schemachanger/scexec/mocks_generated_test.go index c1d0766c0549..db8c40c28d0e 100644 --- a/pkg/sql/schemachanger/scexec/mocks_generated_test.go +++ b/pkg/sql/schemachanger/scexec/mocks_generated_test.go @@ -39,6 +39,18 @@ func (m *MockCatalog) EXPECT() *MockCatalogMockRecorder { return m.recorder } +// AddSyntheticDescriptor mocks base method. +func (m *MockCatalog) AddSyntheticDescriptor(arg0 catalog.MutableDescriptor) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "AddSyntheticDescriptor", arg0) +} + +// AddSyntheticDescriptor indicates an expected call of AddSyntheticDescriptor. +func (mr *MockCatalogMockRecorder) AddSyntheticDescriptor(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddSyntheticDescriptor", reflect.TypeOf((*MockCatalog)(nil).AddSyntheticDescriptor), arg0) +} + // GetFullyQualifiedName mocks base method. func (m *MockCatalog) GetFullyQualifiedName(arg0 context.Context, arg1 catid.DescID) (string, error) { m.ctrl.T.Helper() diff --git a/pkg/sql/schemachanger/scexec/scmutationexec/dependencies.go b/pkg/sql/schemachanger/scexec/scmutationexec/dependencies.go index 15b083081ead..d7866a0d1445 100644 --- a/pkg/sql/schemachanger/scexec/scmutationexec/dependencies.go +++ b/pkg/sql/schemachanger/scexec/scmutationexec/dependencies.go @@ -117,4 +117,6 @@ type MutationVisitorStateUpdater interface { // RefreshStats refresh stats for a given descriptor. RefreshStats(id descpb.ID) + MarkDescriptorSynthetic(id descpb.ID) + // MarkDescriptorSynthetic(id descpb.ID) } diff --git a/pkg/sql/schemachanger/scexec/scmutationexec/drop.go b/pkg/sql/schemachanger/scexec/scmutationexec/drop.go index 34774e060ec4..43859971b8fc 100644 --- a/pkg/sql/schemachanger/scexec/scmutationexec/drop.go +++ b/pkg/sql/schemachanger/scexec/scmutationexec/drop.go @@ -71,14 +71,15 @@ func (m *visitor) MarkDescriptorAsPublic( return nil } -func (m *visitor) MarkDescriptorAsOffline( - ctx context.Context, op scop.MarkDescriptorAsOffline, +func (m *visitor) MarkDescriptorAsSyntheticallyDropped( + ctx context.Context, op scop.MarkDescriptorAsSyntheticallyDropped, ) error { desc, err := m.s.CheckOutDescriptor(ctx, op.DescID) if err != nil { return err } - desc.SetOffline(op.Reason) + desc.SetDropped() + m.s.MarkDescriptorSynthetic(desc.GetID()) return nil } diff --git a/pkg/sql/schemachanger/scop/mutation.go b/pkg/sql/schemachanger/scop/mutation.go index 95ace62c59c2..11093c3338e9 100644 --- a/pkg/sql/schemachanger/scop/mutation.go +++ b/pkg/sql/schemachanger/scop/mutation.go @@ -153,11 +153,11 @@ type MarkDescriptorAsPublic struct { DescID descpb.ID } -// MarkDescriptorAsOffline changes the descriptor's state to OFFLINE. -type MarkDescriptorAsOffline struct { +// MarkDescriptorAsSyntheticallyDropped changes the descriptor's state to +// DROPPED, but records that status only synthetically. +type MarkDescriptorAsSyntheticallyDropped struct { mutationOp DescID descpb.ID - Reason string } // MarkDescriptorAsDropped changes the descriptor's state to DROPPED. diff --git a/pkg/sql/schemachanger/scop/mutation_visitor_generated.go b/pkg/sql/schemachanger/scop/mutation_visitor_generated.go index fda175f4a341..e37d85e064f5 100644 --- a/pkg/sql/schemachanger/scop/mutation_visitor_generated.go +++ b/pkg/sql/schemachanger/scop/mutation_visitor_generated.go @@ -37,7 +37,7 @@ type MutationVisitor interface { CreateGcJobForDatabase(context.Context, CreateGcJobForDatabase) error CreateGcJobForIndex(context.Context, CreateGcJobForIndex) error MarkDescriptorAsPublic(context.Context, MarkDescriptorAsPublic) error - MarkDescriptorAsOffline(context.Context, MarkDescriptorAsOffline) error + MarkDescriptorAsSyntheticallyDropped(context.Context, MarkDescriptorAsSyntheticallyDropped) error MarkDescriptorAsDropped(context.Context, MarkDescriptorAsDropped) error DrainDescriptorName(context.Context, DrainDescriptorName) error MakeAddedColumnDeleteAndWriteOnly(context.Context, MakeAddedColumnDeleteAndWriteOnly) error @@ -173,8 +173,8 @@ func (op MarkDescriptorAsPublic) Visit(ctx context.Context, v MutationVisitor) e } // Visit is part of the MutationOp interface. -func (op MarkDescriptorAsOffline) Visit(ctx context.Context, v MutationVisitor) error { - return v.MarkDescriptorAsOffline(ctx, op) +func (op MarkDescriptorAsSyntheticallyDropped) Visit(ctx context.Context, v MutationVisitor) error { + return v.MarkDescriptorAsSyntheticallyDropped(ctx, op) } // Visit is part of the MutationOp interface. diff --git a/pkg/sql/schemachanger/scpb/scpb.proto b/pkg/sql/schemachanger/scpb/scpb.proto index 7d4ef1d5d409..8ec80ef36ded 100644 --- a/pkg/sql/schemachanger/scpb/scpb.proto +++ b/pkg/sql/schemachanger/scpb/scpb.proto @@ -26,6 +26,10 @@ message Target { enum Status { UNKNOWN = 0; + // OFFLINE exists only as a part of decomposition to detect importing + // descriptors. + OFFLINE = 15; + // Target states are ABSENT, PUBLIC or TRANSIENT_ABSENT. // These are the desired final end states of a schema change. ABSENT = 1; @@ -35,9 +39,8 @@ enum Status { TRANSIENT_ABSENT = 3; // Intermediate states on the descriptor dropping path. - reserved 4; // Formerly TXN_DROPPED. + TXN_DROPPED = 4; DROPPED = 5; - OFFLINE = 15; // Intermediate states on the column and index dropping and adding paths. WRITE_ONLY = 6; diff --git a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_alias_type.go b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_alias_type.go index da1f1441887f..8b6d32ba7a6c 100644 --- a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_alias_type.go +++ b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_alias_type.go @@ -20,7 +20,7 @@ func init() { toPublic( scpb.Status_ABSENT, equiv(scpb.Status_DROPPED), - to(scpb.Status_OFFLINE, + to(scpb.Status_TXN_DROPPED, emit(func(this *scpb.AliasType) *scop.NotImplemented { return notImplemented(this) }), @@ -35,11 +35,10 @@ func init() { ), toAbsent( scpb.Status_PUBLIC, - to(scpb.Status_OFFLINE, - emit(func(this *scpb.AliasType, md *targetsWithElementMap) *scop.MarkDescriptorAsOffline { - return &scop.MarkDescriptorAsOffline{ + to(scpb.Status_TXN_DROPPED, + emit(func(this *scpb.AliasType, md *targetsWithElementMap) *scop.MarkDescriptorAsSyntheticallyDropped { + return &scop.MarkDescriptorAsSyntheticallyDropped{ DescID: this.TypeID, - Reason: statementForDropJob(this, md).Statement, } }), ), diff --git a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_database.go b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_database.go index a5e92248ca10..8e886b0dab42 100644 --- a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_database.go +++ b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_database.go @@ -20,7 +20,7 @@ func init() { toPublic( scpb.Status_ABSENT, equiv(scpb.Status_DROPPED), - to(scpb.Status_OFFLINE, + to(scpb.Status_TXN_DROPPED, emit(func(this *scpb.Database) *scop.NotImplemented { return notImplemented(this) }), @@ -35,11 +35,10 @@ func init() { ), toAbsent( scpb.Status_PUBLIC, - to(scpb.Status_OFFLINE, - emit(func(this *scpb.Database, md *targetsWithElementMap) *scop.MarkDescriptorAsOffline { - return &scop.MarkDescriptorAsOffline{ + to(scpb.Status_TXN_DROPPED, + emit(func(this *scpb.Database, md *targetsWithElementMap) *scop.MarkDescriptorAsSyntheticallyDropped { + return &scop.MarkDescriptorAsSyntheticallyDropped{ DescID: this.DatabaseID, - Reason: statementForDropJob(this, md).Statement, } }), ), diff --git a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_enum_type.go b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_enum_type.go index d749d40be3e6..2f908f688081 100644 --- a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_enum_type.go +++ b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_enum_type.go @@ -20,7 +20,7 @@ func init() { toPublic( scpb.Status_ABSENT, equiv(scpb.Status_DROPPED), - to(scpb.Status_OFFLINE, + to(scpb.Status_TXN_DROPPED, emit(func(this *scpb.EnumType) *scop.NotImplemented { return notImplemented(this) }), @@ -35,11 +35,10 @@ func init() { ), toAbsent( scpb.Status_PUBLIC, - to(scpb.Status_OFFLINE, - emit(func(this *scpb.EnumType, md *targetsWithElementMap) *scop.MarkDescriptorAsOffline { - return &scop.MarkDescriptorAsOffline{ + to(scpb.Status_TXN_DROPPED, + emit(func(this *scpb.EnumType, md *targetsWithElementMap) *scop.MarkDescriptorAsSyntheticallyDropped { + return &scop.MarkDescriptorAsSyntheticallyDropped{ DescID: this.TypeID, - Reason: statementForDropJob(this, md).Statement, } }), ), diff --git a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_schema.go b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_schema.go index c864bd95bb2d..a865d7bc2ec2 100644 --- a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_schema.go +++ b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_schema.go @@ -20,7 +20,7 @@ func init() { toPublic( scpb.Status_ABSENT, equiv(scpb.Status_DROPPED), - to(scpb.Status_OFFLINE, + to(scpb.Status_TXN_DROPPED, emit(func(this *scpb.Schema) *scop.NotImplemented { return notImplemented(this) }), @@ -34,11 +34,10 @@ func init() { ), ), toAbsent(scpb.Status_PUBLIC, - to(scpb.Status_OFFLINE, - emit(func(this *scpb.Schema, md *targetsWithElementMap) *scop.MarkDescriptorAsOffline { - return &scop.MarkDescriptorAsOffline{ + to(scpb.Status_TXN_DROPPED, + emit(func(this *scpb.Schema, md *targetsWithElementMap) *scop.MarkDescriptorAsSyntheticallyDropped { + return &scop.MarkDescriptorAsSyntheticallyDropped{ DescID: this.SchemaID, - Reason: statementForDropJob(this, md).Statement, } }), ), diff --git a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_sequence.go b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_sequence.go index a3487080d13d..d7e20b2e4c0f 100644 --- a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_sequence.go +++ b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_sequence.go @@ -21,7 +21,7 @@ func init() { toPublic( scpb.Status_ABSENT, equiv(scpb.Status_DROPPED), - to(scpb.Status_OFFLINE, + to(scpb.Status_TXN_DROPPED, emit(func(this *scpb.Sequence) *scop.NotImplemented { return notImplemented(this) }), @@ -35,11 +35,10 @@ func init() { ), ), toAbsent(scpb.Status_PUBLIC, - to(scpb.Status_OFFLINE, - emit(func(this *scpb.Sequence, md *targetsWithElementMap) *scop.MarkDescriptorAsOffline { - return &scop.MarkDescriptorAsOffline{ + to(scpb.Status_TXN_DROPPED, + emit(func(this *scpb.Sequence, md *targetsWithElementMap) *scop.MarkDescriptorAsSyntheticallyDropped { + return &scop.MarkDescriptorAsSyntheticallyDropped{ DescID: this.SequenceID, - Reason: statementForDropJob(this, md).Statement, } }), ), diff --git a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_table.go b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_table.go index f8d1bd2912a3..a38be982178a 100644 --- a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_table.go +++ b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_table.go @@ -20,7 +20,7 @@ func init() { toPublic( scpb.Status_ABSENT, equiv(scpb.Status_DROPPED), - to(scpb.Status_OFFLINE, + to(scpb.Status_TXN_DROPPED, emit(func(this *scpb.Table) *scop.NotImplemented { return notImplemented(this) }), @@ -35,11 +35,10 @@ func init() { ), toAbsent( scpb.Status_PUBLIC, - to(scpb.Status_OFFLINE, - emit(func(this *scpb.Table, md *targetsWithElementMap) *scop.MarkDescriptorAsOffline { - return &scop.MarkDescriptorAsOffline{ + to(scpb.Status_TXN_DROPPED, + emit(func(this *scpb.Table, md *targetsWithElementMap) *scop.MarkDescriptorAsSyntheticallyDropped { + return &scop.MarkDescriptorAsSyntheticallyDropped{ DescID: this.TableID, - Reason: statementForDropJob(this, md).Statement, } }), ), diff --git a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_view.go b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_view.go index cc73526268af..f9c9260ecaec 100644 --- a/pkg/sql/schemachanger/scplan/internal/opgen/opgen_view.go +++ b/pkg/sql/schemachanger/scplan/internal/opgen/opgen_view.go @@ -20,7 +20,7 @@ func init() { toPublic( scpb.Status_ABSENT, equiv(scpb.Status_DROPPED), - to(scpb.Status_OFFLINE, + to(scpb.Status_TXN_DROPPED, emit(func(this *scpb.View) *scop.NotImplemented { return notImplemented(this) }), @@ -35,11 +35,10 @@ func init() { ), toAbsent( scpb.Status_PUBLIC, - to(scpb.Status_OFFLINE, - emit(func(this *scpb.View, md *targetsWithElementMap) *scop.MarkDescriptorAsOffline { - return &scop.MarkDescriptorAsOffline{ + to(scpb.Status_TXN_DROPPED, + emit(func(this *scpb.View, md *targetsWithElementMap) *scop.MarkDescriptorAsSyntheticallyDropped { + return &scop.MarkDescriptorAsSyntheticallyDropped{ DescID: this.ViewID, - Reason: statementForDropJob(this, md).Statement, } }), ), diff --git a/pkg/sql/schemachanger/scplan/internal/rules/assertions_test.go b/pkg/sql/schemachanger/scplan/internal/rules/assertions_test.go index 6a158872ea7b..0b9ca70f7c08 100644 --- a/pkg/sql/schemachanger/scplan/internal/rules/assertions_test.go +++ b/pkg/sql/schemachanger/scplan/internal/rules/assertions_test.go @@ -78,7 +78,7 @@ func checkToAbsentCategories(e scpb.Element) error { s0 := opgen.InitialStatus(e, scpb.Status_ABSENT) s1 := opgen.NextStatus(e, scpb.Status_ABSENT, s0) switch s1 { - case scpb.Status_OFFLINE, scpb.Status_DROPPED: + case scpb.Status_TXN_DROPPED, scpb.Status_DROPPED: if IsDescriptor(e) { return nil } diff --git a/pkg/sql/schemachanger/scplan/testdata/alter_table_drop_column b/pkg/sql/schemachanger/scplan/testdata/alter_table_drop_column index 0ba5b08e4e33..514de177bf6f 100644 --- a/pkg/sql/schemachanger/scplan/testdata/alter_table_drop_column +++ b/pkg/sql/schemachanger/scplan/testdata/alter_table_drop_column @@ -20,7 +20,7 @@ StatementPhase stage 1 of 1 with 12 MutationType ops [[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] -> OFFLINE + [[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 [[Column:{DescID: 108, ColumnID: 3}, ABSENT], PUBLIC] -> WRITE_ONLY @@ -62,9 +62,8 @@ StatementPhase stage 1 of 1 with 12 MutationType ops IndexID: 2 Name: crdb_internal_index_2_name_placeholder TableID: 107 - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 108 - Reason: ALTER TABLE defaultdb.public.foo DROP COLUMN v1 CASCADE *scop.MakeAddedIndexBackfilling Index: ConstraintID: 3 @@ -234,7 +233,7 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 19 MutationType ops [[Owner:{DescID: 108}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 108, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 108, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[View:{DescID: 108}, ABSENT], OFFLINE] -> DROPPED + [[View:{DescID: 108}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 108, ReferencedDescID: 101}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 108, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[ColumnName:{DescID: 108, Name: k, ColumnID: 1}, ABSENT], PUBLIC] -> ABSENT @@ -856,7 +855,7 @@ StatementPhase stage 1 of 1 with 12 MutationType ops [[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] -> OFFLINE + [[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 [[Column:{DescID: 108, ColumnID: 3}, ABSENT], PUBLIC] -> WRITE_ONLY @@ -876,9 +875,8 @@ StatementPhase stage 1 of 1 with 12 MutationType ops IndexID: 2 Name: crdb_internal_index_2_name_placeholder TableID: 107 - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 108 - Reason: ALTER TABLE defaultdb.public.foo DROP COLUMN v2 CASCADE *scop.MakeAddedIndexBackfilling Index: ConstraintID: 3 @@ -1082,7 +1080,7 @@ PostCommitNonRevertiblePhase stage 1 of 3 with 20 MutationType ops [[Owner:{DescID: 108}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 108, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 108, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[View:{DescID: 108}, ABSENT], OFFLINE] -> DROPPED + [[View:{DescID: 108}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 108, ReferencedDescID: 101}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 108, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[ColumnName:{DescID: 108, Name: k, ColumnID: 1}, ABSENT], PUBLIC] -> ABSENT diff --git a/pkg/sql/schemachanger/scplan/testdata/drop_database b/pkg/sql/schemachanger/scplan/testdata/drop_database index df01e4e73800..577448625eb9 100644 --- a/pkg/sql/schemachanger/scplan/testdata/drop_database +++ b/pkg/sql/schemachanger/scplan/testdata/drop_database @@ -21,95 +21,81 @@ DROP DATABASE db1 CASCADE ---- StatementPhase stage 1 of 1 with 14 MutationType ops transitions: - [[Database:{DescID: 104}, ABSENT], PUBLIC] -> OFFLINE - [[Schema:{DescID: 105}, ABSENT], PUBLIC] -> OFFLINE - [[Schema:{DescID: 106}, ABSENT], PUBLIC] -> OFFLINE - [[Sequence:{DescID: 107}, ABSENT], PUBLIC] -> OFFLINE - [[Table:{DescID: 110}, ABSENT], PUBLIC] -> OFFLINE + [[Database:{DescID: 104}, ABSENT], PUBLIC] -> TXN_DROPPED + [[Schema:{DescID: 105}, ABSENT], PUBLIC] -> TXN_DROPPED + [[Schema:{DescID: 106}, ABSENT], PUBLIC] -> TXN_DROPPED + [[Sequence:{DescID: 107}, ABSENT], PUBLIC] -> TXN_DROPPED + [[Table:{DescID: 110}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 110, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 110, ColumnID: 2}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 110, ColumnID: 3}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 110, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 110, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY [[PrimaryIndex:{DescID: 110, IndexID: 1, ConstraintID: 1}, ABSENT], PUBLIC] -> VALIDATED - [[Sequence:{DescID: 108}, ABSENT], PUBLIC] -> OFFLINE - [[Table:{DescID: 109}, ABSENT], PUBLIC] -> OFFLINE + [[Sequence:{DescID: 108}, ABSENT], PUBLIC] -> TXN_DROPPED + [[Table:{DescID: 109}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 109, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 109, ColumnID: 2}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 109, ColumnID: 3}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 109, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 109, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY [[PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, ABSENT], PUBLIC] -> VALIDATED - [[View:{DescID: 111}, ABSENT], PUBLIC] -> OFFLINE + [[View:{DescID: 111}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 111, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 111, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 111, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY - [[View:{DescID: 112}, ABSENT], PUBLIC] -> OFFLINE + [[View:{DescID: 112}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 112, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 112, ColumnID: 2}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 112, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 112, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY - [[View:{DescID: 113}, ABSENT], PUBLIC] -> OFFLINE + [[View:{DescID: 113}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 113, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 113, ColumnID: 2}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 113, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 113, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY - [[View:{DescID: 114}, ABSENT], PUBLIC] -> OFFLINE + [[View:{DescID: 114}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 114, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 114, ColumnID: 2}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 114, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 114, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY - [[EnumType:{DescID: 115}, ABSENT], PUBLIC] -> OFFLINE - [[AliasType:{DescID: 116}, ABSENT], PUBLIC] -> OFFLINE - [[View:{DescID: 117}, ABSENT], PUBLIC] -> OFFLINE + [[EnumType:{DescID: 115}, ABSENT], PUBLIC] -> TXN_DROPPED + [[AliasType:{DescID: 116}, ABSENT], PUBLIC] -> TXN_DROPPED + [[View:{DescID: 117}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 117, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 117, ColumnID: 2}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 117, ColumnID: 3}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 117, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 117, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY ops: - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 104 - Reason: DROP DATABASE db1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 105 - Reason: DROP DATABASE db1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 106 - Reason: DROP DATABASE db1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 107 - Reason: DROP DATABASE db1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 110 - Reason: DROP DATABASE db1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 108 - Reason: DROP DATABASE db1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 109 - Reason: DROP DATABASE db1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 111 - Reason: DROP DATABASE db1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 112 - Reason: DROP DATABASE db1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 113 - Reason: DROP DATABASE db1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 114 - Reason: DROP DATABASE db1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 115 - Reason: DROP DATABASE db1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 116 - Reason: DROP DATABASE db1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 117 - Reason: DROP DATABASE db1 CASCADE PreCommitPhase stage 1 of 1 with 15 MutationType ops transitions: ops: @@ -188,7 +174,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 68 MutationType ops [[UserPrivileges:{DescID: 104, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 104, Name: public}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 104, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[Database:{DescID: 104}, ABSENT], OFFLINE] -> DROPPED + [[Database:{DescID: 104}, ABSENT], TXN_DROPPED] -> DROPPED [[DatabaseRoleSetting:{DescID: 104, Name: __placeholder_role_name__}, ABSENT], PUBLIC] -> ABSENT [[DatabaseComment:{DescID: 104, Comment: db1 is good}, ABSENT], PUBLIC] -> ABSENT [[Namespace:{DescID: 105, Name: public, ReferencedDescID: 104}, ABSENT], PUBLIC] -> ABSENT @@ -196,26 +182,26 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 68 MutationType ops [[UserPrivileges:{DescID: 105, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 105, Name: public}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 105, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[Schema:{DescID: 105}, ABSENT], OFFLINE] -> DROPPED + [[Schema:{DescID: 105}, ABSENT], TXN_DROPPED] -> DROPPED [[SchemaParent:{DescID: 105, ReferencedDescID: 104}, ABSENT], PUBLIC] -> ABSENT [[Namespace:{DescID: 106, Name: sc1, ReferencedDescID: 104}, ABSENT], PUBLIC] -> ABSENT [[Owner:{DescID: 106}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 106, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 106, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[Schema:{DescID: 106}, ABSENT], OFFLINE] -> DROPPED + [[Schema:{DescID: 106}, ABSENT], TXN_DROPPED] -> DROPPED [[SchemaParent:{DescID: 106, ReferencedDescID: 104}, ABSENT], PUBLIC] -> ABSENT [[SchemaComment:{DescID: 106, Comment: sc1 is good}, ABSENT], PUBLIC] -> ABSENT [[Namespace:{DescID: 107, Name: sq1, ReferencedDescID: 104}, ABSENT], PUBLIC] -> ABSENT [[Owner:{DescID: 107}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 107, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 107, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[Sequence:{DescID: 107}, ABSENT], OFFLINE] -> DROPPED + [[Sequence:{DescID: 107}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 107, ReferencedDescID: 105}, ABSENT], PUBLIC] -> ABSENT [[Namespace:{DescID: 110, Name: t1, ReferencedDescID: 104}, ABSENT], PUBLIC] -> ABSENT [[Owner:{DescID: 110}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 110, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 110, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[Table:{DescID: 110}, ABSENT], OFFLINE] -> DROPPED + [[Table:{DescID: 110}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 110, ReferencedDescID: 105}, ABSENT], PUBLIC] -> ABSENT [[ColumnFamily:{DescID: 110, Name: primary, ColumnFamilyID: 0}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 110, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY @@ -243,13 +229,13 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 68 MutationType ops [[Owner:{DescID: 108}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 108, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 108, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[Sequence:{DescID: 108}, ABSENT], OFFLINE] -> DROPPED + [[Sequence:{DescID: 108}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 108, ReferencedDescID: 106}, ABSENT], PUBLIC] -> ABSENT [[Namespace:{DescID: 109, Name: t1, ReferencedDescID: 104}, ABSENT], PUBLIC] -> ABSENT [[Owner:{DescID: 109}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 109, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 109, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[Table:{DescID: 109}, ABSENT], OFFLINE] -> DROPPED + [[Table:{DescID: 109}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 109, ReferencedDescID: 106}, ABSENT], PUBLIC] -> ABSENT [[TableComment:{DescID: 109, Comment: t1 is good}, ABSENT], PUBLIC] -> ABSENT [[ColumnFamily:{DescID: 109, Name: primary, ColumnFamilyID: 0}, ABSENT], PUBLIC] -> ABSENT @@ -278,7 +264,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 68 MutationType ops [[Owner:{DescID: 111}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 111, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 111, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[View:{DescID: 111}, ABSENT], OFFLINE] -> DROPPED + [[View:{DescID: 111}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 111, ReferencedDescID: 106}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 111, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[ColumnName:{DescID: 111, Name: name, ColumnID: 1}, ABSENT], PUBLIC] -> ABSENT @@ -293,7 +279,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 68 MutationType ops [[Owner:{DescID: 112}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 112, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 112, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[View:{DescID: 112}, ABSENT], OFFLINE] -> DROPPED + [[View:{DescID: 112}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 112, ReferencedDescID: 106}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 112, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[ColumnName:{DescID: 112, Name: n1, ColumnID: 1}, ABSENT], PUBLIC] -> ABSENT @@ -311,7 +297,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 68 MutationType ops [[Owner:{DescID: 113}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 113, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 113, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[View:{DescID: 113}, ABSENT], OFFLINE] -> DROPPED + [[View:{DescID: 113}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 113, ReferencedDescID: 106}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 113, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[ColumnName:{DescID: 113, Name: name, ColumnID: 1}, ABSENT], PUBLIC] -> ABSENT @@ -329,7 +315,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 68 MutationType ops [[Owner:{DescID: 114}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 114, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 114, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[View:{DescID: 114}, ABSENT], OFFLINE] -> DROPPED + [[View:{DescID: 114}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 114, ReferencedDescID: 106}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 114, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[ColumnName:{DescID: 114, Name: n2, ColumnID: 1}, ABSENT], PUBLIC] -> ABSENT @@ -348,7 +334,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 68 MutationType ops [[UserPrivileges:{DescID: 115, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 115, Name: public}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 115, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[EnumType:{DescID: 115}, ABSENT], OFFLINE] -> DROPPED + [[EnumType:{DescID: 115}, ABSENT], TXN_DROPPED] -> DROPPED [[EnumTypeValue:{DescID: 115, Name: a}, ABSENT], PUBLIC] -> ABSENT [[ObjectParent:{DescID: 115, ReferencedDescID: 106}, ABSENT], PUBLIC] -> ABSENT [[Namespace:{DescID: 116, Name: _typ, ReferencedDescID: 104}, ABSENT], PUBLIC] -> ABSENT @@ -356,13 +342,13 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 68 MutationType ops [[UserPrivileges:{DescID: 116, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 116, Name: public}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 116, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[AliasType:{DescID: 116}, ABSENT], OFFLINE] -> DROPPED + [[AliasType:{DescID: 116}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 116, ReferencedDescID: 106}, ABSENT], PUBLIC] -> ABSENT [[Namespace:{DescID: 117, Name: v5, ReferencedDescID: 104}, ABSENT], PUBLIC] -> ABSENT [[Owner:{DescID: 117}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 117, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 117, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[View:{DescID: 117}, ABSENT], OFFLINE] -> DROPPED + [[View:{DescID: 117}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 117, ReferencedDescID: 106}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 117, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[ColumnName:{DescID: 117, Name: k, ColumnID: 1}, ABSENT], PUBLIC] -> ABSENT diff --git a/pkg/sql/schemachanger/scplan/testdata/drop_index b/pkg/sql/schemachanger/scplan/testdata/drop_index index 0770b1536fb5..76c5ae02e759 100644 --- a/pkg/sql/schemachanger/scplan/testdata/drop_index +++ b/pkg/sql/schemachanger/scplan/testdata/drop_index @@ -532,7 +532,7 @@ StatementPhase stage 1 of 1 with 3 MutationType ops 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] -> OFFLINE + [[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 @@ -544,9 +544,8 @@ StatementPhase stage 1 of 1 with 3 MutationType ops IndexID: 8 Name: crdb_internal_index_8_name_placeholder TableID: 104 - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 105 - Reason: DROP INDEX defaultdb.public.t1@idx4 CASCADE PreCommitPhase stage 1 of 1 with 3 MutationType ops transitions: ops: @@ -578,7 +577,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 8 MutationType ops [[Owner:{DescID: 105}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 105, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 105, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[View:{DescID: 105}, ABSENT], OFFLINE] -> DROPPED + [[View:{DescID: 105}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 105, ReferencedDescID: 101}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 105, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[ColumnName:{DescID: 105, Name: count, ColumnID: 1}, ABSENT], PUBLIC] -> ABSENT diff --git a/pkg/sql/schemachanger/scplan/testdata/drop_owned_by b/pkg/sql/schemachanger/scplan/testdata/drop_owned_by index 8f1115263777..c2030cf173ff 100644 --- a/pkg/sql/schemachanger/scplan/testdata/drop_owned_by +++ b/pkg/sql/schemachanger/scplan/testdata/drop_owned_by @@ -19,62 +19,53 @@ DROP OWNED BY r ---- StatementPhase stage 1 of 1 with 9 MutationType ops transitions: - [[Schema:{DescID: 105}, ABSENT], PUBLIC] -> OFFLINE - [[Sequence:{DescID: 106}, ABSENT], PUBLIC] -> OFFLINE - [[Table:{DescID: 109}, ABSENT], PUBLIC] -> OFFLINE + [[Schema:{DescID: 105}, ABSENT], PUBLIC] -> TXN_DROPPED + [[Sequence:{DescID: 106}, ABSENT], PUBLIC] -> TXN_DROPPED + [[Table:{DescID: 109}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 109, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 109, ColumnID: 2}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 109, ColumnID: 3}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 109, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 109, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY [[PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, ABSENT], PUBLIC] -> VALIDATED - [[Sequence:{DescID: 107}, ABSENT], PUBLIC] -> OFFLINE - [[Table:{DescID: 108}, ABSENT], PUBLIC] -> OFFLINE + [[Sequence:{DescID: 107}, ABSENT], PUBLIC] -> TXN_DROPPED + [[Table:{DescID: 108}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 108, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 108, ColumnID: 2}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 108, ColumnID: 3}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 108, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 108, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY [[PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1}, ABSENT], PUBLIC] -> VALIDATED - [[View:{DescID: 110}, ABSENT], PUBLIC] -> OFFLINE + [[View:{DescID: 110}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 110, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 110, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 110, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY - [[EnumType:{DescID: 111}, ABSENT], PUBLIC] -> OFFLINE - [[AliasType:{DescID: 112}, ABSENT], PUBLIC] -> OFFLINE - [[View:{DescID: 113}, ABSENT], PUBLIC] -> OFFLINE + [[EnumType:{DescID: 111}, ABSENT], PUBLIC] -> TXN_DROPPED + [[AliasType:{DescID: 112}, ABSENT], PUBLIC] -> TXN_DROPPED + [[View:{DescID: 113}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 113, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 113, ColumnID: 2}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 113, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 113, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY ops: - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 105 - Reason: DROP OWNED BY r - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 106 - Reason: DROP OWNED BY r - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 109 - Reason: DROP OWNED BY r - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 107 - Reason: DROP OWNED BY r - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 108 - Reason: DROP OWNED BY r - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 110 - Reason: DROP OWNED BY r - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 111 - Reason: DROP OWNED BY r - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 112 - Reason: DROP OWNED BY r - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 113 - Reason: DROP OWNED BY r PreCommitPhase stage 1 of 1 with 12 MutationType ops transitions: ops: @@ -141,20 +132,20 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 46 MutationType ops [[Owner:{DescID: 105}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 105, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 105, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[Schema:{DescID: 105}, ABSENT], OFFLINE] -> DROPPED + [[Schema:{DescID: 105}, ABSENT], TXN_DROPPED] -> DROPPED [[SchemaParent:{DescID: 105, ReferencedDescID: 100}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 104, Name: r}, ABSENT], PUBLIC] -> ABSENT [[Namespace:{DescID: 106, Name: sq, ReferencedDescID: 100}, ABSENT], PUBLIC] -> ABSENT [[Owner:{DescID: 106}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 106, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 106, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[Sequence:{DescID: 106}, ABSENT], OFFLINE] -> DROPPED + [[Sequence:{DescID: 106}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 106, ReferencedDescID: 101}, ABSENT], PUBLIC] -> ABSENT [[Namespace:{DescID: 109, Name: t, ReferencedDescID: 100}, ABSENT], PUBLIC] -> ABSENT [[Owner:{DescID: 109}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 109, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 109, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[Table:{DescID: 109}, ABSENT], OFFLINE] -> DROPPED + [[Table:{DescID: 109}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 109, ReferencedDescID: 101}, ABSENT], PUBLIC] -> ABSENT [[ColumnFamily:{DescID: 109, Name: primary, ColumnFamilyID: 0}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 109, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY @@ -182,13 +173,13 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 46 MutationType ops [[Owner:{DescID: 107}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 107, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 107, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[Sequence:{DescID: 107}, ABSENT], OFFLINE] -> DROPPED + [[Sequence:{DescID: 107}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 107, ReferencedDescID: 105}, ABSENT], PUBLIC] -> ABSENT [[Namespace:{DescID: 108, Name: t, ReferencedDescID: 100}, ABSENT], PUBLIC] -> ABSENT [[Owner:{DescID: 108}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 108, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 108, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[Table:{DescID: 108}, ABSENT], OFFLINE] -> DROPPED + [[Table:{DescID: 108}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 108, ReferencedDescID: 105}, ABSENT], PUBLIC] -> ABSENT [[ColumnFamily:{DescID: 108, Name: primary, ColumnFamilyID: 0}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 108, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY @@ -216,7 +207,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 46 MutationType ops [[Owner:{DescID: 110}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 110, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 110, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[View:{DescID: 110}, ABSENT], OFFLINE] -> DROPPED + [[View:{DescID: 110}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 110, ReferencedDescID: 105}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 110, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[ColumnName:{DescID: 110, Name: name, ColumnID: 1}, ABSENT], PUBLIC] -> ABSENT @@ -232,7 +223,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 46 MutationType ops [[UserPrivileges:{DescID: 111, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 111, Name: public}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 111, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[EnumType:{DescID: 111}, ABSENT], OFFLINE] -> DROPPED + [[EnumType:{DescID: 111}, ABSENT], TXN_DROPPED] -> DROPPED [[EnumTypeValue:{DescID: 111, Name: a}, ABSENT], PUBLIC] -> ABSENT [[ObjectParent:{DescID: 111, ReferencedDescID: 105}, ABSENT], PUBLIC] -> ABSENT [[Namespace:{DescID: 112, Name: _typ, ReferencedDescID: 100}, ABSENT], PUBLIC] -> ABSENT @@ -240,13 +231,13 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 46 MutationType ops [[UserPrivileges:{DescID: 112, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 112, Name: public}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 112, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[AliasType:{DescID: 112}, ABSENT], OFFLINE] -> DROPPED + [[AliasType:{DescID: 112}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 112, ReferencedDescID: 105}, ABSENT], PUBLIC] -> ABSENT [[Namespace:{DescID: 113, Name: v2, ReferencedDescID: 100}, ABSENT], PUBLIC] -> ABSENT [[Owner:{DescID: 113}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 113, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 113, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[View:{DescID: 113}, ABSENT], OFFLINE] -> DROPPED + [[View:{DescID: 113}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 113, ReferencedDescID: 105}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 113, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[ColumnName:{DescID: 113, Name: k, ColumnID: 1}, ABSENT], PUBLIC] -> ABSENT diff --git a/pkg/sql/schemachanger/scplan/testdata/drop_schema b/pkg/sql/schemachanger/scplan/testdata/drop_schema index afa31b2c2c72..aad178fe5553 100644 --- a/pkg/sql/schemachanger/scplan/testdata/drop_schema +++ b/pkg/sql/schemachanger/scplan/testdata/drop_schema @@ -1077,73 +1077,63 @@ DROP SCHEMA defaultdb.SC1 CASCADE ---- StatementPhase stage 1 of 1 with 10 MutationType ops transitions: - [[Schema:{DescID: 104}, ABSENT], PUBLIC] -> OFFLINE - [[Sequence:{DescID: 105}, ABSENT], PUBLIC] -> OFFLINE - [[Table:{DescID: 106}, ABSENT], PUBLIC] -> OFFLINE + [[Schema:{DescID: 104}, ABSENT], PUBLIC] -> TXN_DROPPED + [[Sequence:{DescID: 105}, ABSENT], PUBLIC] -> TXN_DROPPED + [[Table:{DescID: 106}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 106, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 106, ColumnID: 2}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 106, ColumnID: 3}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 106, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 106, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY [[PrimaryIndex:{DescID: 106, IndexID: 1, ConstraintID: 1}, ABSENT], PUBLIC] -> VALIDATED - [[View:{DescID: 107}, ABSENT], PUBLIC] -> OFFLINE + [[View:{DescID: 107}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 107, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 107, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 107, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY - [[View:{DescID: 108}, ABSENT], PUBLIC] -> OFFLINE + [[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 [[Column:{DescID: 108, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 108, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY - [[View:{DescID: 109}, ABSENT], PUBLIC] -> OFFLINE + [[View:{DescID: 109}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 109, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 109, ColumnID: 2}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 109, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 109, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY - [[View:{DescID: 110}, ABSENT], PUBLIC] -> OFFLINE + [[View:{DescID: 110}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 110, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 110, ColumnID: 2}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 110, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 110, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY - [[EnumType:{DescID: 111}, ABSENT], PUBLIC] -> OFFLINE - [[AliasType:{DescID: 112}, ABSENT], PUBLIC] -> OFFLINE - [[View:{DescID: 113}, ABSENT], PUBLIC] -> OFFLINE + [[EnumType:{DescID: 111}, ABSENT], PUBLIC] -> TXN_DROPPED + [[AliasType:{DescID: 112}, ABSENT], PUBLIC] -> TXN_DROPPED + [[View:{DescID: 113}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 113, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 113, ColumnID: 2}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 113, ColumnID: 3}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 113, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 113, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY ops: - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 104 - Reason: DROP SCHEMA defaultdb.sc1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 105 - Reason: DROP SCHEMA defaultdb.sc1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 106 - Reason: DROP SCHEMA defaultdb.sc1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 107 - Reason: DROP SCHEMA defaultdb.sc1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 108 - Reason: DROP SCHEMA defaultdb.sc1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 109 - Reason: DROP SCHEMA defaultdb.sc1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 110 - Reason: DROP SCHEMA defaultdb.sc1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 111 - Reason: DROP SCHEMA defaultdb.sc1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 112 - Reason: DROP SCHEMA defaultdb.sc1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 113 - Reason: DROP SCHEMA defaultdb.sc1 CASCADE PreCommitPhase stage 1 of 1 with 12 MutationType ops transitions: ops: @@ -1209,20 +1199,20 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 49 MutationType ops [[Owner:{DescID: 104}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 104, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 104, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[Schema:{DescID: 104}, ABSENT], OFFLINE] -> DROPPED + [[Schema:{DescID: 104}, ABSENT], TXN_DROPPED] -> DROPPED [[SchemaParent:{DescID: 104, ReferencedDescID: 100}, ABSENT], PUBLIC] -> ABSENT [[SchemaComment:{DescID: 104, Comment: sc1 is good schema}, ABSENT], PUBLIC] -> ABSENT [[Namespace:{DescID: 105, Name: sq1, ReferencedDescID: 100}, ABSENT], PUBLIC] -> ABSENT [[Owner:{DescID: 105}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 105, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 105, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[Sequence:{DescID: 105}, ABSENT], OFFLINE] -> DROPPED + [[Sequence:{DescID: 105}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 105, ReferencedDescID: 104}, ABSENT], PUBLIC] -> ABSENT [[Namespace:{DescID: 106, Name: t1, ReferencedDescID: 100}, ABSENT], PUBLIC] -> ABSENT [[Owner:{DescID: 106}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 106, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 106, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[Table:{DescID: 106}, ABSENT], OFFLINE] -> DROPPED + [[Table:{DescID: 106}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 106, ReferencedDescID: 104}, ABSENT], PUBLIC] -> ABSENT [[TableComment:{DescID: 106, Comment: t1 is good table}, ABSENT], PUBLIC] -> ABSENT [[ColumnFamily:{DescID: 106, Name: primary, ColumnFamilyID: 0}, ABSENT], PUBLIC] -> ABSENT @@ -1251,7 +1241,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 49 MutationType ops [[Owner:{DescID: 107}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 107, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 107, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[View:{DescID: 107}, ABSENT], OFFLINE] -> DROPPED + [[View:{DescID: 107}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 107, ReferencedDescID: 104}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 107, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[ColumnName:{DescID: 107, Name: name, ColumnID: 1}, ABSENT], PUBLIC] -> ABSENT @@ -1266,7 +1256,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 49 MutationType ops [[Owner:{DescID: 108}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 108, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 108, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[View:{DescID: 108}, ABSENT], OFFLINE] -> DROPPED + [[View:{DescID: 108}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 108, ReferencedDescID: 104}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 108, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[ColumnName:{DescID: 108, Name: n1, ColumnID: 1}, ABSENT], PUBLIC] -> ABSENT @@ -1284,7 +1274,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 49 MutationType ops [[Owner:{DescID: 109}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 109, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 109, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[View:{DescID: 109}, ABSENT], OFFLINE] -> DROPPED + [[View:{DescID: 109}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 109, ReferencedDescID: 104}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 109, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[ColumnName:{DescID: 109, Name: name, ColumnID: 1}, ABSENT], PUBLIC] -> ABSENT @@ -1302,7 +1292,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 49 MutationType ops [[Owner:{DescID: 110}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 110, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 110, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[View:{DescID: 110}, ABSENT], OFFLINE] -> DROPPED + [[View:{DescID: 110}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 110, ReferencedDescID: 104}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 110, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[ColumnName:{DescID: 110, Name: n2, ColumnID: 1}, ABSENT], PUBLIC] -> ABSENT @@ -1321,7 +1311,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 49 MutationType ops [[UserPrivileges:{DescID: 111, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 111, Name: public}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 111, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[EnumType:{DescID: 111}, ABSENT], OFFLINE] -> DROPPED + [[EnumType:{DescID: 111}, ABSENT], TXN_DROPPED] -> DROPPED [[EnumTypeValue:{DescID: 111, Name: a}, ABSENT], PUBLIC] -> ABSENT [[ObjectParent:{DescID: 111, ReferencedDescID: 104}, ABSENT], PUBLIC] -> ABSENT [[Namespace:{DescID: 112, Name: _typ, ReferencedDescID: 100}, ABSENT], PUBLIC] -> ABSENT @@ -1329,13 +1319,13 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 49 MutationType ops [[UserPrivileges:{DescID: 112, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 112, Name: public}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 112, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[AliasType:{DescID: 112}, ABSENT], OFFLINE] -> DROPPED + [[AliasType:{DescID: 112}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 112, ReferencedDescID: 104}, ABSENT], PUBLIC] -> ABSENT [[Namespace:{DescID: 113, Name: v5, ReferencedDescID: 100}, ABSENT], PUBLIC] -> ABSENT [[Owner:{DescID: 113}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 113, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 113, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[View:{DescID: 113}, ABSENT], OFFLINE] -> DROPPED + [[View:{DescID: 113}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 113, ReferencedDescID: 104}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 113, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[ColumnName:{DescID: 113, Name: k, ColumnID: 1}, ABSENT], PUBLIC] -> ABSENT diff --git a/pkg/sql/schemachanger/scplan/testdata/drop_sequence b/pkg/sql/schemachanger/scplan/testdata/drop_sequence index d8cec88a34f4..73258e57abb0 100644 --- a/pkg/sql/schemachanger/scplan/testdata/drop_sequence +++ b/pkg/sql/schemachanger/scplan/testdata/drop_sequence @@ -7,11 +7,10 @@ DROP SEQUENCE defaultdb.SQ1 ---- StatementPhase stage 1 of 1 with 1 MutationType op transitions: - [[Sequence:{DescID: 104}, ABSENT], PUBLIC] -> OFFLINE + [[Sequence:{DescID: 104}, ABSENT], PUBLIC] -> TXN_DROPPED ops: - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 104 - Reason: DROP SEQUENCE defaultdb.public.sq1 PreCommitPhase stage 1 of 1 with 2 MutationType ops transitions: ops: @@ -36,7 +35,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 5 MutationType ops [[Owner:{DescID: 104}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 104, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 104, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[Sequence:{DescID: 104}, ABSENT], OFFLINE] -> DROPPED + [[Sequence:{DescID: 104}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 104, ReferencedDescID: 101}, ABSENT], PUBLIC] -> ABSENT ops: *scop.MarkDescriptorAsDropped @@ -92,11 +91,10 @@ DROP SEQUENCE defaultdb.SQ1 CASCADE ---- StatementPhase stage 1 of 1 with 1 MutationType op transitions: - [[Sequence:{DescID: 104}, ABSENT], PUBLIC] -> OFFLINE + [[Sequence:{DescID: 104}, ABSENT], PUBLIC] -> TXN_DROPPED ops: - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 104 - Reason: DROP SEQUENCE defaultdb.public.sq1 CASCADE PreCommitPhase stage 1 of 1 with 4 MutationType ops transitions: ops: @@ -129,7 +127,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 11 MutationType ops [[Owner:{DescID: 104}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 104, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 104, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[Sequence:{DescID: 104}, ABSENT], OFFLINE] -> DROPPED + [[Sequence:{DescID: 104}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 104, ReferencedDescID: 101}, ABSENT], PUBLIC] -> ABSENT [[ColumnDefaultExpression:{DescID: 105, ColumnID: 2}, ABSENT], PUBLIC] -> ABSENT [[ColumnDefaultExpression:{DescID: 106, ColumnID: 2}, ABSENT], PUBLIC] -> ABSENT diff --git a/pkg/sql/schemachanger/scplan/testdata/drop_table b/pkg/sql/schemachanger/scplan/testdata/drop_table index 43dc214c77d0..5757c0648f26 100644 --- a/pkg/sql/schemachanger/scplan/testdata/drop_table +++ b/pkg/sql/schemachanger/scplan/testdata/drop_table @@ -31,7 +31,7 @@ DROP TABLE defaultdb.shipments CASCADE; ---- StatementPhase stage 1 of 1 with 3 MutationType ops transitions: - [[Table:{DescID: 109}, ABSENT], PUBLIC] -> OFFLINE + [[Table:{DescID: 109}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 109, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 109, ColumnID: 2}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 109, ColumnID: 3}, ABSENT], PUBLIC] -> WRITE_ONLY @@ -41,22 +41,19 @@ StatementPhase stage 1 of 1 with 3 MutationType ops [[Column:{DescID: 109, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY [[PrimaryIndex:{DescID: 109, IndexID: 1, ConstraintID: 1}, ABSENT], PUBLIC] -> VALIDATED [[SecondaryIndex:{DescID: 109, IndexID: 2, ConstraintID: 0}, ABSENT], PUBLIC] -> VALIDATED - [[Sequence:{DescID: 110}, ABSENT], PUBLIC] -> OFFLINE - [[View:{DescID: 111}, ABSENT], PUBLIC] -> OFFLINE + [[Sequence:{DescID: 110}, ABSENT], PUBLIC] -> TXN_DROPPED + [[View:{DescID: 111}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 111, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 111, ColumnID: 2}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 111, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 111, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY ops: - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 109 - Reason: DROP TABLE defaultdb.public.shipments CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 110 - Reason: DROP TABLE defaultdb.public.shipments CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 111 - Reason: DROP TABLE defaultdb.public.shipments CASCADE PreCommitPhase stage 1 of 1 with 9 MutationType ops transitions: ops: @@ -110,7 +107,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 32 MutationType ops [[Owner:{DescID: 109}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 109, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 109, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[Table:{DescID: 109}, ABSENT], OFFLINE] -> DROPPED + [[Table:{DescID: 109}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 109, ReferencedDescID: 101}, ABSENT], PUBLIC] -> ABSENT [[TableComment:{DescID: 109, Comment: shipment is important}, ABSENT], PUBLIC] -> ABSENT [[ColumnFamily:{DescID: 109, Name: primary, ColumnFamilyID: 0}, ABSENT], PUBLIC] -> ABSENT @@ -162,13 +159,13 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 32 MutationType ops [[Owner:{DescID: 110}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 110, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 110, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[Sequence:{DescID: 110}, ABSENT], OFFLINE] -> DROPPED + [[Sequence:{DescID: 110}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 110, ReferencedDescID: 101}, ABSENT], PUBLIC] -> ABSENT [[Namespace:{DescID: 111, Name: v1, ReferencedDescID: 100}, ABSENT], PUBLIC] -> ABSENT [[Owner:{DescID: 111}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 111, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 111, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[View:{DescID: 111}, ABSENT], OFFLINE] -> DROPPED + [[View:{DescID: 111}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 111, ReferencedDescID: 101}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 111, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[ColumnName:{DescID: 111, Name: customer_id, ColumnID: 1}, ABSENT], PUBLIC] -> ABSENT @@ -1214,7 +1211,7 @@ DROP TABLE defaultdb.greeter ---- StatementPhase stage 1 of 1 with 1 MutationType op transitions: - [[Table:{DescID: 114}, ABSENT], PUBLIC] -> OFFLINE + [[Table:{DescID: 114}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 114, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 114, ColumnID: 2}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 114, ColumnID: 3}, ABSENT], PUBLIC] -> WRITE_ONLY @@ -1223,9 +1220,8 @@ StatementPhase stage 1 of 1 with 1 MutationType op [[PrimaryIndex:{DescID: 114, IndexID: 1, ConstraintID: 1}, ABSENT], PUBLIC] -> VALIDATED [[SecondaryIndex:{DescID: 114, IndexID: 2, ConstraintID: 0}, ABSENT], PUBLIC] -> VALIDATED ops: - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 114 - Reason: DROP TABLE defaultdb.public.greeter PreCommitPhase stage 1 of 1 with 4 MutationType ops transitions: ops: @@ -1259,7 +1255,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 16 MutationType ops [[Owner:{DescID: 114}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 114, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 114, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[Table:{DescID: 114}, ABSENT], OFFLINE] -> DROPPED + [[Table:{DescID: 114}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 114, ReferencedDescID: 101}, ABSENT], PUBLIC] -> ABSENT [[ColumnFamily:{DescID: 114, Name: primary, ColumnFamilyID: 0}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 114, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY diff --git a/pkg/sql/schemachanger/scplan/testdata/drop_type b/pkg/sql/schemachanger/scplan/testdata/drop_type index dfbb241a9de1..3f8b6628f60b 100644 --- a/pkg/sql/schemachanger/scplan/testdata/drop_type +++ b/pkg/sql/schemachanger/scplan/testdata/drop_type @@ -7,15 +7,13 @@ DROP TYPE defaultdb.typ ---- StatementPhase stage 1 of 1 with 2 MutationType ops transitions: - [[EnumType:{DescID: 104}, ABSENT], PUBLIC] -> OFFLINE - [[AliasType:{DescID: 105}, ABSENT], PUBLIC] -> OFFLINE + [[EnumType:{DescID: 104}, ABSENT], PUBLIC] -> TXN_DROPPED + [[AliasType:{DescID: 105}, ABSENT], PUBLIC] -> TXN_DROPPED ops: - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 104 - Reason: DROP TYPE defaultdb.public.typ - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 105 - Reason: DROP TYPE defaultdb.public.typ PreCommitPhase stage 1 of 1 with 3 MutationType ops transitions: ops: @@ -45,7 +43,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 7 MutationType ops [[UserPrivileges:{DescID: 104, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 104, Name: public}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 104, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[EnumType:{DescID: 104}, ABSENT], OFFLINE] -> DROPPED + [[EnumType:{DescID: 104}, ABSENT], TXN_DROPPED] -> DROPPED [[EnumTypeValue:{DescID: 104, Name: a}, ABSENT], PUBLIC] -> ABSENT [[ObjectParent:{DescID: 104, ReferencedDescID: 101}, ABSENT], PUBLIC] -> ABSENT [[Namespace:{DescID: 105, Name: _typ, ReferencedDescID: 100}, ABSENT], PUBLIC] -> ABSENT @@ -53,7 +51,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 7 MutationType ops [[UserPrivileges:{DescID: 105, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 105, Name: public}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 105, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[AliasType:{DescID: 105}, ABSENT], OFFLINE] -> DROPPED + [[AliasType:{DescID: 105}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 105, ReferencedDescID: 101}, ABSENT], PUBLIC] -> ABSENT ops: *scop.MarkDescriptorAsDropped diff --git a/pkg/sql/schemachanger/scplan/testdata/drop_view b/pkg/sql/schemachanger/scplan/testdata/drop_view index 97afffea117a..c7e09fa3877a 100644 --- a/pkg/sql/schemachanger/scplan/testdata/drop_view +++ b/pkg/sql/schemachanger/scplan/testdata/drop_view @@ -8,14 +8,13 @@ DROP VIEW defaultdb.v1 ---- StatementPhase stage 1 of 1 with 1 MutationType op transitions: - [[View:{DescID: 105}, ABSENT], PUBLIC] -> OFFLINE + [[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.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 105 - Reason: DROP VIEW defaultdb.public.v1 PreCommitPhase stage 1 of 1 with 3 MutationType ops transitions: ops: @@ -44,7 +43,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 7 MutationType ops [[Owner:{DescID: 105}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 105, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 105, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[View:{DescID: 105}, ABSENT], OFFLINE] -> DROPPED + [[View:{DescID: 105}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 105, ReferencedDescID: 101}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 105, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[ColumnName:{DescID: 105, Name: name, ColumnID: 1}, ABSENT], PUBLIC] -> ABSENT @@ -269,47 +268,42 @@ DROP VIEW defaultdb.v1 CASCADE ---- StatementPhase stage 1 of 1 with 5 MutationType ops transitions: - [[View:{DescID: 105}, ABSENT], PUBLIC] -> OFFLINE + [[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 - [[View:{DescID: 106}, ABSENT], PUBLIC] -> OFFLINE + [[View:{DescID: 106}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 106, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 106, ColumnID: 2}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 106, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 106, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY - [[View:{DescID: 107}, ABSENT], PUBLIC] -> OFFLINE + [[View:{DescID: 107}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 107, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 107, ColumnID: 2}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 107, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 107, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY - [[View:{DescID: 108}, ABSENT], PUBLIC] -> OFFLINE + [[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 [[Column:{DescID: 108, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 108, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY - [[View:{DescID: 111}, ABSENT], PUBLIC] -> OFFLINE + [[View:{DescID: 111}, ABSENT], PUBLIC] -> TXN_DROPPED [[Column:{DescID: 111, ColumnID: 1}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 111, ColumnID: 2}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 111, ColumnID: 3}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 111, ColumnID: 4294967295}, ABSENT], PUBLIC] -> WRITE_ONLY [[Column:{DescID: 111, ColumnID: 4294967294}, ABSENT], PUBLIC] -> WRITE_ONLY ops: - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 105 - Reason: DROP VIEW defaultdb.public.v1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 106 - Reason: DROP VIEW defaultdb.public.v1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 107 - Reason: DROP VIEW defaultdb.public.v1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 108 - Reason: DROP VIEW defaultdb.public.v1 CASCADE - *scop.MarkDescriptorAsOffline + *scop.MarkDescriptorAsSyntheticallyDropped DescID: 111 - Reason: DROP VIEW defaultdb.public.v1 CASCADE PreCommitPhase stage 1 of 1 with 9 MutationType ops transitions: ops: @@ -363,7 +357,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 30 MutationType ops [[Owner:{DescID: 105}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 105, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 105, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[View:{DescID: 105}, ABSENT], OFFLINE] -> DROPPED + [[View:{DescID: 105}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 105, ReferencedDescID: 101}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 105, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[ColumnName:{DescID: 105, Name: name, ColumnID: 1}, ABSENT], PUBLIC] -> ABSENT @@ -378,7 +372,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 30 MutationType ops [[Owner:{DescID: 106}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 106, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 106, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[View:{DescID: 106}, ABSENT], OFFLINE] -> DROPPED + [[View:{DescID: 106}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 106, ReferencedDescID: 101}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 106, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[ColumnName:{DescID: 106, Name: n1, ColumnID: 1}, ABSENT], PUBLIC] -> ABSENT @@ -396,7 +390,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 30 MutationType ops [[Owner:{DescID: 107}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 107, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 107, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[View:{DescID: 107}, ABSENT], OFFLINE] -> DROPPED + [[View:{DescID: 107}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 107, ReferencedDescID: 101}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 107, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[ColumnName:{DescID: 107, Name: name, ColumnID: 1}, ABSENT], PUBLIC] -> ABSENT @@ -414,7 +408,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 30 MutationType ops [[Owner:{DescID: 108}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 108, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 108, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[View:{DescID: 108}, ABSENT], OFFLINE] -> DROPPED + [[View:{DescID: 108}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 108, ReferencedDescID: 101}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 108, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[ColumnName:{DescID: 108, Name: n2, ColumnID: 1}, ABSENT], PUBLIC] -> ABSENT @@ -432,7 +426,7 @@ PostCommitNonRevertiblePhase stage 1 of 2 with 30 MutationType ops [[Owner:{DescID: 111}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 111, Name: admin}, ABSENT], PUBLIC] -> ABSENT [[UserPrivileges:{DescID: 111, Name: root}, ABSENT], PUBLIC] -> ABSENT - [[View:{DescID: 111}, ABSENT], OFFLINE] -> DROPPED + [[View:{DescID: 111}, ABSENT], TXN_DROPPED] -> DROPPED [[ObjectParent:{DescID: 111, ReferencedDescID: 101}, ABSENT], PUBLIC] -> ABSENT [[Column:{DescID: 111, ColumnID: 1}, ABSENT], WRITE_ONLY] -> DELETE_ONLY [[ColumnName:{DescID: 111, Name: k, ColumnID: 1}, ABSENT], PUBLIC] -> ABSENT diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_schema b/pkg/sql/schemachanger/testdata/end_to_end/drop_schema index 5532e0c56d75..c3b1c3c3eef5 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_schema +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_schema @@ -16,22 +16,7 @@ checking for feature: DROP SCHEMA increment telemetry for sql.schema.drop_schema increment telemetry for sql.uds.drop_schema ## StatementPhase stage 1 of 1 with 1 MutationType op -upsert descriptor #106 - schema: - id: 106 - - modificationTime: - - wallTime: "1640995200000000000" - + modificationTime: {} - name: sc - + offlineReason: DROP SCHEMA db.sc - parentId: 104 - privileges: - ... - withGrantOption: 2 - version: 2 - - version: "1" - + state: OFFLINE - + version: "2" +added synthetic descriptor: name:"sc" id:106 state:DROP offline_reason:"" modification_time:<> version:2 parent_id:104 privileges: users: owner_proto:"root" version:2 > # end StatementPhase # begin PreCommitPhase ## PreCommitPhase stage 1 of 1 with 3 MutationType ops @@ -67,12 +52,12 @@ upsert descriptor #106 + targetRanks: + targets: id: 106 - - modificationTime: {} - + modificationTime: - + wallTime: "1640995200000000001" - name: sc - offlineReason: DROP SCHEMA db.sc + modificationTime: {} ... + withGrantOption: 2 + version: 2 + - state: DROP + version: "2" create job #1 (non-cancelable: true): "DROP SCHEMA db.sc" descriptor IDs: [104 106] # end PreCommitPhase @@ -108,13 +93,10 @@ upsert descriptor #106 - wallTime: "1640995200000000001" + modificationTime: {} name: sc - - offlineReason: DROP SCHEMA db.sc parentId: 104 - privileges: ... withGrantOption: 2 version: 2 - - state: OFFLINE - version: "2" + state: DROP + version: "3" diff --git a/pkg/sql/schemachanger/testdata/end_to_end/drop_table b/pkg/sql/schemachanger/testdata/end_to_end/drop_table index e41968334a22..f1854128eae4 100644 --- a/pkg/sql/schemachanger/testdata/end_to_end/drop_table +++ b/pkg/sql/schemachanger/testdata/end_to_end/drop_table @@ -20,28 +20,7 @@ begin transaction #1 checking for feature: DROP TABLE increment telemetry for sql.schema.drop_table ## StatementPhase stage 1 of 1 with 1 MutationType op -upsert descriptor #107 - ... - formatVersion: 3 - id: 107 - - modificationTime: - - wallTime: "1640995200000000000" - + modificationTime: {} - name: t - nextColumnId: 4 - ... - nextIndexId: 2 - nextMutationId: 1 - + offlineReason: DROP TABLE db.sc.t - parentId: 104 - primaryIndex: - ... - replacementOf: - time: {} - + state: OFFLINE - unexposedParentSchemaId: 106 - - version: "1" - + version: "2" +added synthetic descriptor: name:"t" id:107 version:2 modification_time:<> parent_id:104 unexposed_parent_schema_id:106 columns: nullable:true hidden:false inaccessible:false generated_as_identity_type:NOT_IDENTITY_COLUMN virtual:false pg_attribute_num:0 alter_column_type_in_progress:false system_column_kind:NONE > columns: nullable:true hidden:false inaccessible:false generated_as_identity_type:NOT_IDENTITY_COLUMN virtual:false pg_attribute_num:0 alter_column_type_in_progress:false system_column_kind:NONE > columns: nullable:false default_expr:"unique_rowid()" hidden:true inaccessible:false generated_as_identity_type:NOT_IDENTITY_COLUMN virtual:false pg_attribute_num:0 alter_column_type_in_progress:false system_column_kind:NONE > next_column_id:4 families: next_family_id:1 primary_index: interleave:<> partitioning: type:FORWARD created_explicitly:false encoding_type:1 sharded: disabled:false geo_config:<> predicate:"" use_delete_preserving_encoding:false created_at_nanos:1640995200000000000 constraint_id:1 not_visible:false > next_index_id:2 privileges: users: owner_proto:"root" version:2 > next_mutation_id:1 format_version:3 state:DROP offline_reason:"" view_query:"" is_materialized_view:false refresh_view_required:false drop_time:0 replacement_of: > audit_mode:DISABLED drop_job_id:0 create_query:"" create_as_of_time: temporary:false partition_all_by:false exclude_data_from_backup:false next_constraint_id:2 import_start_wall_time:0 # end StatementPhase # begin PreCommitPhase ## PreCommitPhase stage 1 of 1 with 2 MutationType ops @@ -64,14 +43,11 @@ upsert descriptor #107 families: - columnIds: ... - formatVersion: 3 - id: 107 - - modificationTime: {} - + modificationTime: - + wallTime: "1640995200000000001" - name: t - nextColumnId: 4 - ... + replacementOf: + time: {} + - state: DROP + unexposedParentSchemaId: 106 + version: "2" create job #1 (non-cancelable: true): "DROP TABLE db.sc.t" descriptor IDs: [107] # end PreCommitPhase @@ -98,16 +74,9 @@ upsert descriptor #107 + modificationTime: {} name: t nextColumnId: 4 - ... - nextIndexId: 2 - nextMutationId: 1 - - offlineReason: DROP TABLE db.sc.t - parentId: 104 - primaryIndex: ... replacementOf: time: {} - - state: OFFLINE + state: DROP unexposedParentSchemaId: 106 - version: "2" diff --git a/pkg/sql/schemachanger/testdata/explain/drop_schema b/pkg/sql/schemachanger/testdata/explain/drop_schema index 9f2f3d43b082..404caa5c17de 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_schema +++ b/pkg/sql/schemachanger/testdata/explain/drop_schema @@ -9,9 +9,9 @@ Schema change plan for DROP SCHEMA ‹db›.‹sc›; ├── StatementPhase │ └── Stage 1 of 1 in StatementPhase │ ├── 1 element transitioning toward ABSENT - │ │ └── PUBLIC → OFFLINE Schema:{DescID: 106} + │ │ └── PUBLIC → TXN_DROPPED Schema:{DescID: 106} │ └── 1 Mutation operation - │ └── MarkDescriptorAsOffline {"DescID":106,"Reason":"DROP SCHEMA db.s..."} + │ └── MarkDescriptorAsSyntheticallyDropped {"DescID":106} ├── PreCommitPhase │ └── Stage 1 of 1 in PreCommitPhase │ └── 3 Mutation operations @@ -21,12 +21,12 @@ Schema change plan for DROP SCHEMA ‹db›.‹sc›; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase │ ├── 6 elements transitioning toward ABSENT - │ │ ├── PUBLIC → ABSENT Namespace:{DescID: 106, Name: sc, ReferencedDescID: 104} - │ │ ├── PUBLIC → ABSENT Owner:{DescID: 106} - │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 106, Name: admin} - │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 106, Name: root} - │ │ ├── OFFLINE → DROPPED Schema:{DescID: 106} - │ │ └── PUBLIC → ABSENT SchemaParent:{DescID: 106, ReferencedDescID: 104} + │ │ ├── PUBLIC → ABSENT Namespace:{DescID: 106, Name: sc, ReferencedDescID: 104} + │ │ ├── PUBLIC → ABSENT Owner:{DescID: 106} + │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 106, Name: admin} + │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 106, Name: root} + │ │ ├── TXN_DROPPED → DROPPED Schema:{DescID: 106} + │ │ └── PUBLIC → ABSENT SchemaParent:{DescID: 106, ReferencedDescID: 104} │ └── 6 Mutation operations │ ├── MarkDescriptorAsDropped {"DescID":106} │ ├── RemoveSchemaParent {"Parent":{"ParentDatabaseID":104,"SchemaID":106}} diff --git a/pkg/sql/schemachanger/testdata/explain/drop_table b/pkg/sql/schemachanger/testdata/explain/drop_table index 4e89110a60b9..c1b031146840 100644 --- a/pkg/sql/schemachanger/testdata/explain/drop_table +++ b/pkg/sql/schemachanger/testdata/explain/drop_table @@ -11,15 +11,15 @@ Schema change plan for DROP TABLE ‹db›.‹sc›.‹t›; ├── StatementPhase │ └── Stage 1 of 1 in StatementPhase │ ├── 7 elements transitioning toward ABSENT - │ │ ├── PUBLIC → OFFLINE Table:{DescID: 107} - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 107, ColumnID: 1} - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 107, ColumnID: 2} - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 107, ColumnID: 3} - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 107, ColumnID: 4294967295} - │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 107, ColumnID: 4294967294} - │ │ └── PUBLIC → VALIDATED PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 1} + │ │ ├── PUBLIC → TXN_DROPPED Table:{DescID: 107} + │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 107, ColumnID: 1} + │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 107, ColumnID: 2} + │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 107, ColumnID: 3} + │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 107, ColumnID: 4294967295} + │ │ ├── PUBLIC → WRITE_ONLY Column:{DescID: 107, ColumnID: 4294967294} + │ │ └── PUBLIC → VALIDATED PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 1} │ └── 1 Mutation operation - │ └── MarkDescriptorAsOffline {"DescID":107,"Reason":"DROP TABLE db.sc..."} + │ └── MarkDescriptorAsSyntheticallyDropped {"DescID":107} ├── PreCommitPhase │ └── Stage 1 of 1 in PreCommitPhase │ └── 2 Mutation operations @@ -28,34 +28,34 @@ Schema change plan for DROP TABLE ‹db›.‹sc›.‹t›; └── PostCommitNonRevertiblePhase ├── Stage 1 of 2 in PostCommitNonRevertiblePhase │ ├── 28 elements transitioning toward ABSENT - │ │ ├── PUBLIC → ABSENT Namespace:{DescID: 107, Name: t, ReferencedDescID: 104} - │ │ ├── PUBLIC → ABSENT Owner:{DescID: 107} - │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 107, Name: admin} - │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 107, Name: root} - │ │ ├── OFFLINE → DROPPED Table:{DescID: 107} - │ │ ├── PUBLIC → ABSENT ObjectParent:{DescID: 107, ReferencedDescID: 106} - │ │ ├── PUBLIC → ABSENT ColumnFamily:{DescID: 107, Name: primary, ColumnFamilyID: 0} - │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 107, ColumnID: 1} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 107, Name: k, ColumnID: 1} - │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 1} - │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 107, ColumnID: 2} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 107, Name: v, ColumnID: 2} - │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 2} - │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 107, ColumnID: 3} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 107, Name: rowid, ColumnID: 3} - │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 3} - │ │ ├── PUBLIC → ABSENT ColumnDefaultExpression:{DescID: 107, ColumnID: 3} - │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 107, ColumnID: 4294967295} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 107, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295} - │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 4294967295} - │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 107, ColumnID: 4294967294} - │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 107, Name: tableoid, ColumnID: 4294967294} - │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 4294967294} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 1} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 1} - │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 1} - │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 1} - │ │ └── PUBLIC → ABSENT IndexName:{DescID: 107, Name: t_pkey, IndexID: 1} + │ │ ├── PUBLIC → ABSENT Namespace:{DescID: 107, Name: t, ReferencedDescID: 104} + │ │ ├── PUBLIC → ABSENT Owner:{DescID: 107} + │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 107, Name: admin} + │ │ ├── PUBLIC → ABSENT UserPrivileges:{DescID: 107, Name: root} + │ │ ├── TXN_DROPPED → DROPPED Table:{DescID: 107} + │ │ ├── PUBLIC → ABSENT ObjectParent:{DescID: 107, ReferencedDescID: 106} + │ │ ├── PUBLIC → ABSENT ColumnFamily:{DescID: 107, Name: primary, ColumnFamilyID: 0} + │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 107, ColumnID: 1} + │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 107, Name: k, ColumnID: 1} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 1} + │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 107, ColumnID: 2} + │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 107, Name: v, ColumnID: 2} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 2} + │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 107, ColumnID: 3} + │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 107, Name: rowid, ColumnID: 3} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 3} + │ │ ├── PUBLIC → ABSENT ColumnDefaultExpression:{DescID: 107, ColumnID: 3} + │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 107, ColumnID: 4294967295} + │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 107, Name: crdb_internal_mvcc_timestamp, ColumnID: 4294967295} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 4294967295} + │ │ ├── WRITE_ONLY → DELETE_ONLY Column:{DescID: 107, ColumnID: 4294967294} + │ │ ├── PUBLIC → ABSENT ColumnName:{DescID: 107, Name: tableoid, ColumnID: 4294967294} + │ │ ├── PUBLIC → ABSENT ColumnType:{DescID: 107, ColumnFamilyID: 0, ColumnID: 4294967294} + │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 107, ColumnID: 3, IndexID: 1} + │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 107, ColumnID: 1, IndexID: 1} + │ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 107, ColumnID: 2, IndexID: 1} + │ │ ├── VALIDATED → DELETE_ONLY PrimaryIndex:{DescID: 107, IndexID: 1, ConstraintID: 1} + │ │ └── PUBLIC → ABSENT IndexName:{DescID: 107, Name: t_pkey, IndexID: 1} │ └── 6 Mutation operations │ ├── MarkDescriptorAsDropped {"DescID":107} │ ├── RemoveAllTableComments {"TableID":107} diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_schema b/pkg/sql/schemachanger/testdata/explain_verbose/drop_schema index e29c61ae482b..57b7ddf922c7 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_schema +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_schema @@ -14,13 +14,12 @@ EXPLAIN (ddl, verbose) DROP SCHEMA db.sc; │ ├── • 1 element transitioning toward ABSENT │ │ │ │ │ └── • Schema:{DescID: 106} -│ │ PUBLIC → OFFLINE +│ │ PUBLIC → TXN_DROPPED │ │ │ └── • 1 Mutation operation │ │ -│ └── • MarkDescriptorAsOffline +│ └── • MarkDescriptorAsSyntheticallyDropped │ DescID: 106 -│ Reason: DROP SCHEMA db.sc │ ├── • PreCommitPhase │ │ @@ -90,7 +89,7 @@ EXPLAIN (ddl, verbose) DROP SCHEMA db.sc; │ │ │ rule: "skip element removal ops on descriptor drop" │ │ │ │ │ ├── • Schema:{DescID: 106} - │ │ │ OFFLINE → DROPPED + │ │ │ TXN_DROPPED → DROPPED │ │ │ │ │ └── • SchemaParent:{DescID: 106, ReferencedDescID: 104} │ │ │ PUBLIC → ABSENT diff --git a/pkg/sql/schemachanger/testdata/explain_verbose/drop_table b/pkg/sql/schemachanger/testdata/explain_verbose/drop_table index 9e8e6d5b1379..4a8ef60f7d6a 100644 --- a/pkg/sql/schemachanger/testdata/explain_verbose/drop_table +++ b/pkg/sql/schemachanger/testdata/explain_verbose/drop_table @@ -16,7 +16,7 @@ EXPLAIN (ddl, verbose) DROP TABLE db.sc.t; │ ├── • 7 elements transitioning toward ABSENT │ │ │ │ │ ├── • Table:{DescID: 107} -│ │ │ PUBLIC → OFFLINE +│ │ │ PUBLIC → TXN_DROPPED │ │ │ │ │ ├── • Column:{DescID: 107, ColumnID: 1} │ │ │ │ PUBLIC → WRITE_ONLY @@ -56,9 +56,8 @@ EXPLAIN (ddl, verbose) DROP TABLE db.sc.t; │ │ │ └── • 1 Mutation operation │ │ -│ └── • MarkDescriptorAsOffline +│ └── • MarkDescriptorAsSyntheticallyDropped │ DescID: 107 -│ Reason: DROP TABLE db.sc.t │ ├── • PreCommitPhase │ │ @@ -123,7 +122,7 @@ EXPLAIN (ddl, verbose) DROP TABLE db.sc.t; │ │ │ rule: "skip element removal ops on descriptor drop" │ │ │ │ │ ├── • Table:{DescID: 107} - │ │ │ OFFLINE → DROPPED + │ │ │ TXN_DROPPED → DROPPED │ │ │ │ │ ├── • ObjectParent:{DescID: 107, ReferencedDescID: 106} │ │ │ │ PUBLIC → ABSENT