Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release-21.1: add crdb_internal.validate_multi_region_zone_configs builtin #62931

Merged

Conversation

otan
Copy link
Contributor

@otan otan commented Apr 1, 2021

Backport:

Please see individual PRs for details.

/cc @cockroachdb/release

otan added 2 commits April 1, 2021 15:11
In addition to the release note, added some pgcodes to validation errors
as well as minor refactoring to make it work and error nicely with the
"overriding" error message.

Also fix up some of the string escaping to use tree.Name.

Release note (sql change): Add a new builtin
`crdb_internal.validate_multi_region_zone_configs` which validates all
zone configurations in the current database are correctly configured.
* Subzones may be defined in a different order. We did not take this
  into account which can cause bugs when e.g. ADD REGION adds a subzone
  in the end rather than in the old "expected" location in the subzones
  array. This has been fixed by comparing subzones using an unordered
  map.
* The ApplyZoneConfig we previously did overwrote subzone fields on the
  original subzone array element, meaning that if there was a mismatch
  it would not be reported through validation. This is now fixed by
  applying the expected zone config to *zonepb.NewZoneConfig() instead.
* Added logic to only check for zone config matches subzones from
  active subzone IDs.
* Improve the error messaging when a subzone config is mismatching -
  namely, add index and partitioning information and differentiate
  between missing fields and missing / extraneous zone configs

Release note (bug fix): Fixed validation bugs during ALTER TABLE ... SET
LOCALITY / crdb_internal.validate_multi_region_zone_config where
validation errors could occur when the database of a REGIONAL BY ROW
table has a new region added. Also fix a validation bug partition zone
mismatches configs were not caught.
@otan otan requested review from ajstorm, a team and miretskiy and removed request for a team April 1, 2021 04:11
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@ajstorm ajstorm merged commit 35ee9d2 into cockroachdb:release-21.1 Apr 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants