Skip to content

sql: Primary Region can be set to the Secondary Region #86879

@e-mbrown

Description

@e-mbrown

We noticed that the primary region can be assigned the same value as the secondary region.

Right now this doesn’t cause any issues since there is a case where partition primary regions can match a secondary region.

To Reproduce

demo@127.0.0.1:26257/movr> CREATE DATABASE db PRIMARY REGION "us-east1" REGIONS "us-west1" SECONDARY REGION "us-west1";
CREATE DATABASE

demo@127.0.0.1:26257/movr> ALTER DATABASE db SET SECONDARY REGION "us-east1";
ERROR: the secondary region cannot be the same as the current primary region
SQLSTATE: 42P12

demo@127.0.0.1:26257/movr> ALTER DATABASE db SET PRIMARY REGION "us-west1";
ALTER DATABASE PRIMARY REGION

We can block this behavior, or drop the secondary region and send a notice.

Epic CRDB-2521
Jira issue: CRDB-18980

Metadata

Metadata

Assignees

Labels

C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.GA-blockerbranch-masterFailures and bugs on the master branch.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions