Skip to content

sql, config: incorrect handling of pre-21.1 zone configs #61316

@aayushshah15

Description

@aayushshah15

#57184 introduced two new zone config attributes num_voters and voter_constraints. This was achieved by introducing the following new fields to the zone config proto:

optional int32 num_voters 

repeated ConstraintsConjunction voter_constraints

optional bool inherited_voter_constraints 

The inherited_voter_constraints field helps to disambiguate an empty (but not inherited) voter_constraints against an inherited voter_constraints. However, ZoneConfig protos persisted in 20.2 will not contain these new fields. When such protos are unmarshalled by a 21.1 node, inherted_voter_constraints will default to false.

To reproduce:

roachprod create $CLUSTER -n 5;
roachprod stage $CLUSTER release v20.2.7;
roachprod start $CLUSTER --racks=5;

#  set up a zone config hierarchy based on just the 20.2 fields
roachprod sql $CLUSTER:1 -- -e "create database db; use db; create table t ();"
roachprod sql $CLUSTER:1 -- -e "alter database db configure zone using num_replicas = 3, constraints = '{\"+rack=1\":1}';"
roachprod sql $CLUSTER:1 -- -e "use db; alter table t configure zone using constraints = '{\"+rack=1\":1}';"

# upgrade the cluster
roachprod stop $CLUSTER;
roachprod stage $CLUSTER cockroach
roachprod start $CLUSTER --racks=5;
roachprod sql $CLUSTER:1 -- -e "RESET CLUSTER SETTING cluster.preserve_downgrade_option;"
sleep 60;

# make the database level zone config use the new attributes 
roachprod sql $CLUSTER:1 -- -e "alter database db configure zone using num_replicas = 3, num_voters = 3, voter_constraints = '{\"+rack=1\":1}';"

# at this point, the table should be inheriting the database level voter_constraints, but it won't.
roachprod sql $CLUSTER:1 -- -e "use db; show zone configuration for table t;"

Metadata

Metadata

Assignees

Labels

A-multiregionRelated to multi-regionC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.GA-blocker

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions