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

sql: stop duplicating regions on the database descriptor #61585

Merged
merged 1 commit into from
Mar 17, 2021

Commits on Mar 17, 2021

  1. sql: stop duplicating regions on the database descriptor

    Previously, we were duplicating regions both on the type descriptor and
    the database descriptor. Theres a verbose explanation about why this is
    bad on the linked issue, but the crux of the problem with this approach
    is the added complexity it requires keeping these two lists in sync as
    regions are added/dropped from a database in the face of possible
    failure scenarios.
    
    This patch removes the `Regions` field from the database descriptors's
    region config. Instead, the regions stored on the multi-region enum
    serve as the sole source of truth. To accomplish this, we introduce a
    new `RegionConfig` struct which is synthesized from the state (primary
    region, survival goal) stored on the database and the state (available
    regions) stored on the type descriptor. All the places that constructed
    zone configurations from the raw region config proto now use this new
    struct. This patch also introduces a `InitializationRegionConfig`
    struct which wraps a `RegionConfig` with initilization specific
    meta-data.
    
    I'm not too thrilled by the fact that survival goal and primary region
    is still stored on the database descriptor. Ideally, the database
    descriptor would contain just the multi-region enum ID and all user
    configured parameters would be in one place (on the type descriptor's
    region config). The level of indirection introduced by this patch sets
    us on the path to that future.
    
    Closes cockroachdb#60620
    
    Release justification: low risk updates to new functionality
    Release note: None
    arulajmani committed Mar 17, 2021
    Configuration menu
    Copy the full SHA
    453a13a View commit details
    Browse the repository at this point in the history