-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
server: polish "cascading" zone configs #28901
Comments
A hurdle is that Go does not let us see the difference between "field is unset" and "field value set by user also happens to be the default value for that type in Go". So really solving this will require changing at least the ZoneConfig struct (with booleans everywhere) and the marshal/unmarshal functions. |
See also #30375. There may be some incorrectness to solve as part of this work. |
As @knz mentioned, we must first change the One way of getting this extra information that is required is having booleans in the structure for each of them. Alternatively we could have a reserved value for each to serve as a flag that it has not been explicitly set (For example Line 481 in 7be4709
Are there other ways of deducing whether the field is inherited? |
To play devil's advocate, zero values make no sense (or aren't necessary to be used) for the four fields that you mentioned initially (though we might have to do some work to make sure users can't use zero values there). They do seem to make sense for For compat purposes, it might be easier to add a bool to each field that indicates whether the field is intentionally empty (or whether it just happens to be set to zero). This isn't pretty, but allows existing zone configs (which won't have any of the bools set) to work as today. |
IF you use separate fields you need to flip the boolean: the default So probably the boolean will be called "inherit" |
So to confirm, this also applies to I also just wanted to note somthething for future discussions about the zone tables and subzone structures: While navigating the hierarchies of zones and subzones (with zones having their own list of subzones, where the list contains index subzones as well as partitions on index subzones), It becomes fairly hairy to figure out how to inherit fields. If they we're all in the |
That's unfortunately not true:
🤦♂️ It's also perfectly reasonable to set
I'll voice my vote in favor of making these not inherit. If your database has the constraints
Note that also removing |
Their values should cascade if they're empty, but not if they're set to different things. I wouldn't want setting a table's What we should be striving for is that zone config updates to different zones are commutative. The end state should be the same regardless of whether I run: ALTER DATABASE foo CONFIGURE ZONE USING gc.ttlseconds = 30;
ALTER TABLE foo.bar CONFIGURE ZONE USING constraints = '[+region=us-east]'; or ALTER TABLE foo.bar CONFIGURE ZONE USING constraints = '[+region=us-east]';
ALTER DATABASE foo CONFIGURE ZONE USING gc.ttlseconds = 30; Today that isn't the case, but it should be.
That is what's for, after all :) |
Note that this is currently true if you're modifying the same field in each zone, e.g.:
Regardless of the order of the statements, table foo.bar will be constrained to us-west and everything else in database foo will be constrained to us-east. |
Other than the type difference (making it nullable changes the type to a ptr so we can check if the field is set) that seems a great idea. I think I'm going with that one if no one objects. Also as @a-robinson mentioned, if the values are set then they won't look them up in their parents so in your example @benesch:
The table constraints would remain as |
Yes, that's exactly what I mean. Sorry I wasn't more clear. |
I'm not too excited by go's native implementation of nullable protobuf fields. In terms of memory usage and access patterns (performance) it's strictly worse than abundantly accompanying booleans. Maybe we want yo use the nullable protobuf spec but bake our own marshalling.
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
30426: rfc: Cascading Zone Configs r=ridwanmsharif a=ridwanmsharif Adds an RFC to discuss proposals and design for cascading zone configs. Discusses changes to the `ZoneConfig` structure, why it is needed, the different ways we could change it and designs what the change should look like Issue: #28901 Release note: None Co-authored-by: Ridwan Sharif <[email protected]>
Very much a WIP. Modifies the `ZoneConfig` struct to make fields optional now. If fields are not set, they are looked for in the heirarchy. Refer to the RFC for more details. Issue: cockroachdb#28901 Implements most of RFC: cockroachdb#30426 Release note: None
30611: sql, config: make zone configs cascade r=ridwanmsharif a=ridwanmsharif Modifies the `ZoneConfig` struct to make fields optional now. If fields are not set, they are looked for in the heirarchy. Refer to the RFC for more details. Issue: #28901 Implements most of RFC: #30426 TODO: - [x] Update `set_zone_config` to use the new structure and validate them - [x] Exhaustively test cascading zone configs Release note: Changes behavior of Zone Configs. Co-authored-by: Ridwan Sharif <[email protected]>
Zone configs do cascade now. Leaving this open though until the following is complete:
|
@awoods187 see the TODO list above. Most of that is UX so I'll defer to your opinion on how much of it should actually happen. |
Ah I missed that--updated the title to make it clear |
@awoods187 I think the remaining TODO items are for the SQL team not core any more. Although I might be convinced to work on this since I touched this code last and it's going to come under the umbrella of DUX. |
@awoods187 moving to SQL based on the last comment from @knz, please close if no longer relevant. |
That makes sense. @ajstorm I think this mostly translates to "locality" zone configurations which we've moved away from users interacting with directly in multi-region. Do you think we can close it out? |
The above thread is very long, and seems to contain a bunch of historical context that I don't have. @awoods187 are you able to net this out a bit more? |
The remaining work here is UX, and tracked in #31398. |
Split from #14990 (comment).
When a zone config is created, the parent zone config is copied and the copy adapted with the fields specified by the user. This means that if the parent zone config changes later, the child won't receive the update.
This is problematic. For example, the
.default
zone config specifies three replicas when a cluster is replicated. Correspondingly, the.liveness
,.meta
andsystem
zone configs now have a replication factor of three.If a user changes the replication factor to
5
cluster-wide, they are going to change the.default
zone config to that effect. Any other zone configs won't receive this update and in particular the cluster won't actually be able to survive two outages because vital system ranges are only 3x replicated.These semantics are questionable and uninutitive, so we should change them: don't fill the fields that are inherited from a parent; instead, walk the chain of parents whenever an unset field's value needs to be known.
The text was updated successfully, but these errors were encountered: