Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
135933: scpb: ensure IndexZoneConfig fields do not overlap r=annrpom a=annrpom

In [cockroachdb#134522](cockroachdb#134472), we added a fix to ensure that we cleaned up backrefs properly for our `IndexZoneConfig` element, but in doing so, we created an overlap of field ID `3` between v24.2+. This patch ensures that we do not re-use the same field ID for a different field in our IndexZoneConfig element by marking it as `reserved`.

Fixes: cockroachdb#133003
Fixes: cockroachdb#135807

Release note: None

Co-authored-by: Annie Pompa <[email protected]>
  • Loading branch information
craig[bot] and annrpom committed Nov 21, 2024
2 parents ba4f7ad + d0d3a1e commit 11743ed
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/sql/schemachanger/scpb/elements.proto
Original file line number Diff line number Diff line change
Expand Up @@ -785,13 +785,17 @@ message TableZoneConfig {
message IndexZoneConfig {
uint32 table_id = 1 [(gogoproto.customname) = "TableID", (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/sem/catid.DescID"];
uint32 index_id = 2 [(gogoproto.customname) = "IndexID", (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/sem/catid.IndexID"];
cockroach.config.zonepb.Subzone subzone = 3 [(gogoproto.nullable) = false];
repeated cockroach.config.zonepb.SubzoneSpan subzone_spans = 4 [(gogoproto.nullable) = false];
cockroach.config.zonepb.Subzone subzone = 4 [(gogoproto.nullable) = false];
repeated cockroach.config.zonepb.SubzoneSpan subzone_spans = 5 [(gogoproto.nullable) = false];
// `seq_num` is used to differentiate different subzone config elements tied
// to the same index. E.g. If we attempt to update an index subzone config,
// our solution is to drop the existing element and add a new element, with
// different `seq_num`.
uint32 seq_num = 5;
uint32 seq_num = 6;
// In v24.3, we deprecated this field ID (previously: partition_name) in favor
// of creating a new element that represents partitions --
// PartitionZoneConfig.
reserved 3;
}

message PartitionZoneConfig {
Expand Down

0 comments on commit 11743ed

Please sign in to comment.