-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
schemachanger: add support for discarding subzones
This patch adds support for discarding a subzone config in the DSC. Fixes: #133158 Epic: none Release note: None
- Loading branch information
Showing
46 changed files
with
1,157 additions
and
97 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
.../alter_partition_configure_zone_discard/alter_partition_configure_zone_discard.definition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
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 = 11; | ||
ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING num_replicas = 12; | ||
ALTER PARTITION p2 OF INDEX t@t_pkey CONFIGURE ZONE USING num_replicas = 10; | ||
ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE DISCARD; | ||
---- |
82 changes: 82 additions & 0 deletions
82
...lter_partition_configure_zone_discard/alter_partition_configure_zone_discard.side_effects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* 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 = 11; | ||
ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE USING num_replicas = 12; | ||
ALTER PARTITION p2 OF INDEX t@t_pkey CONFIGURE ZONE USING num_replicas = 10; | ||
ALTER PARTITION p1 OF INDEX t@t_pkey CONFIGURE ZONE DISCARD; | ||
---- | ||
begin transaction #1 | ||
# begin StatementPhase | ||
checking for feature: CONFIGURE ZONE | ||
write *eventpb.SetZoneConfig to event log: | ||
config: | ||
options: | ||
- num_replicas = 11 | ||
target: PARTITION p1 OF INDEX defaultdb.public.t@t_pkey | ||
resolvedOldConfig: 'inherited_constraints:false null_voter_constraints_is_empty:false inherited_lease_preferences:false ' | ||
sql: | ||
descriptorId: 104 | ||
statement: ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹num_replicas› = ‹11› | ||
tag: CONFIGURE ZONE | ||
user: root | ||
## StatementPhase stage 1 of 1 with 1 MutationType op | ||
upsert zone config for #104 | ||
checking for feature: CONFIGURE ZONE | ||
write *eventpb.SetZoneConfig to event log: | ||
config: | ||
options: | ||
- num_replicas = 12 | ||
target: PARTITION p1 OF INDEX defaultdb.public.t@t_pkey | ||
resolvedOldConfig: 'inherited_constraints:false null_voter_constraints_is_empty:false inherited_lease_preferences:false ' | ||
sql: | ||
descriptorId: 104 | ||
statement: ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹num_replicas› = ‹12› | ||
tag: CONFIGURE ZONE | ||
user: root | ||
## StatementPhase stage 1 of 1 with 1 MutationType op | ||
upsert zone config for #104 | ||
checking for feature: CONFIGURE ZONE | ||
write *eventpb.SetZoneConfig to event log: | ||
config: | ||
options: | ||
- num_replicas = 10 | ||
target: PARTITION p2 OF INDEX defaultdb.public.t@t_pkey | ||
resolvedOldConfig: 'inherited_constraints:false null_voter_constraints_is_empty:false inherited_lease_preferences:false ' | ||
sql: | ||
descriptorId: 104 | ||
statement: ALTER PARTITION ‹p2› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹num_replicas› = ‹10› | ||
tag: CONFIGURE ZONE | ||
user: root | ||
## StatementPhase stage 1 of 1 with 1 MutationType op | ||
upsert zone config for #104 | ||
checking for feature: CONFIGURE ZONE | ||
write *eventpb.RemoveZoneConfig to event log: | ||
config: | ||
target: PARTITION p1 OF INDEX defaultdb.public.t@t_pkey | ||
sql: | ||
descriptorId: 104 | ||
statement: ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE DISCARD | ||
tag: CONFIGURE ZONE | ||
user: root | ||
## StatementPhase stage 1 of 1 with 2 MutationType ops | ||
# 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 |
30 changes: 30 additions & 0 deletions
30
...n_configure_zone_discard/alter_partition_configure_zone_discard__statement_1_of_4.explain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = 11; | ||
---- | ||
Schema change plan for ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹num_replicas› = ‹11›; | ||
├── 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 {"SubzoneIndexToDelete":-1,"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 {"SubzoneIndexToDelete":-1,"TableID":104} |
14 changes: 14 additions & 0 deletions
14
...igure_zone_discard/alter_partition_configure_zone_discard__statement_1_of_4.explain_shape
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = 11; | ||
---- | ||
Schema change plan for ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹public›.‹t›@‹t_pkey› CONFIGURE ZONE USING ‹num_replicas› = ‹11›; | ||
└── execute 1 system table mutations transaction |
Oops, something went wrong.