-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: sql: stop duplicating regions on the database descriptor #62200
Merged
arulajmani
merged 1 commit into
cockroachdb:release-21.1
from
arulajmani:backport21.1-61585
Mar 18, 2021
Merged
release-21.1: sql: stop duplicating regions on the database descriptor #62200
arulajmani
merged 1 commit into
cockroachdb:release-21.1
from
arulajmani:backport21.1-61585
Mar 18, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
requested review from
otan,
ajstorm,
a team and
miretskiy
and removed request for
a team
March 18, 2021 14:34
ajstorm
approved these changes
Mar 18, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 39 of 39 files at r1.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @miretskiy and @otan)
ajstorm
added a commit
to ajstorm/cockroach
that referenced
this pull request
Mar 22, 2021
…tion Previously, we required override_multi_region_zone_config to be specified if multiple add/drop region operations were included in a single transaction. This was due to the fact that the RegionConfig would get updated as part of the first operation, but the zone configurations to which we were comparing were not updated until the transaction committed. This issue was fixed in part by cockroachdb#62200, but this PR finishes the job by creating a function which synthesizes a zone configuration which presents the state of the RegionConfig at the beginning of the transaction. Release note: None
ajstorm
added a commit
to ajstorm/cockroach
that referenced
this pull request
Mar 23, 2021
…tion Previously, we required override_multi_region_zone_config to be specified if multiple add/drop region operations were included in a single transaction. This was due to the fact that the RegionConfig would get updated as part of the first operation, but the zone configurations to which we were comparing were not updated until the transaction committed. This issue was fixed in part by cockroachdb#62200, but this PR finishes the job by creating a function which synthesizes a zone configuration which presents the state of the RegionConfig at the beginning of the transaction. Release note: None
ajstorm
added a commit
to ajstorm/cockroach
that referenced
this pull request
Mar 23, 2021
…tion Previously, we required override_multi_region_zone_config to be specified if multiple add/drop region operations were included in a single transaction. This was due to the fact that the RegionConfig would get updated as part of the first operation, but the zone configurations to which we were comparing were not updated until the transaction committed. This issue was fixed in part by cockroachdb#62200, but this PR finishes the job by creating a function which synthesizes a zone configuration which presents the state of the RegionConfig at the beginning of the transaction. Release note: None
ajstorm
added a commit
to ajstorm/cockroach
that referenced
this pull request
Mar 24, 2021
…tion Previously, we required override_multi_region_zone_config to be specified if multiple add/drop region operations were included in a single transaction. This was due to the fact that the RegionConfig would get updated as part of the first operation, but the zone configurations to which we were comparing were not updated until the transaction committed. This issue was fixed in part by cockroachdb#62200, but this PR finishes the job by creating a function which synthesizes a zone configuration which presents the state of the RegionConfig at the beginning of the transaction. Release note: None
craig bot
pushed a commit
that referenced
this pull request
Mar 24, 2021
62354: sql: Don't require override for multiple MR abstractions in a transaction r=arulajmani a=ajstorm Previously, we required override_multi_region_zone_config to be specified if multiple add/drop region operations were included in a single transaction. This was due to the fact that the RegionConfig would get updated as part of the first operation, but the zone configurations to which we were comparing were not updated until the transaction committed. This issue was fixed in part by #62200, but this PR finishes the job by creating a function which synthesizes a zone configuration which presents the state of the RegionConfig at the beginning of the transaction. Resolves: #61551 Release note: None Co-authored-by: Adam Storm <storm@cockroachlabs.com>
ajstorm
added a commit
to ajstorm/cockroach
that referenced
this pull request
Mar 24, 2021
…tion Previously, we required override_multi_region_zone_config to be specified if multiple add/drop region operations were included in a single transaction. This was due to the fact that the RegionConfig would get updated as part of the first operation, but the zone configurations to which we were comparing were not updated until the transaction committed. This issue was fixed in part by cockroachdb#62200, but this PR finishes the job by creating a function which synthesizes a zone configuration which presents the state of the RegionConfig at the beginning of the transaction. Release note: None
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport 1/1 commits from #61585.
/cc @cockroachdb/release
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'sregion 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 (primaryregion, 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 specificmeta-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 #60620
Release justification: low risk updates to new functionality
Release note: None