Skip to content

Commit

Permalink
release-24.2: schemachanger: add PartitionName to IndexZoneConfig attr
Browse files Browse the repository at this point in the history
This patch adds a `PartitionName` attribute to the `IndexZoneConfig`
element to uniquely identify partitions from one another. Prior to this,
performing a DROP on a TODO

Epic: none
Fixes: #131862

Release note (bug fix): TODO
  • Loading branch information
annrpom committed Nov 6, 2024
1 parent 8dfd45d commit c769ca5
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 4 deletions.
24 changes: 24 additions & 0 deletions pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_configs
Original file line number Diff line number Diff line change
Expand Up @@ -1864,3 +1864,27 @@ SELECT crdb_internal.reset_multi_region_zone_configs_for_table($tbl11_id)

query error user testuser must be owner of test or have CREATE privilege on database test
SELECT crdb_internal.validate_multi_region_zone_configs()

subtest drop_all_backrefs

user root

statement ok
CREATE DATABASE db1 PRIMARY REGION "ca-central-1" REGIONS "ap-southeast-2", "us-east-1" SURVIVE REGION FAILURE

statement ok
CREATE TABLE db1.t1_with_index_zone(x INT, j INT REFERENCES db1.t1_with_index_zone(x), PRIMARY KEY(x)) LOCALITY REGIONAL BY ROW

statement ok
ALTER PARTITION "ap-southeast-2" OF INDEX db1.t1_with_index_zone@t1_with_index_zone_pkey CONFIGURE ZONE USING gc.ttlseconds = 32000;

statement ok
ALTER PARTITION "ca-central-1" OF INDEX db1.t1_with_index_zone@t1_with_index_zone_pkey CONFIGURE ZONE USING gc.ttlseconds = 34000;

statement ok
ALTER PARTITION "us-east-1" OF INDEX db1.t1_with_index_zone@t1_with_index_zone_pkey CONFIGURE ZONE USING gc.ttlseconds = 38000;

statement ok
DROP TABLE db1.t1_with_index_zone CASCADE;

subtest end
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ go_test(
"//pkg/ccl/logictestccl:testdata", # keep
],
exec_properties = {"test.Pool": "large"},
shard_count = 21,
shard_count = 22,
tags = ["cpu:4"],
deps = [
"//pkg/base",
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ go_test(
"//pkg/ccl/logictestccl:testdata", # keep
],
exec_properties = {"test.Pool": "large"},
shard_count = 17,
shard_count = 18,
tags = ["cpu:4"],
deps = [
"//pkg/base",
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ go_test(
"//pkg/ccl/logictestccl:testdata", # keep
],
exec_properties = {"test.Pool": "large"},
shard_count = 29,
shard_count = 30,
tags = ["cpu:4"],
deps = [
"//pkg/base",
Expand Down

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

4 changes: 4 additions & 0 deletions pkg/sql/schemachanger/screl/attr.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ const (
// Expr corresponds to the string representation of a SQL expression for an element.
Expr

// PartitionName corresponds to the name of a partition.
PartitionName

// AttrMax is the largest possible Attr value.
// Note: add any new enum values before TargetStatus, leave these at the end.
AttrMax = iota - 1
Expand Down Expand Up @@ -385,6 +388,7 @@ var elementSchemaOptions = []rel.SchemaOption{
rel.EntityMapping(t((*scpb.IndexZoneConfig)(nil)),
rel.EntityAttr(DescID, "TableID"),
rel.EntityAttr(IndexID, "IndexID"),
rel.EntityAttr(PartitionName, "PartitionName"),
),
rel.EntityMapping(t((*scpb.DatabaseData)(nil)),
rel.EntityAttr(DescID, "DatabaseID"),
Expand Down
5 changes: 4 additions & 1 deletion pkg/sql/schemachanger/screl/attr_string.go

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

0 comments on commit c769ca5

Please sign in to comment.