-
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
sql: refactor SynthesizeRegionConfig usages #63512
Conversation
58e4f67
to
f4a3054
Compare
25a18c5
to
3325ca4
Compare
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.
This may break the following (contrived) scenario:
- Client 1: ALTER DATABASE ... DROP REGION "us-east"
- Client 2: CREATE TABLE t() LOCALITY REGIONAL BY ROW
- Client 3, which (say) has version v-1 of the type descriptor,
validate_multi_region_zone_configs()
<--- Fails because it expects t to have a partition for "us-east"
This is because on version v-1 "us-east" is public, so we'll validate for it. Granted, this is quite contrived, but maybe one round-trip is a fair enough price to pay here for our sanity? Wdyt?
Reviewable status: complete! 0 of 0 LGTMs obtained
I would think client 3 in this case would also have v1 of the zone config. |
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.
Maybe I'm missing something, but aren't we reading zone configs from the system.zone table?
Also, independent of round trip/no round trip, I like the way this PR cleans up the code so we should get it in in some form.
Reviewable status: complete! 0 of 0 LGTMs obtained
Would've thought leasing would also mean the reads would be at an earlier timestamp when reading system.zones, but maybe I'm jumping too many hurdles. I'll revert the round-trip bit for now, but keep the refactor for SynthesizeRegionConfig |
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.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @otan)
pkg/sql/region_util.go, line 889 at r1 (raw file):
// CurrentDatabaseRegionConfig is part of the tree.EvalDatabase interface. // CurrentDatabaseRegionConfig uses the cache to synthesize the RegionConfig // and as such is intended for DML use. It returns an nil
nit: s/returns an nil/returns nil/g
Use the option method instead to decide to read from the cache. Release note: None
bors r=arulajmani |
🕐 Waiting for PR status (Github check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set. |
Build succeeded: |
Use the option method instead to decide to read from the cache.
Release note: None