Skip to content

Commit

Permalink
scpb: ensure IndexZoneConfig fields do not overlap
Browse files Browse the repository at this point in the history
In cockroachdb#134522, 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
  • Loading branch information
annrpom committed Nov 21, 2024
1 parent 9a9d9a8 commit b20c7c8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/sql/schemachanger/scpb/elements.proto
Original file line number Diff line number Diff line change
Expand Up @@ -785,13 +785,14 @@ 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;
reserved 3;
}

message PartitionZoneConfig {
Expand Down

0 comments on commit b20c7c8

Please sign in to comment.