Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

schemachanger: add support for discarding subzones #134826

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions pkg/ccl/schemachangerccl/backup_base_generated_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 70 additions & 0 deletions pkg/ccl/schemachangerccl/ccl_generated_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pkg/ccl/schemachangerccl/testdata/decomp/multiregion
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,7 @@ ElementState:
Status: PUBLIC
- PartitionZoneConfig:
indexId: 1
oldIdxRef: -1
partitionName: us-east1
seqNum: 0
subzone:
Expand Down Expand Up @@ -1392,6 +1393,7 @@ ElementState:
Status: PUBLIC
- PartitionZoneConfig:
indexId: 1
oldIdxRef: -1
partitionName: us-east2
seqNum: 0
subzone:
Expand Down Expand Up @@ -1429,6 +1431,7 @@ ElementState:
Status: PUBLIC
- PartitionZoneConfig:
indexId: 1
oldIdxRef: -1
partitionName: us-east3
seqNum: 0
subzone:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Schema change plan for ALTER INDEX ‹defaultdb›.‹public›.‹t›@‹foo
│ ├── 1 element transitioning toward PUBLIC
│ │ └── ABSENT → PUBLIC IndexZoneConfig:{DescID: 104 (t), IndexID: 2 (foo), SeqNum: 1}
│ └── 1 Mutation operation
│ └── AddIndexZoneConfig {"TableID":104}
│ └── AddIndexZoneConfig {"SubzoneIndexToDelete":-1,"TableID":104}
└── PreCommitPhase
├── Stage 1 of 2 in PreCommitPhase
│ ├── 1 element transitioning toward PUBLIC
Expand All @@ -22,4 +22,4 @@ Schema change plan for ALTER INDEX ‹defaultdb›.‹public›.‹t›@‹foo
├── 1 element transitioning toward PUBLIC
│ └── ABSENT → PUBLIC IndexZoneConfig:{DescID: 104 (t), IndexID: 2 (foo), SeqNum: 1}
└── 1 Mutation operation
└── AddIndexZoneConfig {"TableID":104}
└── AddIndexZoneConfig {"SubzoneIndexToDelete":-1,"TableID":104}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Schema change plan for ALTER INDEX ‹defaultdb›.‹public›.‹t›@‹foo
│ ├── 1 element transitioning toward PUBLIC
│ │ └── ABSENT → PUBLIC IndexZoneConfig:{DescID: 104 (t), IndexID: 2 (foo), SeqNum: 1}
│ └── 1 Mutation operation
│ └── AddIndexZoneConfig {"TableID":104}
│ └── AddIndexZoneConfig {"SubzoneIndexToDelete":-1,"TableID":104}
└── PreCommitPhase
├── Stage 1 of 2 in PreCommitPhase
│ ├── 1 element transitioning toward PUBLIC
Expand All @@ -22,4 +22,4 @@ Schema change plan for ALTER INDEX ‹defaultdb›.‹public›.‹t›@‹foo
├── 1 element transitioning toward PUBLIC
│ └── ABSENT → PUBLIC IndexZoneConfig:{DescID: 104 (t), IndexID: 2 (foo), SeqNum: 1}
└── 1 Mutation operation
└── AddIndexZoneConfig {"TableID":104}
└── AddIndexZoneConfig {"SubzoneIndexToDelete":-1,"TableID":104}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Schema change plan for ALTER INDEX ‹defaultdb›.‹public›.‹t›@‹foo
│ ├── 1 element transitioning toward PUBLIC
│ │ └── ABSENT → PUBLIC IndexZoneConfig:{DescID: 104 (t), IndexID: 2 (foo), SeqNum: 2}
│ └── 1 Mutation operation
│ └── AddIndexZoneConfig {"TableID":104}
│ └── AddIndexZoneConfig {"SubzoneIndexToDelete":-1,"TableID":104}
└── PreCommitPhase
├── Stage 1 of 2 in PreCommitPhase
│ ├── 2 elements transitioning toward PUBLIC
Expand All @@ -25,5 +25,5 @@ Schema change plan for ALTER INDEX ‹defaultdb›.‹public›.‹t›@‹foo
│ ├── ABSENT → PUBLIC IndexZoneConfig:{DescID: 104 (t), IndexID: 2 (foo), SeqNum: 1}
│ └── ABSENT → PUBLIC IndexZoneConfig:{DescID: 104 (t), IndexID: 2 (foo), SeqNum: 2}
└── 2 Mutation operations
├── AddIndexZoneConfig {"TableID":104}
└── AddIndexZoneConfig {"TableID":104}
├── AddIndexZoneConfig {"SubzoneIndexToDelete":-1,"TableID":104}
└── AddIndexZoneConfig {"SubzoneIndexToDelete":-1,"TableID":104}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Schema change plan for ALTER INDEX ‹defaultdb›.‹public›.‹t›@‹foo
│ ├── 1 element transitioning toward PUBLIC
│ │ └── ABSENT → PUBLIC IndexZoneConfig:{DescID: 104 (t), IndexID: 2 (foo), SeqNum: 3}
│ └── 1 Mutation operation
│ └── AddIndexZoneConfig {"TableID":104}
│ └── AddIndexZoneConfig {"SubzoneIndexToDelete":-1,"TableID":104}
└── PreCommitPhase
├── Stage 1 of 2 in PreCommitPhase
│ ├── 3 elements transitioning toward PUBLIC
Expand All @@ -28,6 +28,6 @@ Schema change plan for ALTER INDEX ‹defaultdb›.‹public›.‹t›@‹foo
│ ├── ABSENT → PUBLIC IndexZoneConfig:{DescID: 104 (t), IndexID: 2 (foo), SeqNum: 2}
│ └── ABSENT → PUBLIC IndexZoneConfig:{DescID: 104 (t), IndexID: 2 (foo), SeqNum: 3}
└── 3 Mutation operations
├── AddIndexZoneConfig {"TableID":104}
├── AddIndexZoneConfig {"TableID":104}
└── AddIndexZoneConfig {"TableID":104}
├── AddIndexZoneConfig {"SubzoneIndexToDelete":-1,"TableID":104}
├── AddIndexZoneConfig {"SubzoneIndexToDelete":-1,"TableID":104}
└── AddIndexZoneConfig {"SubzoneIndexToDelete":-1,"TableID":104}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Schema change plan for ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹publ
│ ├── 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}
│ └── AddPartitionZoneConfig {"SubzoneIndexToDelete":-1,"TableID":104}
└── PreCommitPhase
├── Stage 1 of 2 in PreCommitPhase
│ ├── 1 element transitioning toward PUBLIC
Expand All @@ -27,4 +27,4 @@ Schema change plan for ALTER PARTITION ‹p1› OF INDEX ‹defaultdb›.‹publ
├── 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}
└── AddPartitionZoneConfig {"SubzoneIndexToDelete":-1,"TableID":104}
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;
----
Loading