cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
30.2k stars 3.82k forks source link

schemachanger: add `checkNoRegionChangeUnderway` checks #136320

Open annrpom opened 3 days ago

annrpom commented 3 days ago

In TestRegionChangeRacingRegionalByRowChange, we ensure that firing off an ADD/DROP REGION whilst an index-related change on an RBR table is happening (and vice versa) fails properly.

In the declarative schema changer, this means we need to ensure that no regions on the database are being modified before we can proceed with the schema change -- like in drop index https://github.com/cockroachdb/cockroach/blob/9f8f1e8ed68700ece9f8d343b515654de81ff801/pkg/sql/drop_index.go#L330-L338

In other words, this tracks the implementation of checkNoRegionChangeUnderway in the DSC.

Jira issue: CRDB-44972

annrpom commented 3 days ago

This check is needed for the following schema changes on an RBR table: