From 866d217ac230ede9a0cc2f25f103464e37aa95b3 Mon Sep 17 00:00:00 2001 From: Annie Pompa Date: Fri, 30 Aug 2024 14:30:27 -0400 Subject: [PATCH] schemachanger: support partition zone config This patch adds the functionality to configure a zone configuration on a partition. Fixes: #129889 Release note: None --- .../logic_test/multi_region_zone_configs | 2 +- .../schemachangerccl/ccl_generated_test.go | 140 ++++++++ .../alter_partition_configure_zone.definition | 13 + .../alter_partition_configure_zone.explain | 30 ++ ...ter_partition_configure_zone.explain_shape | 14 + ...lter_partition_configure_zone.side_effects | 38 +++ ...rtition_configure_zone_multiple.definition | 20 ++ ...ition_configure_zone_multiple.side_effects | 78 +++++ ...re_zone_multiple__statement_1_of_4.explain | 34 ++ ...e_multiple__statement_1_of_4.explain_shape | 18 ++ ...re_zone_multiple__statement_2_of_4.explain | 38 +++ ...e_multiple__statement_2_of_4.explain_shape | 19 ++ ...re_zone_multiple__statement_3_of_4.explain | 42 +++ ...e_multiple__statement_3_of_4.explain_shape | 20 ++ ...re_zone_multiple__statement_4_of_4.explain | 46 +++ ...e_multiple__statement_4_of_4.explain_shape | 21 ++ .../scbuild/internal/scbuildstmt/BUILD.bazel | 1 + .../internal/scbuildstmt/configure_zone.go | 23 +- .../scbuildstmt/database_zone_config.go | 7 +- .../internal/scbuildstmt/index_zone_config.go | 10 +- .../scbuildstmt/partition_zone_config.go | 305 +++++++++++++++++- .../internal/scbuildstmt/table_zone_config.go | 7 +- .../scbuildstmt/zone_config_helpers.go | 24 +- pkg/sql/schemachanger/scpb/state.go | 9 + .../scplan/internal/rules/current/helpers.go | 2 +- .../internal/rules/current/testdata/deprules | 64 ++-- .../internal/rules/release_24_1/helpers.go | 2 +- .../internal/rules/release_24_2/helpers.go | 2 +- 28 files changed, 952 insertions(+), 77 deletions(-) create mode 100644 pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone/alter_partition_configure_zone.definition create mode 100644 pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone/alter_partition_configure_zone.explain create mode 100644 pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone/alter_partition_configure_zone.explain_shape create mode 100644 pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone/alter_partition_configure_zone.side_effects create mode 100644 pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple.definition create mode 100644 pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple.side_effects create mode 100644 pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_1_of_4.explain create mode 100644 pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_1_of_4.explain_shape create mode 100644 pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_2_of_4.explain create mode 100644 pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_2_of_4.explain_shape create mode 100644 pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_3_of_4.explain create mode 100644 pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_3_of_4.explain_shape create mode 100644 pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_4_of_4.explain create mode 100644 pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_4_of_4.explain_shape diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_configs b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_configs index 2f5efacb9af4..53ef37ec6b5a 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_configs +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_configs @@ -528,7 +528,7 @@ statement ok ALTER partition "us-east-1" of index regional_by_row@regional_by_row_pkey CONFIGURE ZONE USING num_replicas = 10; statement ok -SET override_multi_region_zone_config = false +SET override_multi_region_zone_config = false; query TTT SELECT ZONE_config, index_name, partition_name FROM [SHOW PARTITIONS FROM TABLE regional_by_row] diff --git a/pkg/ccl/schemachangerccl/ccl_generated_test.go b/pkg/ccl/schemachangerccl/ccl_generated_test.go index b25638806deb..9af221c37133 100644 --- a/pkg/ccl/schemachangerccl/ccl_generated_test.go +++ b/pkg/ccl/schemachangerccl/ccl_generated_test.go @@ -29,6 +29,20 @@ func TestBackupRollbacks_ccl_alter_index_configure_zone_multiple(t *testing.T) { sctest.BackupRollbacks(t, path, MultiRegionTestClusterFactory{}) } +func TestBackupRollbacks_ccl_alter_partition_configure_zone(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + const path = "pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone" + sctest.BackupRollbacks(t, path, MultiRegionTestClusterFactory{}) +} + +func TestBackupRollbacks_ccl_alter_partition_configure_zone_multiple(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + const path = "pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple" + sctest.BackupRollbacks(t, path, MultiRegionTestClusterFactory{}) +} + func TestBackupRollbacks_ccl_create_index(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) @@ -71,6 +85,20 @@ func TestBackupRollbacksMixedVersion_ccl_alter_index_configure_zone_multiple(t * sctest.BackupRollbacksMixedVersion(t, path, MultiRegionTestClusterFactory{}) } +func TestBackupRollbacksMixedVersion_ccl_alter_partition_configure_zone(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + const path = "pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone" + sctest.BackupRollbacksMixedVersion(t, path, MultiRegionTestClusterFactory{}) +} + +func TestBackupRollbacksMixedVersion_ccl_alter_partition_configure_zone_multiple(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + const path = "pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple" + sctest.BackupRollbacksMixedVersion(t, path, MultiRegionTestClusterFactory{}) +} + func TestBackupRollbacksMixedVersion_ccl_create_index(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) @@ -113,6 +141,20 @@ func TestBackupSuccess_ccl_alter_index_configure_zone_multiple(t *testing.T) { sctest.BackupSuccess(t, path, MultiRegionTestClusterFactory{}) } +func TestBackupSuccess_ccl_alter_partition_configure_zone(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + const path = "pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone" + sctest.BackupSuccess(t, path, MultiRegionTestClusterFactory{}) +} + +func TestBackupSuccess_ccl_alter_partition_configure_zone_multiple(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + const path = "pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple" + sctest.BackupSuccess(t, path, MultiRegionTestClusterFactory{}) +} + func TestBackupSuccess_ccl_create_index(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) @@ -155,6 +197,20 @@ func TestBackupSuccessMixedVersion_ccl_alter_index_configure_zone_multiple(t *te sctest.BackupSuccessMixedVersion(t, path, MultiRegionTestClusterFactory{}) } +func TestBackupSuccessMixedVersion_ccl_alter_partition_configure_zone(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + const path = "pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone" + sctest.BackupSuccessMixedVersion(t, path, MultiRegionTestClusterFactory{}) +} + +func TestBackupSuccessMixedVersion_ccl_alter_partition_configure_zone_multiple(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + const path = "pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple" + sctest.BackupSuccessMixedVersion(t, path, MultiRegionTestClusterFactory{}) +} + func TestBackupSuccessMixedVersion_ccl_create_index(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) @@ -197,6 +253,20 @@ func TestEndToEndSideEffects_ccl_alter_index_configure_zone_multiple(t *testing. sctest.EndToEndSideEffects(t, path, MultiRegionTestClusterFactory{}) } +func TestEndToEndSideEffects_ccl_alter_partition_configure_zone(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + const path = "pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone" + sctest.EndToEndSideEffects(t, path, MultiRegionTestClusterFactory{}) +} + +func TestEndToEndSideEffects_ccl_alter_partition_configure_zone_multiple(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + const path = "pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple" + sctest.EndToEndSideEffects(t, path, MultiRegionTestClusterFactory{}) +} + func TestEndToEndSideEffects_ccl_create_index(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) @@ -239,6 +309,20 @@ func TestExecuteWithDMLInjection_ccl_alter_index_configure_zone_multiple(t *test sctest.ExecuteWithDMLInjection(t, path, MultiRegionTestClusterFactory{}) } +func TestExecuteWithDMLInjection_ccl_alter_partition_configure_zone(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + const path = "pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone" + sctest.ExecuteWithDMLInjection(t, path, MultiRegionTestClusterFactory{}) +} + +func TestExecuteWithDMLInjection_ccl_alter_partition_configure_zone_multiple(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + const path = "pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple" + sctest.ExecuteWithDMLInjection(t, path, MultiRegionTestClusterFactory{}) +} + func TestExecuteWithDMLInjection_ccl_create_index(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) @@ -281,6 +365,20 @@ func TestGenerateSchemaChangeCorpus_ccl_alter_index_configure_zone_multiple(t *t sctest.GenerateSchemaChangeCorpus(t, path, MultiRegionTestClusterFactory{}) } +func TestGenerateSchemaChangeCorpus_ccl_alter_partition_configure_zone(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + const path = "pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone" + sctest.GenerateSchemaChangeCorpus(t, path, MultiRegionTestClusterFactory{}) +} + +func TestGenerateSchemaChangeCorpus_ccl_alter_partition_configure_zone_multiple(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + const path = "pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple" + sctest.GenerateSchemaChangeCorpus(t, path, MultiRegionTestClusterFactory{}) +} + func TestGenerateSchemaChangeCorpus_ccl_create_index(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) @@ -323,6 +421,20 @@ func TestPause_ccl_alter_index_configure_zone_multiple(t *testing.T) { sctest.Pause(t, path, MultiRegionTestClusterFactory{}) } +func TestPause_ccl_alter_partition_configure_zone(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + const path = "pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone" + sctest.Pause(t, path, MultiRegionTestClusterFactory{}) +} + +func TestPause_ccl_alter_partition_configure_zone_multiple(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + const path = "pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple" + sctest.Pause(t, path, MultiRegionTestClusterFactory{}) +} + func TestPause_ccl_create_index(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) @@ -365,6 +477,20 @@ func TestPauseMixedVersion_ccl_alter_index_configure_zone_multiple(t *testing.T) sctest.PauseMixedVersion(t, path, MultiRegionTestClusterFactory{}) } +func TestPauseMixedVersion_ccl_alter_partition_configure_zone(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + const path = "pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone" + sctest.PauseMixedVersion(t, path, MultiRegionTestClusterFactory{}) +} + +func TestPauseMixedVersion_ccl_alter_partition_configure_zone_multiple(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + const path = "pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple" + sctest.PauseMixedVersion(t, path, MultiRegionTestClusterFactory{}) +} + func TestPauseMixedVersion_ccl_create_index(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) @@ -407,6 +533,20 @@ func TestRollback_ccl_alter_index_configure_zone_multiple(t *testing.T) { sctest.Rollback(t, path, MultiRegionTestClusterFactory{}) } +func TestRollback_ccl_alter_partition_configure_zone(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + const path = "pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone" + sctest.Rollback(t, path, MultiRegionTestClusterFactory{}) +} + +func TestRollback_ccl_alter_partition_configure_zone_multiple(t *testing.T) { + defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + const path = "pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple" + sctest.Rollback(t, path, MultiRegionTestClusterFactory{}) +} + func TestRollback_ccl_create_index(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) diff --git a/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone/alter_partition_configure_zone.definition b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone/alter_partition_configure_zone.definition new file mode 100644 index 000000000000..648e18d5f849 --- /dev/null +++ b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone/alter_partition_configure_zone.definition @@ -0,0 +1,13 @@ +setup +CREATE TABLE t ( + id INT PRIMARY KEY, + data STRING +) PARTITION BY LIST (id) ( + PARTITION p1 VALUES IN (1, 2, 3), + PARTITION p2 VALUES IN (4, 5, 6) +); +---- + +test +ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING num_replicas = 7, gc.ttlseconds = 10000; +---- diff --git a/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone/alter_partition_configure_zone.explain b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone/alter_partition_configure_zone.explain new file mode 100644 index 000000000000..9778e34fcc81 --- /dev/null +++ b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone/alter_partition_configure_zone.explain @@ -0,0 +1,30 @@ +/* setup */ +CREATE TABLE t ( + id INT PRIMARY KEY, + data STRING +) PARTITION BY LIST (id) ( + PARTITION p1 VALUES IN (1, 2, 3), + PARTITION p2 VALUES IN (4, 5, 6) +); + +/* test */ +EXPLAIN (DDL) ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING num_replicas = 7, gc.ttlseconds = 10000; +---- +Schema change plan for ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹num_replicas› = ‹7›, ‹"gc.ttlseconds"› = ‹10000›; + ├── StatementPhase + │ └── Stage 1 of 1 in StatementPhase + │ ├── 1 element transitioning toward PUBLIC + │ │ └── ABSENT → PUBLIC PartitionZoneConfig:{DescID: 104 (t), IndexID: 1 (t_pkey), SeqNum: 1, PartitionName: "p1"} + │ └── 1 Mutation operation + │ └── AddPartitionZoneConfig {"TableID":104} + └── PreCommitPhase + ├── Stage 1 of 2 in PreCommitPhase + │ ├── 1 element transitioning toward PUBLIC + │ │ └── PUBLIC → ABSENT PartitionZoneConfig:{DescID: 104 (t), IndexID: 1 (t_pkey), SeqNum: 1, PartitionName: "p1"} + │ └── 1 Mutation operation + │ └── UndoAllInTxnImmediateMutationOpSideEffects + └── Stage 2 of 2 in PreCommitPhase + ├── 1 element transitioning toward PUBLIC + │ └── ABSENT → PUBLIC PartitionZoneConfig:{DescID: 104 (t), IndexID: 1 (t_pkey), SeqNum: 1, PartitionName: "p1"} + └── 1 Mutation operation + └── AddPartitionZoneConfig {"TableID":104} diff --git a/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone/alter_partition_configure_zone.explain_shape b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone/alter_partition_configure_zone.explain_shape new file mode 100644 index 000000000000..16a390f221e4 --- /dev/null +++ b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone/alter_partition_configure_zone.explain_shape @@ -0,0 +1,14 @@ +/* setup */ +CREATE TABLE t ( + id INT PRIMARY KEY, + data STRING +) PARTITION BY LIST (id) ( + PARTITION p1 VALUES IN (1, 2, 3), + PARTITION p2 VALUES IN (4, 5, 6) +); + +/* test */ +EXPLAIN (DDL, SHAPE) ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING num_replicas = 7, gc.ttlseconds = 10000; +---- +Schema change plan for ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹num_replicas› = ‹7›, ‹"gc.ttlseconds"› = ‹10000›; + └── execute 1 system table mutations transaction diff --git a/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone/alter_partition_configure_zone.side_effects b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone/alter_partition_configure_zone.side_effects new file mode 100644 index 000000000000..689270af7992 --- /dev/null +++ b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone/alter_partition_configure_zone.side_effects @@ -0,0 +1,38 @@ +/* setup */ +CREATE TABLE t ( + id INT PRIMARY KEY, + data STRING +) PARTITION BY LIST (id) ( + PARTITION p1 VALUES IN (1, 2, 3), + PARTITION p2 VALUES IN (4, 5, 6) +); +---- +... ++object {100 101 t} -> 104 + +/* test */ +ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING num_replicas = 7, gc.ttlseconds = 10000; +---- +begin transaction #1 +# begin StatementPhase +checking for feature: CONFIGURE ZONE +write *eventpb.AlterTable to event log: + mutationId: 1 + sql: + descriptorId: 104 + statement: ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹num_replicas› = ‹7›, ‹"gc.ttlseconds"› = ‹10000› + tag: CONFIGURE ZONE + user: root + tableName: defaultdb.public.t +## StatementPhase stage 1 of 1 with 1 MutationType op +upsert zone config for #104 +# end StatementPhase +# begin PreCommitPhase +## PreCommitPhase stage 1 of 2 with 1 MutationType op +undo all catalog changes within txn #1 +persist all catalog changes to storage +## PreCommitPhase stage 2 of 2 with 1 MutationType op +upsert zone config for #104 +persist all catalog changes to storage +# end PreCommitPhase +commit transaction #1 diff --git a/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple.definition b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple.definition new file mode 100644 index 000000000000..870390cb98a2 --- /dev/null +++ b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple.definition @@ -0,0 +1,20 @@ +setup +CREATE TABLE t ( + id INT PRIMARY KEY, + data INT, + INDEX idx (data) PARTITION BY LIST (data) ( + PARTITION p1 VALUES IN (10, 20, 30), + PARTITION p2 VALUES IN (40, 50, 60) + ) +) PARTITION BY LIST (id) ( + PARTITION p1 VALUES IN (1, 2, 3), + PARTITION p2 VALUES IN (4, 5, 6) +); +---- + +test +ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING num_replicas = 7; +ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING gc.ttlseconds = 10000; +ALTER PARTITION p1 OF INDEX t@idx CONFIGURE ZONE USING gc.ttlseconds = 12000; +ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING num_replicas = 10; +---- diff --git a/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple.side_effects b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple.side_effects new file mode 100644 index 000000000000..09a9d46e4f44 --- /dev/null +++ b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple.side_effects @@ -0,0 +1,78 @@ +/* setup */ +CREATE TABLE t ( + id INT PRIMARY KEY, + data INT, + INDEX idx (data) PARTITION BY LIST (data) ( + PARTITION p1 VALUES IN (10, 20, 30), + PARTITION p2 VALUES IN (40, 50, 60) + ) +) PARTITION BY LIST (id) ( + PARTITION p1 VALUES IN (1, 2, 3), + PARTITION p2 VALUES IN (4, 5, 6) +); +---- +... ++object {100 101 t} -> 104 + +/* test */ +ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING num_replicas = 7; +ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING gc.ttlseconds = 10000; +ALTER PARTITION p1 OF INDEX t@idx CONFIGURE ZONE USING gc.ttlseconds = 12000; +ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING num_replicas = 10; +---- +begin transaction #1 +# begin StatementPhase +checking for feature: CONFIGURE ZONE +write *eventpb.AlterTable to event log: + mutationId: 1 + sql: + descriptorId: 104 + statement: ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹num_replicas› = ‹7› + tag: CONFIGURE ZONE + user: root + tableName: defaultdb.public.t +## StatementPhase stage 1 of 1 with 1 MutationType op +upsert zone config for #104 +checking for feature: CONFIGURE ZONE +write *eventpb.AlterTable to event log: + mutationId: 1 + sql: + descriptorId: 104 + statement: ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹"gc.ttlseconds"› = ‹10000› + tag: CONFIGURE ZONE + user: root + tableName: defaultdb.public.t +## StatementPhase stage 1 of 1 with 1 MutationType op +upsert zone config for #104 +checking for feature: CONFIGURE ZONE +write *eventpb.AlterTable to event log: + mutationId: 1 + sql: + descriptorId: 104 + statement: ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CONFIGURE ZONE USING ‹"gc.ttlseconds"› = ‹12000› + tag: CONFIGURE ZONE + user: root + tableName: defaultdb.public.t +## StatementPhase stage 1 of 1 with 1 MutationType op +upsert zone config for #104 +checking for feature: CONFIGURE ZONE +write *eventpb.AlterTable to event log: + mutationId: 1 + sql: + descriptorId: 104 + statement: ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹num_replicas› = ‹10› + tag: CONFIGURE ZONE + user: root + tableName: defaultdb.public.t +## StatementPhase stage 1 of 1 with 1 MutationType op +upsert zone config for #104 +# end StatementPhase +# begin PreCommitPhase +## PreCommitPhase stage 1 of 2 with 1 MutationType op +undo all catalog changes within txn #1 +persist all catalog changes to storage +## PreCommitPhase stage 2 of 2 with 4 MutationType ops +upsert zone config for #104 +persist all catalog changes to storage +# end PreCommitPhase +commit transaction #1 diff --git a/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_1_of_4.explain b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_1_of_4.explain new file mode 100644 index 000000000000..4de990982346 --- /dev/null +++ b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_1_of_4.explain @@ -0,0 +1,34 @@ +/* setup */ +CREATE TABLE t ( + id INT PRIMARY KEY, + data INT, + INDEX idx (data) PARTITION BY LIST (data) ( + PARTITION p1 VALUES IN (10, 20, 30), + PARTITION p2 VALUES IN (40, 50, 60) + ) +) PARTITION BY LIST (id) ( + PARTITION p1 VALUES IN (1, 2, 3), + PARTITION p2 VALUES IN (4, 5, 6) +); + +/* test */ +EXPLAIN (DDL) ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING num_replicas = 7; +---- +Schema change plan for ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹num_replicas› = ‹7›; + ├── StatementPhase + │ └── Stage 1 of 1 in StatementPhase + │ ├── 1 element transitioning toward PUBLIC + │ │ └── ABSENT → PUBLIC PartitionZoneConfig:{DescID: 104 (t), IndexID: 1 (t_pkey), SeqNum: 1, PartitionName: "p1"} + │ └── 1 Mutation operation + │ └── AddPartitionZoneConfig {"IndexID":1,"PartitionName":"p1","TableID":104} + └── PreCommitPhase + ├── Stage 1 of 2 in PreCommitPhase + │ ├── 1 element transitioning toward PUBLIC + │ │ └── PUBLIC → ABSENT PartitionZoneConfig:{DescID: 104 (t), IndexID: 1 (t_pkey), SeqNum: 1, PartitionName: "p1"} + │ └── 1 Mutation operation + │ └── UndoAllInTxnImmediateMutationOpSideEffects + └── Stage 2 of 2 in PreCommitPhase + ├── 1 element transitioning toward PUBLIC + │ └── ABSENT → PUBLIC PartitionZoneConfig:{DescID: 104 (t), IndexID: 1 (t_pkey), SeqNum: 1, PartitionName: "p1"} + └── 1 Mutation operation + └── AddPartitionZoneConfig {"IndexID":1,"PartitionName":"p1","TableID":104} diff --git a/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_1_of_4.explain_shape b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_1_of_4.explain_shape new file mode 100644 index 000000000000..822dcc966920 --- /dev/null +++ b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_1_of_4.explain_shape @@ -0,0 +1,18 @@ +/* setup */ +CREATE TABLE t ( + id INT PRIMARY KEY, + data INT, + INDEX idx (data) PARTITION BY LIST (data) ( + PARTITION p1 VALUES IN (10, 20, 30), + PARTITION p2 VALUES IN (40, 50, 60) + ) +) PARTITION BY LIST (id) ( + PARTITION p1 VALUES IN (1, 2, 3), + PARTITION p2 VALUES IN (4, 5, 6) +); + +/* test */ +EXPLAIN (DDL, SHAPE) ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING num_replicas = 7; +---- +Schema change plan for ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹num_replicas› = ‹7›; + └── execute 1 system table mutations transaction diff --git a/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_2_of_4.explain b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_2_of_4.explain new file mode 100644 index 000000000000..e81355127f46 --- /dev/null +++ b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_2_of_4.explain @@ -0,0 +1,38 @@ +/* setup */ +CREATE TABLE t ( + id INT PRIMARY KEY, + data INT, + INDEX idx (data) PARTITION BY LIST (data) ( + PARTITION p1 VALUES IN (10, 20, 30), + PARTITION p2 VALUES IN (40, 50, 60) + ) +) PARTITION BY LIST (id) ( + PARTITION p1 VALUES IN (1, 2, 3), + PARTITION p2 VALUES IN (4, 5, 6) +); + +/* test */ +ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING num_replicas = 7; +EXPLAIN (DDL) ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING gc.ttlseconds = 10000; +---- +Schema change plan for ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹"gc.ttlseconds"› = ‹10000›; following ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹num_replicas› = ‹7›; + ├── StatementPhase + │ └── Stage 1 of 1 in StatementPhase + │ ├── 1 element transitioning toward PUBLIC + │ │ └── ABSENT → PUBLIC PartitionZoneConfig:{DescID: 104 (t), IndexID: 1 (t_pkey), SeqNum: 2, PartitionName: "p1"} + │ └── 1 Mutation operation + │ └── AddPartitionZoneConfig {"IndexID":1,"PartitionName":"p1","TableID":104} + └── PreCommitPhase + ├── Stage 1 of 2 in PreCommitPhase + │ ├── 2 elements transitioning toward PUBLIC + │ │ ├── PUBLIC → ABSENT PartitionZoneConfig:{DescID: 104 (t), IndexID: 1 (t_pkey), SeqNum: 1, PartitionName: "p1"} + │ │ └── PUBLIC → ABSENT PartitionZoneConfig:{DescID: 104 (t), IndexID: 1 (t_pkey), SeqNum: 2, PartitionName: "p1"} + │ └── 1 Mutation operation + │ └── UndoAllInTxnImmediateMutationOpSideEffects + └── Stage 2 of 2 in PreCommitPhase + ├── 2 elements transitioning toward PUBLIC + │ ├── ABSENT → PUBLIC PartitionZoneConfig:{DescID: 104 (t), IndexID: 1 (t_pkey), SeqNum: 1, PartitionName: "p1"} + │ └── ABSENT → PUBLIC PartitionZoneConfig:{DescID: 104 (t), IndexID: 1 (t_pkey), SeqNum: 2, PartitionName: "p1"} + └── 2 Mutation operations + ├── AddPartitionZoneConfig {"IndexID":1,"PartitionName":"p1","TableID":104} + └── AddPartitionZoneConfig {"IndexID":1,"PartitionName":"p1","TableID":104} diff --git a/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_2_of_4.explain_shape b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_2_of_4.explain_shape new file mode 100644 index 000000000000..9aec04588e83 --- /dev/null +++ b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_2_of_4.explain_shape @@ -0,0 +1,19 @@ +/* setup */ +CREATE TABLE t ( + id INT PRIMARY KEY, + data INT, + INDEX idx (data) PARTITION BY LIST (data) ( + PARTITION p1 VALUES IN (10, 20, 30), + PARTITION p2 VALUES IN (40, 50, 60) + ) +) PARTITION BY LIST (id) ( + PARTITION p1 VALUES IN (1, 2, 3), + PARTITION p2 VALUES IN (4, 5, 6) +); + +/* test */ +ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING num_replicas = 7; +EXPLAIN (DDL, SHAPE) ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING gc.ttlseconds = 10000; +---- +Schema change plan for ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹"gc.ttlseconds"› = ‹10000›; following ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹num_replicas› = ‹7›; + └── execute 1 system table mutations transaction diff --git a/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_3_of_4.explain b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_3_of_4.explain new file mode 100644 index 000000000000..e6e30e4f12e5 --- /dev/null +++ b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_3_of_4.explain @@ -0,0 +1,42 @@ +/* setup */ +CREATE TABLE t ( + id INT PRIMARY KEY, + data INT, + INDEX idx (data) PARTITION BY LIST (data) ( + PARTITION p1 VALUES IN (10, 20, 30), + PARTITION p2 VALUES IN (40, 50, 60) + ) +) PARTITION BY LIST (id) ( + PARTITION p1 VALUES IN (1, 2, 3), + PARTITION p2 VALUES IN (4, 5, 6) +); + +/* test */ +ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING num_replicas = 7; +ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING gc.ttlseconds = 10000; +EXPLAIN (DDL) ALTER PARTITION p1 OF INDEX t@idx CONFIGURE ZONE USING gc.ttlseconds = 12000; +---- +Schema change plan for ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CONFIGURE ZONE USING ‹"gc.ttlseconds"› = ‹12000›; following ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹num_replicas› = ‹7›; ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹"gc.ttlseconds"› = ‹10000›; + ├── StatementPhase + │ └── Stage 1 of 1 in StatementPhase + │ ├── 1 element transitioning toward PUBLIC + │ │ └── ABSENT → PUBLIC PartitionZoneConfig:{DescID: 104 (t), IndexID: 2 (idx), SeqNum: 1, PartitionName: "p1"} + │ └── 1 Mutation operation + │ └── AddPartitionZoneConfig {"IndexID":2,"PartitionName":"p1","TableID":104} + └── PreCommitPhase + ├── Stage 1 of 2 in PreCommitPhase + │ ├── 3 elements transitioning toward PUBLIC + │ │ ├── PUBLIC → ABSENT PartitionZoneConfig:{DescID: 104 (t), IndexID: 1 (t_pkey), SeqNum: 1, PartitionName: "p1"} + │ │ ├── PUBLIC → ABSENT PartitionZoneConfig:{DescID: 104 (t), IndexID: 1 (t_pkey), SeqNum: 2, PartitionName: "p1"} + │ │ └── PUBLIC → ABSENT PartitionZoneConfig:{DescID: 104 (t), IndexID: 2 (idx), SeqNum: 1, PartitionName: "p1"} + │ └── 1 Mutation operation + │ └── UndoAllInTxnImmediateMutationOpSideEffects + └── Stage 2 of 2 in PreCommitPhase + ├── 3 elements transitioning toward PUBLIC + │ ├── ABSENT → PUBLIC PartitionZoneConfig:{DescID: 104 (t), IndexID: 1 (t_pkey), SeqNum: 1, PartitionName: "p1"} + │ ├── ABSENT → PUBLIC PartitionZoneConfig:{DescID: 104 (t), IndexID: 1 (t_pkey), SeqNum: 2, PartitionName: "p1"} + │ └── ABSENT → PUBLIC PartitionZoneConfig:{DescID: 104 (t), IndexID: 2 (idx), SeqNum: 1, PartitionName: "p1"} + └── 3 Mutation operations + ├── AddPartitionZoneConfig {"IndexID":1,"PartitionName":"p1","TableID":104} + ├── AddPartitionZoneConfig {"IndexID":1,"PartitionName":"p1","TableID":104} + └── AddPartitionZoneConfig {"IndexID":2,"PartitionName":"p1","TableID":104} diff --git a/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_3_of_4.explain_shape b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_3_of_4.explain_shape new file mode 100644 index 000000000000..234e9167a814 --- /dev/null +++ b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_3_of_4.explain_shape @@ -0,0 +1,20 @@ +/* setup */ +CREATE TABLE t ( + id INT PRIMARY KEY, + data INT, + INDEX idx (data) PARTITION BY LIST (data) ( + PARTITION p1 VALUES IN (10, 20, 30), + PARTITION p2 VALUES IN (40, 50, 60) + ) +) PARTITION BY LIST (id) ( + PARTITION p1 VALUES IN (1, 2, 3), + PARTITION p2 VALUES IN (4, 5, 6) +); + +/* test */ +ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING num_replicas = 7; +ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING gc.ttlseconds = 10000; +EXPLAIN (DDL, SHAPE) ALTER PARTITION p1 OF INDEX t@idx CONFIGURE ZONE USING gc.ttlseconds = 12000; +---- +Schema change plan for ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CONFIGURE ZONE USING ‹"gc.ttlseconds"› = ‹12000›; following ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹num_replicas› = ‹7›; ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹"gc.ttlseconds"› = ‹10000›; + └── execute 1 system table mutations transaction diff --git a/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_4_of_4.explain b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_4_of_4.explain new file mode 100644 index 000000000000..681ad18088a2 --- /dev/null +++ b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_4_of_4.explain @@ -0,0 +1,46 @@ +/* setup */ +CREATE TABLE t ( + id INT PRIMARY KEY, + data INT, + INDEX idx (data) PARTITION BY LIST (data) ( + PARTITION p1 VALUES IN (10, 20, 30), + PARTITION p2 VALUES IN (40, 50, 60) + ) +) PARTITION BY LIST (id) ( + PARTITION p1 VALUES IN (1, 2, 3), + PARTITION p2 VALUES IN (4, 5, 6) +); + +/* test */ +ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING num_replicas = 7; +ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING gc.ttlseconds = 10000; +ALTER PARTITION p1 OF INDEX t@idx CONFIGURE ZONE USING gc.ttlseconds = 12000; +EXPLAIN (DDL) ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING num_replicas = 10; +---- +Schema change plan for ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹num_replicas› = ‹10›; following ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹num_replicas› = ‹7›; ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹"gc.ttlseconds"› = ‹10000›; ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CONFIGURE ZONE USING ‹"gc.ttlseconds"› = ‹12000›; + ├── StatementPhase + │ └── Stage 1 of 1 in StatementPhase + │ ├── 1 element transitioning toward PUBLIC + │ │ └── ABSENT → PUBLIC PartitionZoneConfig:{DescID: 104 (t), IndexID: 1 (t_pkey), SeqNum: 3, PartitionName: "p1"} + │ └── 1 Mutation operation + │ └── AddPartitionZoneConfig {"IndexID":1,"PartitionName":"p1","TableID":104} + └── PreCommitPhase + ├── Stage 1 of 2 in PreCommitPhase + │ ├── 4 elements transitioning toward PUBLIC + │ │ ├── PUBLIC → ABSENT PartitionZoneConfig:{DescID: 104 (t), IndexID: 1 (t_pkey), SeqNum: 1, PartitionName: "p1"} + │ │ ├── PUBLIC → ABSENT PartitionZoneConfig:{DescID: 104 (t), IndexID: 1 (t_pkey), SeqNum: 2, PartitionName: "p1"} + │ │ ├── PUBLIC → ABSENT PartitionZoneConfig:{DescID: 104 (t), IndexID: 2 (idx), SeqNum: 1, PartitionName: "p1"} + │ │ └── PUBLIC → ABSENT PartitionZoneConfig:{DescID: 104 (t), IndexID: 1 (t_pkey), SeqNum: 3, PartitionName: "p1"} + │ └── 1 Mutation operation + │ └── UndoAllInTxnImmediateMutationOpSideEffects + └── Stage 2 of 2 in PreCommitPhase + ├── 4 elements transitioning toward PUBLIC + │ ├── ABSENT → PUBLIC PartitionZoneConfig:{DescID: 104 (t), IndexID: 1 (t_pkey), SeqNum: 1, PartitionName: "p1"} + │ ├── ABSENT → PUBLIC PartitionZoneConfig:{DescID: 104 (t), IndexID: 1 (t_pkey), SeqNum: 2, PartitionName: "p1"} + │ ├── ABSENT → PUBLIC PartitionZoneConfig:{DescID: 104 (t), IndexID: 2 (idx), SeqNum: 1, PartitionName: "p1"} + │ └── ABSENT → PUBLIC PartitionZoneConfig:{DescID: 104 (t), IndexID: 1 (t_pkey), SeqNum: 3, PartitionName: "p1"} + └── 4 Mutation operations + ├── AddPartitionZoneConfig {"IndexID":1,"PartitionName":"p1","TableID":104} + ├── AddPartitionZoneConfig {"IndexID":1,"PartitionName":"p1","TableID":104} + ├── AddPartitionZoneConfig {"IndexID":2,"PartitionName":"p1","TableID":104} + └── AddPartitionZoneConfig {"IndexID":1,"PartitionName":"p1","TableID":104} diff --git a/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_4_of_4.explain_shape b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_4_of_4.explain_shape new file mode 100644 index 000000000000..1e70b3d1ef82 --- /dev/null +++ b/pkg/ccl/schemachangerccl/testdata/end_to_end/alter_partition_configure_zone_multiple/alter_partition_configure_zone_multiple__statement_4_of_4.explain_shape @@ -0,0 +1,21 @@ +/* setup */ +CREATE TABLE t ( + id INT PRIMARY KEY, + data INT, + INDEX idx (data) PARTITION BY LIST (data) ( + PARTITION p1 VALUES IN (10, 20, 30), + PARTITION p2 VALUES IN (40, 50, 60) + ) +) PARTITION BY LIST (id) ( + PARTITION p1 VALUES IN (1, 2, 3), + PARTITION p2 VALUES IN (4, 5, 6) +); + +/* test */ +ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING num_replicas = 7; +ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING gc.ttlseconds = 10000; +ALTER PARTITION p1 OF INDEX t@idx CONFIGURE ZONE USING gc.ttlseconds = 12000; +EXPLAIN (DDL, SHAPE) ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING num_replicas = 10; +---- +Schema change plan for ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹num_replicas› = ‹10›; following ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹num_replicas› = ‹7›; ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹"gc.ttlseconds"› = ‹10000›; ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹idx› CONFIGURE ZONE USING ‹"gc.ttlseconds"› = ‹12000›; + └── execute 1 system table mutations transaction diff --git a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/BUILD.bazel b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/BUILD.bazel index 95cd47b05fc4..9ad2e5eb1152 100644 --- a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/BUILD.bazel +++ b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/BUILD.bazel @@ -33,6 +33,7 @@ go_library( "drop_view.go", "helpers.go", "index_zone_config.go", + "partition_zone_config.go", "process.go", "statement_control.go", "table_zone_config.go", diff --git a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/configure_zone.go b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/configure_zone.go index 54a40f9f3f79..8642b923db0b 100644 --- a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/configure_zone.go +++ b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/configure_zone.go @@ -37,8 +37,8 @@ func SetZoneConfig(b BuildCtx, n *tree.SetZoneConfig) { // - Database // - Table // - Index - // Left to support: // - Partition/row + // Left to support: // - System Ranges zco, err := astToZoneConfigObject(b, n) if err != nil { @@ -108,17 +108,23 @@ func astToZoneConfigObject(b BuildCtx, n *tree.SetZoneConfig) (zoneConfigObject, // // TODO(annie): remove this when we have something equivalent to // expandMutableIndexName in the DSC. - targetsIndex := n.TargetsIndex() && !n.TargetsPartition() + targetsIndex := n.TargetsIndex() if targetsIndex && n.TableOrIndex.Table.Table() == "" { return nil, scerrors.NotImplementedErrorf(n, "referencing an index without a table "+ "prefix is not supported in the DSC") } - if !n.TargetsTable() || n.TargetsPartition() { - return nil, scerrors.NotImplementedErrorf(n, "zone configurations on partitions "+ - "and system ranges are not supported in the DSC") + if !n.TargetsTable() { + return nil, scerrors.NotImplementedErrorf(n, "zone configurations on system ranges "+ + "are not supported in the DSC") } + // If this is an ALTER ALL PARTITIONS statement, fallback to the legacy schema + // changer. + if n.TargetsPartition() && n.ZoneSpecifier.StarIndex { + return nil, scerrors.NotImplementedErrorf(n, "zone configurations on ALL partitions "+ + "are not supported in the DSC") + } tblName := zs.TableOrIndex.Table.ToUnresolvedObjectName() elems := b.ResolvePhysicalTable(tblName, ResolveParams{}) panicIfSchemaChangeIsDisallowed(elems, n) @@ -153,5 +159,12 @@ func astToZoneConfigObject(b BuildCtx, n *tree.SetZoneConfig) (zoneConfigObject, return &izo, nil } + // We are a partition object. + if n.TargetsPartition() { + partObj := partitionZoneConfigObj{partitionName: string(n.ZoneSpecifier.Partition), + indexZoneConfigObj: izo} + return &partObj, nil + } + return nil, errors.AssertionFailedf("unexpected zone config object") } diff --git a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/database_zone_config.go b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/database_zone_config.go index 9ddba5aabb96..e33181f77dfe 100644 --- a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/database_zone_config.go +++ b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/database_zone_config.go @@ -98,9 +98,10 @@ func (dzo *databaseZoneConfigObj) retrievePartialZoneConfig(b BuildCtx) *zonepb. sameDB := func(e *scpb.DatabaseZoneConfig) bool { return e.DatabaseID == dzo.getTargetID() } - mostRecentElem := findMostRecentZoneConfig(dzo, func(id catid.DescID) *scpb.ElementCollection[*scpb.DatabaseZoneConfig] { - return b.QueryByID(id).FilterDatabaseZoneConfig() - }, sameDB) + mostRecentElem := findMostRecentZoneConfig(dzo, + func(id catid.DescID) *scpb.ElementCollection[*scpb.DatabaseZoneConfig] { + return b.QueryByID(id).FilterDatabaseZoneConfig() + }, sameDB) if mostRecentElem != nil { dzo.zoneConfig = mostRecentElem.ZoneConfig diff --git a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/index_zone_config.go b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/index_zone_config.go index 383300f98f22..389112d0433c 100644 --- a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/index_zone_config.go +++ b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/index_zone_config.go @@ -63,9 +63,10 @@ func (izo *indexZoneConfigObj) retrievePartialZoneConfig(b BuildCtx) *zonepb.Zon sameIdx := func(e *scpb.IndexZoneConfig) bool { return e.TableID == izo.getTargetID() && e.IndexID == izo.indexID } - mostRecentElem := findMostRecentZoneConfig(izo, func(id catid.DescID) *scpb.ElementCollection[*scpb.IndexZoneConfig] { - return b.QueryByID(id).FilterIndexZoneConfig() - }, sameIdx) + mostRecentElem := findMostRecentZoneConfig(izo, + func(id catid.DescID) *scpb.ElementCollection[*scpb.IndexZoneConfig] { + return b.QueryByID(id).FilterIndexZoneConfig() + }, sameIdx) // Since we will be performing a subzone config update, we need to retrieve // its parent's (table's) zone config for later use. This is because we need @@ -113,8 +114,6 @@ func (izo *indexZoneConfigObj) retrieveCompleteZoneConfig( var subzone *zonepb.Subzone indexID := izo.indexID if placeholder != nil { - // TODO(annie): once we support partitions, we will need to pass in the - // actual partition name here. if subzone = placeholder.GetSubzone(uint32(indexID), ""); subzone != nil { if indexSubzone := placeholder.GetSubzone(uint32(indexID), ""); indexSubzone != nil { subzone.Config.InheritFromParent(&indexSubzone.Config) @@ -138,6 +137,7 @@ func (izo *indexZoneConfigObj) setZoneConfigToWrite(zone *zonepb.ZoneConfig) { for _, subzone := range zone.Subzones { if subzone.IndexID == uint32(izo.indexID) && len(subzone.PartitionName) == 0 { subzoneToWrite = &subzone + break } } izo.indexSubzone = subzoneToWrite diff --git a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/partition_zone_config.go b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/partition_zone_config.go index 8ccadb100337..ee9efce446cf 100644 --- a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/partition_zone_config.go +++ b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/partition_zone_config.go @@ -7,13 +7,16 @@ package scbuildstmt import ( "fmt" + "sort" "github.com/cockroachdb/cockroach/pkg/config/zonepb" "github.com/cockroachdb/cockroach/pkg/sql/catalog/tabledesc" "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgcode" "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgerror" "github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scpb" + "github.com/cockroachdb/cockroach/pkg/sql/sem/catid" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" + "github.com/cockroachdb/cockroach/pkg/util/protoutil" "github.com/cockroachdb/errors" ) @@ -26,13 +29,266 @@ type partitionZoneConfigObj struct { seqNum uint32 } +var _ zoneConfigObject = &partitionZoneConfigObj{} + +func (pzo *partitionZoneConfigObj) getTableZoneConfig() *zonepb.ZoneConfig { + return pzo.tableZoneConfigObj.zoneConfig +} + +func (pzo *partitionZoneConfigObj) addZoneConfigToBuildCtx(b BuildCtx) scpb.Element { + pzo.seqNum += 1 + subzones := []zonepb.Subzone{*pzo.partitionSubzone} + + // Merge the new subzones with the old subzones so that we can generate + // accurate subzone spans. + parentZoneConfig := pzo.getTableZoneConfig() + if parentZoneConfig != nil { + parentZoneConfig.SetSubzone(*pzo.partitionSubzone) + subzones = parentZoneConfig.Subzones + } + + ss, err := generateSubzoneSpans(b, pzo.tableID, subzones) + if err != nil { + panic(err) + } + + elem := &scpb.PartitionZoneConfig{ + TableID: pzo.tableID, + IndexID: pzo.indexID, + PartitionName: pzo.partitionName, + Subzone: *pzo.partitionSubzone, + SubzoneSpans: ss, + SeqNum: pzo.seqNum, + } + b.Add(elem) + return elem +} + +func (pzo *partitionZoneConfigObj) retrievePartialZoneConfig(b BuildCtx) *zonepb.ZoneConfig { + samePartition := func(e *scpb.PartitionZoneConfig) bool { + return e.TableID == pzo.getTargetID() && e.IndexID == pzo.indexID && + e.PartitionName == pzo.partitionName + } + mostRecentElem := findMostRecentZoneConfig(pzo, + func(id catid.DescID) *scpb.ElementCollection[*scpb.PartitionZoneConfig] { + return b.QueryByID(id).FilterPartitionZoneConfig() + }, samePartition) + + // Set the table zone config for generating proper subzone spans later on. + _ = pzo.tableZoneConfigObj.retrievePartialZoneConfig(b) + + var partialZone *zonepb.ZoneConfig + if mostRecentElem != nil { + // Construct a zone config placeholder with the correct subzone. This + // will be what we return. + partialZone = zonepb.NewZoneConfig() + partialZone.DeleteTableConfig() + partialZone.Subzones = []zonepb.Subzone{mostRecentElem.Subzone} + pzo.partitionSubzone = &mostRecentElem.Subzone + pzo.seqNum = mostRecentElem.SeqNum + } + + return pzo.zoneConfig +} + +func (pzo *partitionZoneConfigObj) retrieveCompleteZoneConfig( + b BuildCtx, getInheritedDefault bool, +) (*zonepb.ZoneConfig, *zonepb.Subzone, error) { + var placeholder *zonepb.ZoneConfig + var err error + zc := &zonepb.ZoneConfig{} + if getInheritedDefault { + zc, err = pzo.getInheritedDefaultZoneConfig(b) + } else { + zc, err = pzo.tableZoneConfigObj.getZoneConfig(b, false /* inheritDefaultRange */) + if err != nil { + return nil, nil, err + } + placeholder, err = pzo.getZoneConfig(b, false /* inheritDefaultRange */) + } + if err != nil { + return nil, nil, err + } + + completeZc := *zc + if err = pzo.completeZoneConfig(b, &completeZc); err != nil { + return nil, nil, err + } + + var subzone *zonepb.Subzone + indexID := pzo.indexID + partName := pzo.partitionName + if placeholder != nil { + if subzone = placeholder.GetSubzone(uint32(indexID), partName); subzone != nil { + if indexSubzone := placeholder.GetSubzone(uint32(indexID), partName); indexSubzone != nil { + subzone.Config.InheritFromParent(&indexSubzone.Config) + } + subzone.Config.InheritFromParent(zc) + return placeholder, subzone, nil + } + } else { + if subzone = zc.GetSubzone(uint32(indexID), pzo.partitionName); subzone != nil { + if indexSubzone := zc.GetSubzone(uint32(indexID), pzo.partitionName); indexSubzone != nil { + subzone.Config.InheritFromParent(&indexSubzone.Config) + } + subzone.Config.InheritFromParent(zc) + } + } + return zc, subzone, nil +} + +func (pzo *partitionZoneConfigObj) setZoneConfigToWrite(zone *zonepb.ZoneConfig) { + var subzoneToWrite *zonepb.Subzone + for _, subzone := range zone.Subzones { + if subzone.IndexID == uint32(pzo.indexID) && subzone.PartitionName == pzo.partitionName { + subzoneToWrite = &subzone + break + } + } + pzo.partitionSubzone = subzoneToWrite +} + +// getInheritedFieldsForPartialSubzone returns the set of inherited fields for +// a partial subzone based off of its parent zone. +func (pzo *partitionZoneConfigObj) getInheritedFieldsForPartialSubzone( + b BuildCtx, partialZone *zonepb.ZoneConfig, +) (*zonepb.ZoneConfig, error) { + // We are operating on a subZone and need to inherit all remaining + // unset fields in its parent zone, which is partialZone. + zoneInheritedFields := *partialZone + if err := pzo.completeZoneConfig(b, &zoneInheritedFields); err != nil { + return nil, err + } + // Since we have just a partition, we should copy from the inherited + // zone's fields (whether that was the table or database). + return &zoneInheritedFields, nil +} + +func (pzo *partitionZoneConfigObj) applyZoneConfig( + b BuildCtx, + n *tree.SetZoneConfig, + copyFromParentList []tree.Name, + setters []func(c *zonepb.ZoneConfig), +) error { + // TODO(annie): once we allow configuring zones for named zones/system ranges, + // we will need to guard against secondary tenants from configuring such + // ranges. + + // We are configuring a partition. Determine the index ID and fill this + // information out in our zoneConfigObject. + pzo.panicIfNoPartitionExistsOnIdx(b, n) + pzo.panicIfBadPartitionReference(b, n) + indexID := pzo.indexID + tempIndexID := mustRetrieveIndexElement(b, pzo.getTargetID(), indexID).TemporaryIndexID + + // Retrieve the partial zone configuration + partialZone := pzo.retrievePartialZoneConfig(b) + + subzonePlaceholder := false + // No zone was found. Possibly a SubzonePlaceholder depending on the index. + if partialZone == nil { + partialZone = zonepb.NewZoneConfig() + subzonePlaceholder = true + } + currentZone := protoutil.Clone(partialZone).(*zonepb.ZoneConfig) + + var partialSubzone *zonepb.Subzone + partialSubzone = partialZone.GetSubzoneExact(uint32(indexID), pzo.partitionName) + if partialSubzone == nil { + partialSubzone = &zonepb.Subzone{Config: *zonepb.NewZoneConfig()} + } + + // Retrieve the zone configuration. + // + // If the statement was USING DEFAULT, we want to ignore the zone + // config that exists on targetID and instead skip to the inherited + // default (whichever applies -- a database if targetID is a table, default + // if targetID is a database, etc.). For this, we use the last parameter + // getInheritedDefault to retrieveCompleteZoneConfig(). + // These zones are only used for validations. The merged zone will not + // be written. + completeZone, completeSubZone, err := pzo.retrieveCompleteZoneConfig(b, + n.SetDefault /* getInheritedDefault */) + if err != nil { + return err + } + + // We need to inherit zone configuration information from the correct zone, + // not completeZone. + { + zoneInheritedFields, err := pzo.getInheritedFieldsForPartialSubzone(b, partialZone) + if err != nil { + return err + } + partialSubzone.Config.CopyFromZone(*zoneInheritedFields, copyFromParentList) + } + + // Determine where to load the configuration. + newZone := *completeZone + if completeSubZone != nil { + newZone = completeSubZone.Config + } + + // If an existing subzone is being modified, finalZone is overridden. + finalZone := partialSubzone.Config + + if n.SetDefault { + finalZone = *zonepb.NewZoneConfig() + } + + // Fill in our zone configs with var = val assignments. + if err := loadSettingsToZoneConfigs(setters, &newZone, &finalZone); err != nil { + return err + } + + // Validate that there are no conflicts in the zone setup. + if err := zonepb.ValidateNoRepeatKeysInZone(&newZone); err != nil { + return err + } + + if err := validateZoneAttrsAndLocalities(b, currentZone, &newZone); err != nil { + return err + } + + // Fill in the final zone config with subzones. + fillZoneConfigsForSubzones(indexID, pzo.partitionName, tempIndexID, subzonePlaceholder, completeZone, + partialZone, newZone, finalZone) + + // Finally, revalidate everything. Validate only the completeZone config. + if err := completeZone.Validate(); err != nil { + return pgerror.Wrap(err, pgcode.CheckViolation, "could not validate zone config") + } + + // Finally, check for the extra protection partial zone configs would + // require from changes made to parent zones. The extra protections are: + // + // RangeMinBytes and RangeMaxBytes must be set together + // LeasePreferences cannot be set unless Constraints/VoterConstraints are + // explicitly set + // Per-replica constraints cannot be set unless num_replicas is explicitly + // set + // Per-voter constraints cannot be set unless num_voters is explicitly set + if err := finalZone.ValidateTandemFields(); err != nil { + err = errors.Wrap(err, "could not validate zone config") + err = pgerror.WithCandidateCode(err, pgcode.InvalidParameterValue) + err = errors.WithHint(err, + "try ALTER ... CONFIGURE ZONE USING = COPY FROM PARENT [, ...] to "+ + "populate the field") + return err + } + pzo.setZoneConfigToWrite(partialZone) + return err +} + // panicIfNoPartitionExistsOnIdx panics if the partition referenced in a // ALTER PARTITION ... OF TABLE does not exist on the provided index. func (pzo *partitionZoneConfigObj) panicIfNoPartitionExistsOnIdx( b BuildCtx, n *tree.SetZoneConfig, ) { zs := n.ZoneSpecifier - if zs.TargetsPartition() && len(zs.TableOrIndex.Index) != 0 && !n.AllIndexes { + // If we allow StarIndex to be set in the DSC, we will have to guard against + // that here as well. + if zs.TargetsPartition() && len(zs.TableOrIndex.Index) != 0 { partitionName := string(zs.Partition) var indexes []scpb.IndexPartitioning idxPart := b.QueryByID(pzo.tableID).FilterIndexPartitioning() @@ -69,19 +325,21 @@ func (pzo *partitionZoneConfigObj) panicIfBadPartitionReference(b BuildCtx, n *t zs := &n.ZoneSpecifier // Backward compatibility for ALTER PARTITION ... OF TABLE. Determine which // index has the specified partition. - if zs.TargetsPartition() && len(zs.TableOrIndex.Index) == 0 && !n.AllIndexes { + // + // If we allow StarIndex to be set in the DSC, we will have to guard against + // that here as well. + if zs.TargetsPartition() && len(zs.TableOrIndex.Index) == 0 { partitionName := string(zs.Partition) - // TODO(before merge): [reviewer callout] can we guarantee that this will - // be in the same order as NonDropIndexes()? Mainly for case 2 in the switch - // case below. My understanding is yes, but I want to confirm. var indexes []scpb.IndexPartitioning idxPart := b.QueryByID(pzo.tableID).FilterIndexPartitioning() - idxPart.ForEach(func(_ scpb.Status, _ scpb.TargetStatus, e *scpb.IndexPartitioning) { - partition := tabledesc.NewPartitioning(&e.PartitioningDescriptor) - partition = partition.FindPartitionByName(partitionName) - if partition != nil { - indexes = append(indexes, *e) + idxPart.ForEach(func(s scpb.Status, ts scpb.TargetStatus, e *scpb.IndexPartitioning) { + if s != scpb.Status_DROPPED && ts != scpb.ToAbsent { + partition := tabledesc.NewPartitioning(&e.PartitioningDescriptor) + partition = partition.FindPartitionByName(partitionName) + if partition != nil { + indexes = append(indexes, *e) + } } }) @@ -90,24 +348,37 @@ func (pzo *partitionZoneConfigObj) panicIfBadPartitionReference(b BuildCtx, n *t case 0: panic(fmt.Errorf("partition %q does not exist on table %q", partitionName, tableName)) case 1: - // We found the partition on a single index. Fill this index out in our - // AST. + // We found the partition on a single index. Fill this index out in + // our AST. idx := indexes[0] idxName := mustRetrieveIndexNameElem(b, pzo.tableID, idx.IndexID) zs.TableOrIndex.Index = tree.UnrestrictedName(idxName.Name) + // Our index name has changed -- find the corresponding indexID + // and fill that out. + pzo.fillIndexFromZoneSpecifier(b, n.ZoneSpecifier) case 2: - // Perhaps our target index is a part of a backfill. In this case, we - // temporary indexes created during backfill should always share the same - // zone configs as the corresponding new index. + // Sort our indexes to guarantee proper ordering; in the case of a + // backfill, we want to ensure that the temporary index is always + // the second element. + sort.Slice(indexes, func(i, j int) bool { + return indexes[i].IndexID < indexes[j].IndexID + }) + + // Perhaps our target index is a part of a backfill. In this case, + // temporary indexes created during backfill should always share the + // same zone configs as the corresponding new index. idx := indexes[0] maybeTempIdx := indexes[1] if isCorrespondingTemporaryIndex(b, pzo.tableID, maybeTempIdx.IndexID, idx.IndexID) { idxName := mustRetrieveIndexNameElem(b, pzo.tableID, idx.IndexID) zs.TableOrIndex.Index = tree.UnrestrictedName(idxName.Name) + // Our index name has changed -- find the corresponding indexID + // and fill that out. + pzo.fillIndexFromZoneSpecifier(b, n.ZoneSpecifier) break } - // We are not in a backfill case -- the partition we are referencing is on - // multiple indexes. Fallthrough. + // We are not in a backfill case -- the partition we are referencing + // is on multiple indexes. Fallthrough. fallthrough default: err := fmt.Errorf( diff --git a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/table_zone_config.go b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/table_zone_config.go index 3b3c8504bc20..b72f54112ec5 100644 --- a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/table_zone_config.go +++ b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/table_zone_config.go @@ -102,9 +102,10 @@ func (tzo *tableZoneConfigObj) retrievePartialZoneConfig(b BuildCtx) *zonepb.Zon sameTbl := func(e *scpb.TableZoneConfig) bool { return e.TableID == tzo.getTargetID() } - mostRecentElem := findMostRecentZoneConfig(tzo, func(id catid.DescID) *scpb.ElementCollection[*scpb.TableZoneConfig] { - return b.QueryByID(id).FilterTableZoneConfig() - }, sameTbl) + mostRecentElem := findMostRecentZoneConfig(tzo, + func(id catid.DescID) *scpb.ElementCollection[*scpb.TableZoneConfig] { + return b.QueryByID(id).FilterTableZoneConfig() + }, sameTbl) if mostRecentElem != nil { tzo.zoneConfig = mostRecentElem.ZoneConfig diff --git a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/zone_config_helpers.go b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/zone_config_helpers.go index 1f1a5a4a9488..b6ca38d695e1 100644 --- a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/zone_config_helpers.go +++ b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/zone_config_helpers.go @@ -687,12 +687,21 @@ func generateSubzoneSpans( var indexCovering covering.Covering var partitionCoverings []covering.Covering + var err error b.QueryByID(tableID).FilterIndexName().ForEach(func(_ scpb.Status, _ scpb.TargetStatus, e *scpb.IndexName) { - newIndexCovering, newPartitionCoverings := getCoverings(b, subzoneIndexByIndexID, - subzoneIndexByPartition, tableID, e.IndexID, "") + var newIndexCovering covering.Covering + var newPartitionCoverings []covering.Covering + newIndexCovering, newPartitionCoverings, err = getCoverings(b, subzoneIndexByIndexID, + subzoneIndexByPartition, tableID, e.IndexID) + if err != nil { + return + } indexCovering = append(indexCovering, newIndexCovering...) partitionCoverings = append(partitionCoverings, newPartitionCoverings...) }) + if err != nil { + return nil, err + } // OverlapCoveringMerge returns the payloads for any coverings that overlap // in the same order they were input. So, we require that they be ordered @@ -737,8 +746,7 @@ func getCoverings( subzoneIndexByPartition map[string]int32, tableID catid.DescID, indexID catid.IndexID, - partitionName string, -) (covering.Covering, []covering.Covering) { +) (covering.Covering, []covering.Covering, error) { var indexCovering covering.Covering var partitionCoverings []covering.Covering a := &tree.DatumAlloc{} @@ -764,12 +772,12 @@ func getCoverings( partition := tabledesc.NewPartitioning(nil) if idxPart != nil { partition = tabledesc.NewPartitioning(&idxPart.PartitioningDescriptor) - partition = partition.FindPartitionByName(partitionName) } + // should we iterate through each partition name here? indexPartitionCoverings, err := indexCoveringsForPartitioning( b, a, tableID, idxCols, partition, subzoneIndexByPartition, emptyPrefix) if err != nil { - panic(err) + return nil, nil, err } // The returned indexPartitionCoverings are sorted with highest // precedence first. They all start with the index prefix, so cannot @@ -777,7 +785,7 @@ func getCoverings( // precedence perspective) it's safe to append them all together. partitionCoverings = append(partitionCoverings, indexPartitionCoverings...) } - return indexCovering, partitionCoverings + return indexCovering, partitionCoverings, nil } // indexCoveringsForPartitioning returns span coverings representing the @@ -1155,7 +1163,7 @@ func isCorrespondingTemporaryIndex( ) bool { maybeCorresponding := b.QueryByID(tableID).FilterTemporaryIndex(). Filter(func(_ scpb.Status, _ scpb.TargetStatus, e *scpb.TemporaryIndex) bool { - return idx+1 == e.IndexID && e.IndexID == otherIdx + return idx == e.IndexID && e.IndexID == otherIdx+1 }).MustGetZeroOrOneElement() return maybeCorresponding != nil } diff --git a/pkg/sql/schemachanger/scpb/state.go b/pkg/sql/schemachanger/scpb/state.go index 50704136bfc1..bdc341fc0cb9 100644 --- a/pkg/sql/schemachanger/scpb/state.go +++ b/pkg/sql/schemachanger/scpb/state.go @@ -150,6 +150,7 @@ type ZoneConfigElement interface { var _ ZoneConfigElement = &DatabaseZoneConfig{} var _ ZoneConfigElement = &TableZoneConfig{} var _ ZoneConfigElement = &IndexZoneConfig{} +var _ ZoneConfigElement = &PartitionZoneConfig{} func (e *DatabaseZoneConfig) GetSeqNum() uint32 { return e.SeqNum @@ -175,6 +176,14 @@ func (e *IndexZoneConfig) GetTargetID() catid.DescID { return e.TableID } +func (e *PartitionZoneConfig) GetSeqNum() uint32 { + return e.SeqNum +} + +func (e *PartitionZoneConfig) GetTargetID() catid.DescID { + return e.TableID +} + // IsLinkedToSchemaChange return if a Target is linked to a schema change. func (t *Target) IsLinkedToSchemaChange() bool { return t.Metadata.IsLinkedToSchemaChange() diff --git a/pkg/sql/schemachanger/scplan/internal/rules/current/helpers.go b/pkg/sql/schemachanger/scplan/internal/rules/current/helpers.go index de42a0df7d02..207a7f55a569 100644 --- a/pkg/sql/schemachanger/scplan/internal/rules/current/helpers.go +++ b/pkg/sql/schemachanger/scplan/internal/rules/current/helpers.go @@ -231,7 +231,7 @@ func isIndexDependent(e scpb.Element) bool { case *scpb.IndexName, *scpb.IndexComment, *scpb.IndexColumn, *scpb.IndexZoneConfig: return true - case *scpb.IndexPartitioning, *scpb.SecondaryIndexPartial: + case *scpb.IndexPartitioning, *scpb.PartitionZoneConfig, *scpb.SecondaryIndexPartial: return true } return false diff --git a/pkg/sql/schemachanger/scplan/internal/rules/current/testdata/deprules b/pkg/sql/schemachanger/scplan/internal/rules/current/testdata/deprules index 75b70fbe6dee..6e0cd193aa4d 100644 --- a/pkg/sql/schemachanger/scplan/internal/rules/current/testdata/deprules +++ b/pkg/sql/schemachanger/scplan/internal/rules/current/testdata/deprules @@ -2891,7 +2891,7 @@ deprules kind: Precedence to: relation-Node query: - - $dependent[Type] IN ['*scpb.CheckConstraint', '*scpb.CheckConstraintUnvalidated', '*scpb.Column', '*scpb.ColumnComment', '*scpb.ColumnComputeExpression', '*scpb.ColumnDefaultExpression', '*scpb.ColumnFamily', '*scpb.ColumnName', '*scpb.ColumnNotNull', '*scpb.ColumnOnUpdateExpression', '*scpb.ColumnType', '*scpb.CompositeTypeAttrName', '*scpb.CompositeTypeAttrType', '*scpb.ConstraintComment', '*scpb.ConstraintWithoutIndexName', '*scpb.DatabaseComment', '*scpb.DatabaseRegionConfig', '*scpb.DatabaseRoleSetting', '*scpb.DatabaseZoneConfig', '*scpb.EnumTypeValue', '*scpb.ForeignKeyConstraint', '*scpb.ForeignKeyConstraintUnvalidated', '*scpb.FunctionBody', '*scpb.FunctionLeakProof', '*scpb.FunctionName', '*scpb.FunctionNullInputBehavior', '*scpb.FunctionSecurity', '*scpb.FunctionVolatility', '*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.LDRJobIDs', '*scpb.Namespace', '*scpb.Owner', '*scpb.PrimaryIndex', '*scpb.RowLevelTTL', '*scpb.SchemaChild', '*scpb.SchemaComment', '*scpb.SchemaParent', '*scpb.SecondaryIndex', '*scpb.SecondaryIndexPartial', '*scpb.SequenceOption', '*scpb.SequenceOwner', '*scpb.TableComment', '*scpb.TableLocalityGlobal', '*scpb.TableLocalityPrimaryRegion', '*scpb.TableLocalityRegionalByRow', '*scpb.TableLocalitySecondaryRegion', '*scpb.TablePartitioning', '*scpb.TableSchemaLocked', '*scpb.TableZoneConfig', '*scpb.TemporaryIndex', '*scpb.TypeComment', '*scpb.UniqueWithoutIndexConstraint', '*scpb.UniqueWithoutIndexConstraintUnvalidated', '*scpb.UserPrivileges'] + - $dependent[Type] IN ['*scpb.CheckConstraint', '*scpb.CheckConstraintUnvalidated', '*scpb.Column', '*scpb.ColumnComment', '*scpb.ColumnComputeExpression', '*scpb.ColumnDefaultExpression', '*scpb.ColumnFamily', '*scpb.ColumnName', '*scpb.ColumnNotNull', '*scpb.ColumnOnUpdateExpression', '*scpb.ColumnType', '*scpb.CompositeTypeAttrName', '*scpb.CompositeTypeAttrType', '*scpb.ConstraintComment', '*scpb.ConstraintWithoutIndexName', '*scpb.DatabaseComment', '*scpb.DatabaseRegionConfig', '*scpb.DatabaseRoleSetting', '*scpb.DatabaseZoneConfig', '*scpb.EnumTypeValue', '*scpb.ForeignKeyConstraint', '*scpb.ForeignKeyConstraintUnvalidated', '*scpb.FunctionBody', '*scpb.FunctionLeakProof', '*scpb.FunctionName', '*scpb.FunctionNullInputBehavior', '*scpb.FunctionSecurity', '*scpb.FunctionVolatility', '*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.LDRJobIDs', '*scpb.Namespace', '*scpb.Owner', '*scpb.PartitionZoneConfig', '*scpb.PrimaryIndex', '*scpb.RowLevelTTL', '*scpb.SchemaChild', '*scpb.SchemaComment', '*scpb.SchemaParent', '*scpb.SecondaryIndex', '*scpb.SecondaryIndexPartial', '*scpb.SequenceOption', '*scpb.SequenceOwner', '*scpb.TableComment', '*scpb.TableLocalityGlobal', '*scpb.TableLocalityPrimaryRegion', '*scpb.TableLocalityRegionalByRow', '*scpb.TableLocalitySecondaryRegion', '*scpb.TablePartitioning', '*scpb.TableSchemaLocked', '*scpb.TableZoneConfig', '*scpb.TemporaryIndex', '*scpb.TypeComment', '*scpb.UniqueWithoutIndexConstraint', '*scpb.UniqueWithoutIndexConstraintUnvalidated', '*scpb.UserPrivileges'] - $relation[Type] IN ['*scpb.AliasType', '*scpb.CompositeType', '*scpb.Database', '*scpb.EnumType', '*scpb.Function', '*scpb.Schema', '*scpb.Sequence', '*scpb.Table', '*scpb.View'] - joinOnDescID($dependent, $relation, $relation-id) - ToPublicOrTransient($dependent-Target, $relation-Target) @@ -3012,7 +3012,7 @@ deprules kind: Precedence to: index-Node query: - - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.SecondaryIndexPartial'] + - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.PartitionZoneConfig', '*scpb.SecondaryIndexPartial'] - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - joinOnIndexID($dependent, $index, $table-id, $index-id) - toAbsent($dependent-Target, $index-Target) @@ -3025,7 +3025,7 @@ deprules kind: Precedence to: index-Node query: - - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.SecondaryIndexPartial'] + - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.PartitionZoneConfig', '*scpb.SecondaryIndexPartial'] - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - joinOnIndexID($dependent, $index, $table-id, $index-id) - transient($dependent-Target, $index-Target) @@ -3038,7 +3038,7 @@ deprules kind: Precedence to: index-Node query: - - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.SecondaryIndexPartial'] + - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.PartitionZoneConfig', '*scpb.SecondaryIndexPartial'] - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - joinOnIndexID($dependent, $index, $table-id, $index-id) - $dependent-Target[TargetStatus] = TRANSIENT_ABSENT @@ -3052,7 +3052,7 @@ deprules kind: Precedence to: index-Node query: - - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.SecondaryIndexPartial'] + - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.PartitionZoneConfig', '*scpb.SecondaryIndexPartial'] - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - joinOnIndexID($dependent, $index, $table-id, $index-id) - $dependent-Target[TargetStatus] = ABSENT @@ -3135,7 +3135,7 @@ deprules to: referencing-via-attr-Node query: - $referenced-descriptor[Type] IN ['*scpb.AliasType', '*scpb.CompositeType', '*scpb.Database', '*scpb.EnumType', '*scpb.Function', '*scpb.Schema', '*scpb.Sequence', '*scpb.Table', '*scpb.View'] - - $referencing-via-attr[Type] IN ['*scpb.CheckConstraintUnvalidated', '*scpb.ColumnComment', '*scpb.ColumnComputeExpression', '*scpb.ColumnDefaultExpression', '*scpb.ColumnFamily', '*scpb.ColumnName', '*scpb.ColumnOnUpdateExpression', '*scpb.ColumnType', '*scpb.CompositeTypeAttrName', '*scpb.CompositeTypeAttrType', '*scpb.ConstraintComment', '*scpb.ConstraintWithoutIndexName', '*scpb.DatabaseComment', '*scpb.DatabaseRegionConfig', '*scpb.DatabaseRoleSetting', '*scpb.DatabaseZoneConfig', '*scpb.EnumTypeValue', '*scpb.ForeignKeyConstraintUnvalidated', '*scpb.FunctionBody', '*scpb.FunctionLeakProof', '*scpb.FunctionName', '*scpb.FunctionNullInputBehavior', '*scpb.FunctionSecurity', '*scpb.FunctionVolatility', '*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.LDRJobIDs', '*scpb.Namespace', '*scpb.Owner', '*scpb.RowLevelTTL', '*scpb.SchemaComment', '*scpb.SecondaryIndexPartial', '*scpb.SequenceOption', '*scpb.SequenceOwner', '*scpb.TableComment', '*scpb.TableLocalityGlobal', '*scpb.TableLocalityPrimaryRegion', '*scpb.TableLocalityRegionalByRow', '*scpb.TableLocalitySecondaryRegion', '*scpb.TablePartitioning', '*scpb.TableSchemaLocked', '*scpb.TableZoneConfig', '*scpb.TypeComment', '*scpb.UniqueWithoutIndexConstraintUnvalidated', '*scpb.UserPrivileges'] + - $referencing-via-attr[Type] IN ['*scpb.CheckConstraintUnvalidated', '*scpb.ColumnComment', '*scpb.ColumnComputeExpression', '*scpb.ColumnDefaultExpression', '*scpb.ColumnFamily', '*scpb.ColumnName', '*scpb.ColumnOnUpdateExpression', '*scpb.ColumnType', '*scpb.CompositeTypeAttrName', '*scpb.CompositeTypeAttrType', '*scpb.ConstraintComment', '*scpb.ConstraintWithoutIndexName', '*scpb.DatabaseComment', '*scpb.DatabaseRegionConfig', '*scpb.DatabaseRoleSetting', '*scpb.DatabaseZoneConfig', '*scpb.EnumTypeValue', '*scpb.ForeignKeyConstraintUnvalidated', '*scpb.FunctionBody', '*scpb.FunctionLeakProof', '*scpb.FunctionName', '*scpb.FunctionNullInputBehavior', '*scpb.FunctionSecurity', '*scpb.FunctionVolatility', '*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.LDRJobIDs', '*scpb.Namespace', '*scpb.Owner', '*scpb.PartitionZoneConfig', '*scpb.RowLevelTTL', '*scpb.SchemaComment', '*scpb.SecondaryIndexPartial', '*scpb.SequenceOption', '*scpb.SequenceOwner', '*scpb.TableComment', '*scpb.TableLocalityGlobal', '*scpb.TableLocalityPrimaryRegion', '*scpb.TableLocalityRegionalByRow', '*scpb.TableLocalitySecondaryRegion', '*scpb.TablePartitioning', '*scpb.TableSchemaLocked', '*scpb.TableZoneConfig', '*scpb.TypeComment', '*scpb.UniqueWithoutIndexConstraintUnvalidated', '*scpb.UserPrivileges'] - joinReferencedDescID($referencing-via-attr, $referenced-descriptor, $desc-id) - toAbsent($referenced-descriptor-Target, $referencing-via-attr-Target) - $referenced-descriptor-Node[CurrentStatus] = DROPPED @@ -3191,7 +3191,7 @@ deprules to: dependent-Node query: - $descriptor[Type] IN ['*scpb.AliasType', '*scpb.CompositeType', '*scpb.Database', '*scpb.EnumType', '*scpb.Function', '*scpb.Schema', '*scpb.Sequence', '*scpb.Table', '*scpb.View'] - - $dependent[Type] IN ['*scpb.CheckConstraintUnvalidated', '*scpb.ColumnComment', '*scpb.ColumnComputeExpression', '*scpb.ColumnDefaultExpression', '*scpb.ColumnFamily', '*scpb.ColumnName', '*scpb.ColumnOnUpdateExpression', '*scpb.ColumnType', '*scpb.CompositeTypeAttrName', '*scpb.CompositeTypeAttrType', '*scpb.DatabaseComment', '*scpb.DatabaseRegionConfig', '*scpb.DatabaseRoleSetting', '*scpb.DatabaseZoneConfig', '*scpb.EnumTypeValue', '*scpb.ForeignKeyConstraintUnvalidated', '*scpb.FunctionBody', '*scpb.FunctionLeakProof', '*scpb.FunctionName', '*scpb.FunctionNullInputBehavior', '*scpb.FunctionSecurity', '*scpb.FunctionVolatility', '*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.LDRJobIDs', '*scpb.Namespace', '*scpb.Owner', '*scpb.RowLevelTTL', '*scpb.SchemaChild', '*scpb.SchemaComment', '*scpb.SchemaParent', '*scpb.SecondaryIndexPartial', '*scpb.SequenceOption', '*scpb.SequenceOwner', '*scpb.TableComment', '*scpb.TableLocalityGlobal', '*scpb.TableLocalityPrimaryRegion', '*scpb.TableLocalityRegionalByRow', '*scpb.TableLocalitySecondaryRegion', '*scpb.TablePartitioning', '*scpb.TableSchemaLocked', '*scpb.TableZoneConfig', '*scpb.TypeComment', '*scpb.UniqueWithoutIndexConstraintUnvalidated', '*scpb.UserPrivileges'] + - $dependent[Type] IN ['*scpb.CheckConstraintUnvalidated', '*scpb.ColumnComment', '*scpb.ColumnComputeExpression', '*scpb.ColumnDefaultExpression', '*scpb.ColumnFamily', '*scpb.ColumnName', '*scpb.ColumnOnUpdateExpression', '*scpb.ColumnType', '*scpb.CompositeTypeAttrName', '*scpb.CompositeTypeAttrType', '*scpb.DatabaseComment', '*scpb.DatabaseRegionConfig', '*scpb.DatabaseRoleSetting', '*scpb.DatabaseZoneConfig', '*scpb.EnumTypeValue', '*scpb.ForeignKeyConstraintUnvalidated', '*scpb.FunctionBody', '*scpb.FunctionLeakProof', '*scpb.FunctionName', '*scpb.FunctionNullInputBehavior', '*scpb.FunctionSecurity', '*scpb.FunctionVolatility', '*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.LDRJobIDs', '*scpb.Namespace', '*scpb.Owner', '*scpb.PartitionZoneConfig', '*scpb.RowLevelTTL', '*scpb.SchemaChild', '*scpb.SchemaComment', '*scpb.SchemaParent', '*scpb.SecondaryIndexPartial', '*scpb.SequenceOption', '*scpb.SequenceOwner', '*scpb.TableComment', '*scpb.TableLocalityGlobal', '*scpb.TableLocalityPrimaryRegion', '*scpb.TableLocalityRegionalByRow', '*scpb.TableLocalitySecondaryRegion', '*scpb.TablePartitioning', '*scpb.TableSchemaLocked', '*scpb.TableZoneConfig', '*scpb.TypeComment', '*scpb.UniqueWithoutIndexConstraintUnvalidated', '*scpb.UserPrivileges'] - joinOnDescID($descriptor, $dependent, $desc-id) - toAbsent($descriptor-Target, $dependent-Target) - $descriptor-Node[CurrentStatus] = DROPPED @@ -3230,7 +3230,7 @@ deprules to: dependent-Node query: - $relation[Type] IN ['*scpb.AliasType', '*scpb.CompositeType', '*scpb.Database', '*scpb.EnumType', '*scpb.Function', '*scpb.Schema', '*scpb.Sequence', '*scpb.Table', '*scpb.View'] - - $dependent[Type] IN ['*scpb.CheckConstraint', '*scpb.CheckConstraintUnvalidated', '*scpb.Column', '*scpb.ColumnComment', '*scpb.ColumnComputeExpression', '*scpb.ColumnDefaultExpression', '*scpb.ColumnFamily', '*scpb.ColumnName', '*scpb.ColumnNotNull', '*scpb.ColumnOnUpdateExpression', '*scpb.ColumnType', '*scpb.CompositeTypeAttrName', '*scpb.CompositeTypeAttrType', '*scpb.ConstraintComment', '*scpb.ConstraintWithoutIndexName', '*scpb.DatabaseComment', '*scpb.DatabaseData', '*scpb.DatabaseRegionConfig', '*scpb.DatabaseRoleSetting', '*scpb.DatabaseZoneConfig', '*scpb.EnumTypeValue', '*scpb.ForeignKeyConstraint', '*scpb.ForeignKeyConstraintUnvalidated', '*scpb.FunctionBody', '*scpb.FunctionLeakProof', '*scpb.FunctionName', '*scpb.FunctionNullInputBehavior', '*scpb.FunctionSecurity', '*scpb.FunctionVolatility', '*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexData', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.LDRJobIDs', '*scpb.Namespace', '*scpb.Owner', '*scpb.PrimaryIndex', '*scpb.RowLevelTTL', '*scpb.SchemaChild', '*scpb.SchemaComment', '*scpb.SchemaParent', '*scpb.SecondaryIndex', '*scpb.SecondaryIndexPartial', '*scpb.SequenceOption', '*scpb.SequenceOwner', '*scpb.TableComment', '*scpb.TableData', '*scpb.TableLocalityGlobal', '*scpb.TableLocalityPrimaryRegion', '*scpb.TableLocalityRegionalByRow', '*scpb.TableLocalitySecondaryRegion', '*scpb.TablePartitioning', '*scpb.TableSchemaLocked', '*scpb.TableZoneConfig', '*scpb.TemporaryIndex', '*scpb.TypeComment', '*scpb.UniqueWithoutIndexConstraint', '*scpb.UniqueWithoutIndexConstraintUnvalidated', '*scpb.UserPrivileges'] + - $dependent[Type] IN ['*scpb.CheckConstraint', '*scpb.CheckConstraintUnvalidated', '*scpb.Column', '*scpb.ColumnComment', '*scpb.ColumnComputeExpression', '*scpb.ColumnDefaultExpression', '*scpb.ColumnFamily', '*scpb.ColumnName', '*scpb.ColumnNotNull', '*scpb.ColumnOnUpdateExpression', '*scpb.ColumnType', '*scpb.CompositeTypeAttrName', '*scpb.CompositeTypeAttrType', '*scpb.ConstraintComment', '*scpb.ConstraintWithoutIndexName', '*scpb.DatabaseComment', '*scpb.DatabaseData', '*scpb.DatabaseRegionConfig', '*scpb.DatabaseRoleSetting', '*scpb.DatabaseZoneConfig', '*scpb.EnumTypeValue', '*scpb.ForeignKeyConstraint', '*scpb.ForeignKeyConstraintUnvalidated', '*scpb.FunctionBody', '*scpb.FunctionLeakProof', '*scpb.FunctionName', '*scpb.FunctionNullInputBehavior', '*scpb.FunctionSecurity', '*scpb.FunctionVolatility', '*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexData', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.LDRJobIDs', '*scpb.Namespace', '*scpb.Owner', '*scpb.PartitionZoneConfig', '*scpb.PrimaryIndex', '*scpb.RowLevelTTL', '*scpb.SchemaChild', '*scpb.SchemaComment', '*scpb.SchemaParent', '*scpb.SecondaryIndex', '*scpb.SecondaryIndexPartial', '*scpb.SequenceOption', '*scpb.SequenceOwner', '*scpb.TableComment', '*scpb.TableData', '*scpb.TableLocalityGlobal', '*scpb.TableLocalityPrimaryRegion', '*scpb.TableLocalityRegionalByRow', '*scpb.TableLocalitySecondaryRegion', '*scpb.TablePartitioning', '*scpb.TableSchemaLocked', '*scpb.TableZoneConfig', '*scpb.TemporaryIndex', '*scpb.TypeComment', '*scpb.UniqueWithoutIndexConstraint', '*scpb.UniqueWithoutIndexConstraintUnvalidated', '*scpb.UserPrivileges'] - joinOnDescID($relation, $dependent, $relation-id) - ToPublicOrTransient($relation-Target, $dependent-Target) - $relation-Node[CurrentStatus] = DESCRIPTOR_ADDED @@ -3297,7 +3297,7 @@ deprules kind: Precedence to: index-Node query: - - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.SecondaryIndexPartial'] + - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.PartitionZoneConfig', '*scpb.SecondaryIndexPartial'] - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - joinOnIndexID($dependent, $index, $table-id, $index-id) - ToPublicOrTransient($dependent-Target, $index-Target) @@ -3365,7 +3365,7 @@ deprules to: dependent-Node query: - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex'] - - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.SecondaryIndexPartial'] + - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.PartitionZoneConfig', '*scpb.SecondaryIndexPartial'] - joinOnIndexID($index, $dependent, $table-id, $index-id) - ToPublicOrTransient($index-Target, $dependent-Target) - $index-Node[CurrentStatus] = BACKFILL_ONLY @@ -3409,7 +3409,7 @@ deprules to: dependent-Node query: - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - - $dependent[Type] IN ['*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.SecondaryIndexPartial'] + - $dependent[Type] IN ['*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.PartitionZoneConfig', '*scpb.SecondaryIndexPartial'] - joinOnIndexID($index, $dependent, $table-id, $index-id) - toAbsent($index-Target, $dependent-Target) - $index-Node[CurrentStatus] = VALIDATED @@ -3422,7 +3422,7 @@ deprules to: dependent-Node query: - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - - $dependent[Type] IN ['*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.SecondaryIndexPartial'] + - $dependent[Type] IN ['*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.PartitionZoneConfig', '*scpb.SecondaryIndexPartial'] - joinOnIndexID($index, $dependent, $table-id, $index-id) - transient($index-Target, $dependent-Target) - $index-Node[CurrentStatus] = TRANSIENT_VALIDATED @@ -3435,7 +3435,7 @@ deprules to: dependent-Node query: - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - - $dependent[Type] IN ['*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.SecondaryIndexPartial'] + - $dependent[Type] IN ['*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.PartitionZoneConfig', '*scpb.SecondaryIndexPartial'] - joinOnIndexID($index, $dependent, $table-id, $index-id) - $index-Target[TargetStatus] = TRANSIENT_ABSENT - $index-Node[CurrentStatus] = TRANSIENT_VALIDATED @@ -3449,7 +3449,7 @@ deprules to: dependent-Node query: - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - - $dependent[Type] IN ['*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.SecondaryIndexPartial'] + - $dependent[Type] IN ['*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.PartitionZoneConfig', '*scpb.SecondaryIndexPartial'] - joinOnIndexID($index, $dependent, $table-id, $index-id) - $index-Target[TargetStatus] = ABSENT - $index-Node[CurrentStatus] = VALIDATED @@ -3671,7 +3671,7 @@ deprules kind: Precedence to: descriptor-Node query: - - $dependent[Type] IN ['*scpb.CheckConstraint', '*scpb.CheckConstraintUnvalidated', '*scpb.Column', '*scpb.ColumnComment', '*scpb.ColumnComputeExpression', '*scpb.ColumnDefaultExpression', '*scpb.ColumnFamily', '*scpb.ColumnName', '*scpb.ColumnNotNull', '*scpb.ColumnOnUpdateExpression', '*scpb.ColumnType', '*scpb.CompositeTypeAttrName', '*scpb.CompositeTypeAttrType', '*scpb.ConstraintComment', '*scpb.ConstraintWithoutIndexName', '*scpb.DatabaseComment', '*scpb.DatabaseRegionConfig', '*scpb.DatabaseRoleSetting', '*scpb.DatabaseZoneConfig', '*scpb.EnumTypeValue', '*scpb.ForeignKeyConstraint', '*scpb.ForeignKeyConstraintUnvalidated', '*scpb.FunctionBody', '*scpb.FunctionLeakProof', '*scpb.FunctionName', '*scpb.FunctionNullInputBehavior', '*scpb.FunctionSecurity', '*scpb.FunctionVolatility', '*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.LDRJobIDs', '*scpb.Namespace', '*scpb.Owner', '*scpb.PrimaryIndex', '*scpb.RowLevelTTL', '*scpb.SchemaChild', '*scpb.SchemaComment', '*scpb.SchemaParent', '*scpb.SecondaryIndex', '*scpb.SecondaryIndexPartial', '*scpb.SequenceOption', '*scpb.SequenceOwner', '*scpb.TableComment', '*scpb.TableLocalityGlobal', '*scpb.TableLocalityPrimaryRegion', '*scpb.TableLocalityRegionalByRow', '*scpb.TableLocalitySecondaryRegion', '*scpb.TablePartitioning', '*scpb.TableSchemaLocked', '*scpb.TableZoneConfig', '*scpb.TemporaryIndex', '*scpb.TypeComment', '*scpb.UniqueWithoutIndexConstraint', '*scpb.UniqueWithoutIndexConstraintUnvalidated', '*scpb.UserPrivileges'] + - $dependent[Type] IN ['*scpb.CheckConstraint', '*scpb.CheckConstraintUnvalidated', '*scpb.Column', '*scpb.ColumnComment', '*scpb.ColumnComputeExpression', '*scpb.ColumnDefaultExpression', '*scpb.ColumnFamily', '*scpb.ColumnName', '*scpb.ColumnNotNull', '*scpb.ColumnOnUpdateExpression', '*scpb.ColumnType', '*scpb.CompositeTypeAttrName', '*scpb.CompositeTypeAttrType', '*scpb.ConstraintComment', '*scpb.ConstraintWithoutIndexName', '*scpb.DatabaseComment', '*scpb.DatabaseRegionConfig', '*scpb.DatabaseRoleSetting', '*scpb.DatabaseZoneConfig', '*scpb.EnumTypeValue', '*scpb.ForeignKeyConstraint', '*scpb.ForeignKeyConstraintUnvalidated', '*scpb.FunctionBody', '*scpb.FunctionLeakProof', '*scpb.FunctionName', '*scpb.FunctionNullInputBehavior', '*scpb.FunctionSecurity', '*scpb.FunctionVolatility', '*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.LDRJobIDs', '*scpb.Namespace', '*scpb.Owner', '*scpb.PartitionZoneConfig', '*scpb.PrimaryIndex', '*scpb.RowLevelTTL', '*scpb.SchemaChild', '*scpb.SchemaComment', '*scpb.SchemaParent', '*scpb.SecondaryIndex', '*scpb.SecondaryIndexPartial', '*scpb.SequenceOption', '*scpb.SequenceOwner', '*scpb.TableComment', '*scpb.TableLocalityGlobal', '*scpb.TableLocalityPrimaryRegion', '*scpb.TableLocalityRegionalByRow', '*scpb.TableLocalitySecondaryRegion', '*scpb.TablePartitioning', '*scpb.TableSchemaLocked', '*scpb.TableZoneConfig', '*scpb.TemporaryIndex', '*scpb.TypeComment', '*scpb.UniqueWithoutIndexConstraint', '*scpb.UniqueWithoutIndexConstraintUnvalidated', '*scpb.UserPrivileges'] - $descriptor[Type] IN ['*scpb.AliasType', '*scpb.CompositeType', '*scpb.Database', '*scpb.EnumType', '*scpb.Function', '*scpb.Schema', '*scpb.Sequence', '*scpb.Table', '*scpb.View'] - joinOnDescID($dependent, $descriptor, $desc-id) - toAbsent($dependent-Target, $descriptor-Target) @@ -4350,7 +4350,7 @@ deprules to: dependent-Node query: - $index[Type] = '*scpb.TemporaryIndex' - - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.SecondaryIndexPartial'] + - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.PartitionZoneConfig', '*scpb.SecondaryIndexPartial'] - joinOnIndexID($index, $dependent, $table-id, $index-id) - ToPublicOrTransient($index-Target, $dependent-Target) - $index-Node[CurrentStatus] = DELETE_ONLY @@ -7267,7 +7267,7 @@ deprules kind: Precedence to: relation-Node query: - - $dependent[Type] IN ['*scpb.CheckConstraint', '*scpb.CheckConstraintUnvalidated', '*scpb.Column', '*scpb.ColumnComment', '*scpb.ColumnComputeExpression', '*scpb.ColumnDefaultExpression', '*scpb.ColumnFamily', '*scpb.ColumnName', '*scpb.ColumnNotNull', '*scpb.ColumnOnUpdateExpression', '*scpb.ColumnType', '*scpb.CompositeTypeAttrName', '*scpb.CompositeTypeAttrType', '*scpb.ConstraintComment', '*scpb.ConstraintWithoutIndexName', '*scpb.DatabaseComment', '*scpb.DatabaseRegionConfig', '*scpb.DatabaseRoleSetting', '*scpb.DatabaseZoneConfig', '*scpb.EnumTypeValue', '*scpb.ForeignKeyConstraint', '*scpb.ForeignKeyConstraintUnvalidated', '*scpb.FunctionBody', '*scpb.FunctionLeakProof', '*scpb.FunctionName', '*scpb.FunctionNullInputBehavior', '*scpb.FunctionSecurity', '*scpb.FunctionVolatility', '*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.LDRJobIDs', '*scpb.Namespace', '*scpb.Owner', '*scpb.PrimaryIndex', '*scpb.RowLevelTTL', '*scpb.SchemaChild', '*scpb.SchemaComment', '*scpb.SchemaParent', '*scpb.SecondaryIndex', '*scpb.SecondaryIndexPartial', '*scpb.SequenceOption', '*scpb.SequenceOwner', '*scpb.TableComment', '*scpb.TableLocalityGlobal', '*scpb.TableLocalityPrimaryRegion', '*scpb.TableLocalityRegionalByRow', '*scpb.TableLocalitySecondaryRegion', '*scpb.TablePartitioning', '*scpb.TableSchemaLocked', '*scpb.TableZoneConfig', '*scpb.TemporaryIndex', '*scpb.TypeComment', '*scpb.UniqueWithoutIndexConstraint', '*scpb.UniqueWithoutIndexConstraintUnvalidated', '*scpb.UserPrivileges'] + - $dependent[Type] IN ['*scpb.CheckConstraint', '*scpb.CheckConstraintUnvalidated', '*scpb.Column', '*scpb.ColumnComment', '*scpb.ColumnComputeExpression', '*scpb.ColumnDefaultExpression', '*scpb.ColumnFamily', '*scpb.ColumnName', '*scpb.ColumnNotNull', '*scpb.ColumnOnUpdateExpression', '*scpb.ColumnType', '*scpb.CompositeTypeAttrName', '*scpb.CompositeTypeAttrType', '*scpb.ConstraintComment', '*scpb.ConstraintWithoutIndexName', '*scpb.DatabaseComment', '*scpb.DatabaseRegionConfig', '*scpb.DatabaseRoleSetting', '*scpb.DatabaseZoneConfig', '*scpb.EnumTypeValue', '*scpb.ForeignKeyConstraint', '*scpb.ForeignKeyConstraintUnvalidated', '*scpb.FunctionBody', '*scpb.FunctionLeakProof', '*scpb.FunctionName', '*scpb.FunctionNullInputBehavior', '*scpb.FunctionSecurity', '*scpb.FunctionVolatility', '*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.LDRJobIDs', '*scpb.Namespace', '*scpb.Owner', '*scpb.PartitionZoneConfig', '*scpb.PrimaryIndex', '*scpb.RowLevelTTL', '*scpb.SchemaChild', '*scpb.SchemaComment', '*scpb.SchemaParent', '*scpb.SecondaryIndex', '*scpb.SecondaryIndexPartial', '*scpb.SequenceOption', '*scpb.SequenceOwner', '*scpb.TableComment', '*scpb.TableLocalityGlobal', '*scpb.TableLocalityPrimaryRegion', '*scpb.TableLocalityRegionalByRow', '*scpb.TableLocalitySecondaryRegion', '*scpb.TablePartitioning', '*scpb.TableSchemaLocked', '*scpb.TableZoneConfig', '*scpb.TemporaryIndex', '*scpb.TypeComment', '*scpb.UniqueWithoutIndexConstraint', '*scpb.UniqueWithoutIndexConstraintUnvalidated', '*scpb.UserPrivileges'] - $relation[Type] IN ['*scpb.AliasType', '*scpb.CompositeType', '*scpb.Database', '*scpb.EnumType', '*scpb.Function', '*scpb.Schema', '*scpb.Sequence', '*scpb.Table', '*scpb.View'] - joinOnDescID($dependent, $relation, $relation-id) - ToPublicOrTransient($dependent-Target, $relation-Target) @@ -7388,7 +7388,7 @@ deprules kind: Precedence to: index-Node query: - - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.SecondaryIndexPartial'] + - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.PartitionZoneConfig', '*scpb.SecondaryIndexPartial'] - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - joinOnIndexID($dependent, $index, $table-id, $index-id) - toAbsent($dependent-Target, $index-Target) @@ -7401,7 +7401,7 @@ deprules kind: Precedence to: index-Node query: - - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.SecondaryIndexPartial'] + - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.PartitionZoneConfig', '*scpb.SecondaryIndexPartial'] - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - joinOnIndexID($dependent, $index, $table-id, $index-id) - transient($dependent-Target, $index-Target) @@ -7414,7 +7414,7 @@ deprules kind: Precedence to: index-Node query: - - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.SecondaryIndexPartial'] + - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.PartitionZoneConfig', '*scpb.SecondaryIndexPartial'] - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - joinOnIndexID($dependent, $index, $table-id, $index-id) - $dependent-Target[TargetStatus] = TRANSIENT_ABSENT @@ -7428,7 +7428,7 @@ deprules kind: Precedence to: index-Node query: - - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.SecondaryIndexPartial'] + - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.PartitionZoneConfig', '*scpb.SecondaryIndexPartial'] - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - joinOnIndexID($dependent, $index, $table-id, $index-id) - $dependent-Target[TargetStatus] = ABSENT @@ -7511,7 +7511,7 @@ deprules to: referencing-via-attr-Node query: - $referenced-descriptor[Type] IN ['*scpb.AliasType', '*scpb.CompositeType', '*scpb.Database', '*scpb.EnumType', '*scpb.Function', '*scpb.Schema', '*scpb.Sequence', '*scpb.Table', '*scpb.View'] - - $referencing-via-attr[Type] IN ['*scpb.CheckConstraintUnvalidated', '*scpb.ColumnComment', '*scpb.ColumnComputeExpression', '*scpb.ColumnDefaultExpression', '*scpb.ColumnFamily', '*scpb.ColumnName', '*scpb.ColumnOnUpdateExpression', '*scpb.ColumnType', '*scpb.CompositeTypeAttrName', '*scpb.CompositeTypeAttrType', '*scpb.ConstraintComment', '*scpb.ConstraintWithoutIndexName', '*scpb.DatabaseComment', '*scpb.DatabaseRegionConfig', '*scpb.DatabaseRoleSetting', '*scpb.DatabaseZoneConfig', '*scpb.EnumTypeValue', '*scpb.ForeignKeyConstraintUnvalidated', '*scpb.FunctionBody', '*scpb.FunctionLeakProof', '*scpb.FunctionName', '*scpb.FunctionNullInputBehavior', '*scpb.FunctionSecurity', '*scpb.FunctionVolatility', '*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.LDRJobIDs', '*scpb.Namespace', '*scpb.Owner', '*scpb.RowLevelTTL', '*scpb.SchemaComment', '*scpb.SecondaryIndexPartial', '*scpb.SequenceOption', '*scpb.SequenceOwner', '*scpb.TableComment', '*scpb.TableLocalityGlobal', '*scpb.TableLocalityPrimaryRegion', '*scpb.TableLocalityRegionalByRow', '*scpb.TableLocalitySecondaryRegion', '*scpb.TablePartitioning', '*scpb.TableSchemaLocked', '*scpb.TableZoneConfig', '*scpb.TypeComment', '*scpb.UniqueWithoutIndexConstraintUnvalidated', '*scpb.UserPrivileges'] + - $referencing-via-attr[Type] IN ['*scpb.CheckConstraintUnvalidated', '*scpb.ColumnComment', '*scpb.ColumnComputeExpression', '*scpb.ColumnDefaultExpression', '*scpb.ColumnFamily', '*scpb.ColumnName', '*scpb.ColumnOnUpdateExpression', '*scpb.ColumnType', '*scpb.CompositeTypeAttrName', '*scpb.CompositeTypeAttrType', '*scpb.ConstraintComment', '*scpb.ConstraintWithoutIndexName', '*scpb.DatabaseComment', '*scpb.DatabaseRegionConfig', '*scpb.DatabaseRoleSetting', '*scpb.DatabaseZoneConfig', '*scpb.EnumTypeValue', '*scpb.ForeignKeyConstraintUnvalidated', '*scpb.FunctionBody', '*scpb.FunctionLeakProof', '*scpb.FunctionName', '*scpb.FunctionNullInputBehavior', '*scpb.FunctionSecurity', '*scpb.FunctionVolatility', '*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.LDRJobIDs', '*scpb.Namespace', '*scpb.Owner', '*scpb.PartitionZoneConfig', '*scpb.RowLevelTTL', '*scpb.SchemaComment', '*scpb.SecondaryIndexPartial', '*scpb.SequenceOption', '*scpb.SequenceOwner', '*scpb.TableComment', '*scpb.TableLocalityGlobal', '*scpb.TableLocalityPrimaryRegion', '*scpb.TableLocalityRegionalByRow', '*scpb.TableLocalitySecondaryRegion', '*scpb.TablePartitioning', '*scpb.TableSchemaLocked', '*scpb.TableZoneConfig', '*scpb.TypeComment', '*scpb.UniqueWithoutIndexConstraintUnvalidated', '*scpb.UserPrivileges'] - joinReferencedDescID($referencing-via-attr, $referenced-descriptor, $desc-id) - toAbsent($referenced-descriptor-Target, $referencing-via-attr-Target) - $referenced-descriptor-Node[CurrentStatus] = DROPPED @@ -7567,7 +7567,7 @@ deprules to: dependent-Node query: - $descriptor[Type] IN ['*scpb.AliasType', '*scpb.CompositeType', '*scpb.Database', '*scpb.EnumType', '*scpb.Function', '*scpb.Schema', '*scpb.Sequence', '*scpb.Table', '*scpb.View'] - - $dependent[Type] IN ['*scpb.CheckConstraintUnvalidated', '*scpb.ColumnComment', '*scpb.ColumnComputeExpression', '*scpb.ColumnDefaultExpression', '*scpb.ColumnFamily', '*scpb.ColumnName', '*scpb.ColumnOnUpdateExpression', '*scpb.ColumnType', '*scpb.CompositeTypeAttrName', '*scpb.CompositeTypeAttrType', '*scpb.DatabaseComment', '*scpb.DatabaseRegionConfig', '*scpb.DatabaseRoleSetting', '*scpb.DatabaseZoneConfig', '*scpb.EnumTypeValue', '*scpb.ForeignKeyConstraintUnvalidated', '*scpb.FunctionBody', '*scpb.FunctionLeakProof', '*scpb.FunctionName', '*scpb.FunctionNullInputBehavior', '*scpb.FunctionSecurity', '*scpb.FunctionVolatility', '*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.LDRJobIDs', '*scpb.Namespace', '*scpb.Owner', '*scpb.RowLevelTTL', '*scpb.SchemaChild', '*scpb.SchemaComment', '*scpb.SchemaParent', '*scpb.SecondaryIndexPartial', '*scpb.SequenceOption', '*scpb.SequenceOwner', '*scpb.TableComment', '*scpb.TableLocalityGlobal', '*scpb.TableLocalityPrimaryRegion', '*scpb.TableLocalityRegionalByRow', '*scpb.TableLocalitySecondaryRegion', '*scpb.TablePartitioning', '*scpb.TableSchemaLocked', '*scpb.TableZoneConfig', '*scpb.TypeComment', '*scpb.UniqueWithoutIndexConstraintUnvalidated', '*scpb.UserPrivileges'] + - $dependent[Type] IN ['*scpb.CheckConstraintUnvalidated', '*scpb.ColumnComment', '*scpb.ColumnComputeExpression', '*scpb.ColumnDefaultExpression', '*scpb.ColumnFamily', '*scpb.ColumnName', '*scpb.ColumnOnUpdateExpression', '*scpb.ColumnType', '*scpb.CompositeTypeAttrName', '*scpb.CompositeTypeAttrType', '*scpb.DatabaseComment', '*scpb.DatabaseRegionConfig', '*scpb.DatabaseRoleSetting', '*scpb.DatabaseZoneConfig', '*scpb.EnumTypeValue', '*scpb.ForeignKeyConstraintUnvalidated', '*scpb.FunctionBody', '*scpb.FunctionLeakProof', '*scpb.FunctionName', '*scpb.FunctionNullInputBehavior', '*scpb.FunctionSecurity', '*scpb.FunctionVolatility', '*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.LDRJobIDs', '*scpb.Namespace', '*scpb.Owner', '*scpb.PartitionZoneConfig', '*scpb.RowLevelTTL', '*scpb.SchemaChild', '*scpb.SchemaComment', '*scpb.SchemaParent', '*scpb.SecondaryIndexPartial', '*scpb.SequenceOption', '*scpb.SequenceOwner', '*scpb.TableComment', '*scpb.TableLocalityGlobal', '*scpb.TableLocalityPrimaryRegion', '*scpb.TableLocalityRegionalByRow', '*scpb.TableLocalitySecondaryRegion', '*scpb.TablePartitioning', '*scpb.TableSchemaLocked', '*scpb.TableZoneConfig', '*scpb.TypeComment', '*scpb.UniqueWithoutIndexConstraintUnvalidated', '*scpb.UserPrivileges'] - joinOnDescID($descriptor, $dependent, $desc-id) - toAbsent($descriptor-Target, $dependent-Target) - $descriptor-Node[CurrentStatus] = DROPPED @@ -7606,7 +7606,7 @@ deprules to: dependent-Node query: - $relation[Type] IN ['*scpb.AliasType', '*scpb.CompositeType', '*scpb.Database', '*scpb.EnumType', '*scpb.Function', '*scpb.Schema', '*scpb.Sequence', '*scpb.Table', '*scpb.View'] - - $dependent[Type] IN ['*scpb.CheckConstraint', '*scpb.CheckConstraintUnvalidated', '*scpb.Column', '*scpb.ColumnComment', '*scpb.ColumnComputeExpression', '*scpb.ColumnDefaultExpression', '*scpb.ColumnFamily', '*scpb.ColumnName', '*scpb.ColumnNotNull', '*scpb.ColumnOnUpdateExpression', '*scpb.ColumnType', '*scpb.CompositeTypeAttrName', '*scpb.CompositeTypeAttrType', '*scpb.ConstraintComment', '*scpb.ConstraintWithoutIndexName', '*scpb.DatabaseComment', '*scpb.DatabaseData', '*scpb.DatabaseRegionConfig', '*scpb.DatabaseRoleSetting', '*scpb.DatabaseZoneConfig', '*scpb.EnumTypeValue', '*scpb.ForeignKeyConstraint', '*scpb.ForeignKeyConstraintUnvalidated', '*scpb.FunctionBody', '*scpb.FunctionLeakProof', '*scpb.FunctionName', '*scpb.FunctionNullInputBehavior', '*scpb.FunctionSecurity', '*scpb.FunctionVolatility', '*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexData', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.LDRJobIDs', '*scpb.Namespace', '*scpb.Owner', '*scpb.PrimaryIndex', '*scpb.RowLevelTTL', '*scpb.SchemaChild', '*scpb.SchemaComment', '*scpb.SchemaParent', '*scpb.SecondaryIndex', '*scpb.SecondaryIndexPartial', '*scpb.SequenceOption', '*scpb.SequenceOwner', '*scpb.TableComment', '*scpb.TableData', '*scpb.TableLocalityGlobal', '*scpb.TableLocalityPrimaryRegion', '*scpb.TableLocalityRegionalByRow', '*scpb.TableLocalitySecondaryRegion', '*scpb.TablePartitioning', '*scpb.TableSchemaLocked', '*scpb.TableZoneConfig', '*scpb.TemporaryIndex', '*scpb.TypeComment', '*scpb.UniqueWithoutIndexConstraint', '*scpb.UniqueWithoutIndexConstraintUnvalidated', '*scpb.UserPrivileges'] + - $dependent[Type] IN ['*scpb.CheckConstraint', '*scpb.CheckConstraintUnvalidated', '*scpb.Column', '*scpb.ColumnComment', '*scpb.ColumnComputeExpression', '*scpb.ColumnDefaultExpression', '*scpb.ColumnFamily', '*scpb.ColumnName', '*scpb.ColumnNotNull', '*scpb.ColumnOnUpdateExpression', '*scpb.ColumnType', '*scpb.CompositeTypeAttrName', '*scpb.CompositeTypeAttrType', '*scpb.ConstraintComment', '*scpb.ConstraintWithoutIndexName', '*scpb.DatabaseComment', '*scpb.DatabaseData', '*scpb.DatabaseRegionConfig', '*scpb.DatabaseRoleSetting', '*scpb.DatabaseZoneConfig', '*scpb.EnumTypeValue', '*scpb.ForeignKeyConstraint', '*scpb.ForeignKeyConstraintUnvalidated', '*scpb.FunctionBody', '*scpb.FunctionLeakProof', '*scpb.FunctionName', '*scpb.FunctionNullInputBehavior', '*scpb.FunctionSecurity', '*scpb.FunctionVolatility', '*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexData', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.LDRJobIDs', '*scpb.Namespace', '*scpb.Owner', '*scpb.PartitionZoneConfig', '*scpb.PrimaryIndex', '*scpb.RowLevelTTL', '*scpb.SchemaChild', '*scpb.SchemaComment', '*scpb.SchemaParent', '*scpb.SecondaryIndex', '*scpb.SecondaryIndexPartial', '*scpb.SequenceOption', '*scpb.SequenceOwner', '*scpb.TableComment', '*scpb.TableData', '*scpb.TableLocalityGlobal', '*scpb.TableLocalityPrimaryRegion', '*scpb.TableLocalityRegionalByRow', '*scpb.TableLocalitySecondaryRegion', '*scpb.TablePartitioning', '*scpb.TableSchemaLocked', '*scpb.TableZoneConfig', '*scpb.TemporaryIndex', '*scpb.TypeComment', '*scpb.UniqueWithoutIndexConstraint', '*scpb.UniqueWithoutIndexConstraintUnvalidated', '*scpb.UserPrivileges'] - joinOnDescID($relation, $dependent, $relation-id) - ToPublicOrTransient($relation-Target, $dependent-Target) - $relation-Node[CurrentStatus] = DESCRIPTOR_ADDED @@ -7673,7 +7673,7 @@ deprules kind: Precedence to: index-Node query: - - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.SecondaryIndexPartial'] + - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.PartitionZoneConfig', '*scpb.SecondaryIndexPartial'] - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - joinOnIndexID($dependent, $index, $table-id, $index-id) - ToPublicOrTransient($dependent-Target, $index-Target) @@ -7741,7 +7741,7 @@ deprules to: dependent-Node query: - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex'] - - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.SecondaryIndexPartial'] + - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.PartitionZoneConfig', '*scpb.SecondaryIndexPartial'] - joinOnIndexID($index, $dependent, $table-id, $index-id) - ToPublicOrTransient($index-Target, $dependent-Target) - $index-Node[CurrentStatus] = BACKFILL_ONLY @@ -7785,7 +7785,7 @@ deprules to: dependent-Node query: - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - - $dependent[Type] IN ['*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.SecondaryIndexPartial'] + - $dependent[Type] IN ['*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.PartitionZoneConfig', '*scpb.SecondaryIndexPartial'] - joinOnIndexID($index, $dependent, $table-id, $index-id) - toAbsent($index-Target, $dependent-Target) - $index-Node[CurrentStatus] = VALIDATED @@ -7798,7 +7798,7 @@ deprules to: dependent-Node query: - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - - $dependent[Type] IN ['*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.SecondaryIndexPartial'] + - $dependent[Type] IN ['*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.PartitionZoneConfig', '*scpb.SecondaryIndexPartial'] - joinOnIndexID($index, $dependent, $table-id, $index-id) - transient($index-Target, $dependent-Target) - $index-Node[CurrentStatus] = TRANSIENT_VALIDATED @@ -7811,7 +7811,7 @@ deprules to: dependent-Node query: - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - - $dependent[Type] IN ['*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.SecondaryIndexPartial'] + - $dependent[Type] IN ['*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.PartitionZoneConfig', '*scpb.SecondaryIndexPartial'] - joinOnIndexID($index, $dependent, $table-id, $index-id) - $index-Target[TargetStatus] = TRANSIENT_ABSENT - $index-Node[CurrentStatus] = TRANSIENT_VALIDATED @@ -7825,7 +7825,7 @@ deprules to: dependent-Node query: - $index[Type] IN ['*scpb.PrimaryIndex', '*scpb.SecondaryIndex', '*scpb.TemporaryIndex'] - - $dependent[Type] IN ['*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.SecondaryIndexPartial'] + - $dependent[Type] IN ['*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.PartitionZoneConfig', '*scpb.SecondaryIndexPartial'] - joinOnIndexID($index, $dependent, $table-id, $index-id) - $index-Target[TargetStatus] = ABSENT - $index-Node[CurrentStatus] = VALIDATED @@ -8047,7 +8047,7 @@ deprules kind: Precedence to: descriptor-Node query: - - $dependent[Type] IN ['*scpb.CheckConstraint', '*scpb.CheckConstraintUnvalidated', '*scpb.Column', '*scpb.ColumnComment', '*scpb.ColumnComputeExpression', '*scpb.ColumnDefaultExpression', '*scpb.ColumnFamily', '*scpb.ColumnName', '*scpb.ColumnNotNull', '*scpb.ColumnOnUpdateExpression', '*scpb.ColumnType', '*scpb.CompositeTypeAttrName', '*scpb.CompositeTypeAttrType', '*scpb.ConstraintComment', '*scpb.ConstraintWithoutIndexName', '*scpb.DatabaseComment', '*scpb.DatabaseRegionConfig', '*scpb.DatabaseRoleSetting', '*scpb.DatabaseZoneConfig', '*scpb.EnumTypeValue', '*scpb.ForeignKeyConstraint', '*scpb.ForeignKeyConstraintUnvalidated', '*scpb.FunctionBody', '*scpb.FunctionLeakProof', '*scpb.FunctionName', '*scpb.FunctionNullInputBehavior', '*scpb.FunctionSecurity', '*scpb.FunctionVolatility', '*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.LDRJobIDs', '*scpb.Namespace', '*scpb.Owner', '*scpb.PrimaryIndex', '*scpb.RowLevelTTL', '*scpb.SchemaChild', '*scpb.SchemaComment', '*scpb.SchemaParent', '*scpb.SecondaryIndex', '*scpb.SecondaryIndexPartial', '*scpb.SequenceOption', '*scpb.SequenceOwner', '*scpb.TableComment', '*scpb.TableLocalityGlobal', '*scpb.TableLocalityPrimaryRegion', '*scpb.TableLocalityRegionalByRow', '*scpb.TableLocalitySecondaryRegion', '*scpb.TablePartitioning', '*scpb.TableSchemaLocked', '*scpb.TableZoneConfig', '*scpb.TemporaryIndex', '*scpb.TypeComment', '*scpb.UniqueWithoutIndexConstraint', '*scpb.UniqueWithoutIndexConstraintUnvalidated', '*scpb.UserPrivileges'] + - $dependent[Type] IN ['*scpb.CheckConstraint', '*scpb.CheckConstraintUnvalidated', '*scpb.Column', '*scpb.ColumnComment', '*scpb.ColumnComputeExpression', '*scpb.ColumnDefaultExpression', '*scpb.ColumnFamily', '*scpb.ColumnName', '*scpb.ColumnNotNull', '*scpb.ColumnOnUpdateExpression', '*scpb.ColumnType', '*scpb.CompositeTypeAttrName', '*scpb.CompositeTypeAttrType', '*scpb.ConstraintComment', '*scpb.ConstraintWithoutIndexName', '*scpb.DatabaseComment', '*scpb.DatabaseRegionConfig', '*scpb.DatabaseRoleSetting', '*scpb.DatabaseZoneConfig', '*scpb.EnumTypeValue', '*scpb.ForeignKeyConstraint', '*scpb.ForeignKeyConstraintUnvalidated', '*scpb.FunctionBody', '*scpb.FunctionLeakProof', '*scpb.FunctionName', '*scpb.FunctionNullInputBehavior', '*scpb.FunctionSecurity', '*scpb.FunctionVolatility', '*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.LDRJobIDs', '*scpb.Namespace', '*scpb.Owner', '*scpb.PartitionZoneConfig', '*scpb.PrimaryIndex', '*scpb.RowLevelTTL', '*scpb.SchemaChild', '*scpb.SchemaComment', '*scpb.SchemaParent', '*scpb.SecondaryIndex', '*scpb.SecondaryIndexPartial', '*scpb.SequenceOption', '*scpb.SequenceOwner', '*scpb.TableComment', '*scpb.TableLocalityGlobal', '*scpb.TableLocalityPrimaryRegion', '*scpb.TableLocalityRegionalByRow', '*scpb.TableLocalitySecondaryRegion', '*scpb.TablePartitioning', '*scpb.TableSchemaLocked', '*scpb.TableZoneConfig', '*scpb.TemporaryIndex', '*scpb.TypeComment', '*scpb.UniqueWithoutIndexConstraint', '*scpb.UniqueWithoutIndexConstraintUnvalidated', '*scpb.UserPrivileges'] - $descriptor[Type] IN ['*scpb.AliasType', '*scpb.CompositeType', '*scpb.Database', '*scpb.EnumType', '*scpb.Function', '*scpb.Schema', '*scpb.Sequence', '*scpb.Table', '*scpb.View'] - joinOnDescID($dependent, $descriptor, $desc-id) - toAbsent($dependent-Target, $descriptor-Target) @@ -8726,7 +8726,7 @@ deprules to: dependent-Node query: - $index[Type] = '*scpb.TemporaryIndex' - - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.SecondaryIndexPartial'] + - $dependent[Type] IN ['*scpb.IndexColumn', '*scpb.IndexComment', '*scpb.IndexName', '*scpb.IndexPartitioning', '*scpb.IndexZoneConfig', '*scpb.PartitionZoneConfig', '*scpb.SecondaryIndexPartial'] - joinOnIndexID($index, $dependent, $table-id, $index-id) - ToPublicOrTransient($index-Target, $dependent-Target) - $index-Node[CurrentStatus] = DELETE_ONLY diff --git a/pkg/sql/schemachanger/scplan/internal/rules/release_24_1/helpers.go b/pkg/sql/schemachanger/scplan/internal/rules/release_24_1/helpers.go index a8c0aca69761..d415ef6244bf 100644 --- a/pkg/sql/schemachanger/scplan/internal/rules/release_24_1/helpers.go +++ b/pkg/sql/schemachanger/scplan/internal/rules/release_24_1/helpers.go @@ -226,7 +226,7 @@ func isIndexDependent(e scpb.Element) bool { case *scpb.IndexName, *scpb.IndexComment, *scpb.IndexColumn, *scpb.IndexZoneConfig: return true - case *scpb.IndexPartitioning, *scpb.SecondaryIndexPartial: + case *scpb.IndexPartitioning, *scpb.PartitionZoneConfig, *scpb.SecondaryIndexPartial: return true } return false diff --git a/pkg/sql/schemachanger/scplan/internal/rules/release_24_2/helpers.go b/pkg/sql/schemachanger/scplan/internal/rules/release_24_2/helpers.go index 85a5c8d45e91..106de0490f57 100644 --- a/pkg/sql/schemachanger/scplan/internal/rules/release_24_2/helpers.go +++ b/pkg/sql/schemachanger/scplan/internal/rules/release_24_2/helpers.go @@ -226,7 +226,7 @@ func isIndexDependent(e scpb.Element) bool { case *scpb.IndexName, *scpb.IndexComment, *scpb.IndexColumn, *scpb.IndexZoneConfig: return true - case *scpb.IndexPartitioning, *scpb.SecondaryIndexPartial: + case *scpb.IndexPartitioning, *scpb.PartitionZoneConfig, *scpb.SecondaryIndexPartial: return true } return false