-
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
config: enhance ZoneConfig expressiveness #4868
Comments
For diversity constraints we could use something like https://github.com/Knetic/govaluate which would let people specify arbitrary math/boolean logic strings. It would let us do things like Also would allow for even more flexible queries by passing numerical values about the state of the node. For example: It also has regular expression support |
I'm not sure how I see how general expressions would allow us to model negative constraints, but I'm not sure that generality is warranted and it feels like a big gun to be handing users. I worry that users would set up configs that would vastly limit the candidate stores leading to poor performance and/or confusing/surprising behavior. Lastly, we should pay a small bit of attention to efficient implementation. Currently, on every allocation we loop over all of the stores and generate a list of candidates and then randomly select from that list. For a given zone config, the candidate list changes slowly and it currently looks possible that we could cache it. I'm not seeing anything about general expressions that would prohibit that, but want to make sure this is something you're considering as well. |
For that specific example, you could have something like That's true. Just found that library and thought it would be a neat thing to use. Might not warrant it however. As for performance https://github.com/Knetic/govaluate#benchmarks seems to indicate that it's reasonably quick. Parsing and running are two different steps but it looks like parsing takes most of the time. |
Could also make pseudo functions with stuff like https://gist.github.com/d4l3k/53ab3e333299ed9b93f0a1c1065a18b9 |
We already have an expression language: SQL. I'm not sure how far down the path of arbitrary expressions we should go, but we should aim for a subset of SQL syntax instead of a subset of Go (so |
@d4l3k Yes, evaluation of the individual expressions is fast, but I'm pretty sure it is going to be a problem for allocation to be evaluating the zone config expression on every store for every allocation. Your example of smashing diversity constraints into general expressions isn't terribly compelling. I agree with Ben that we should make diversity constraints an explicit feature. For example, instead of a single expression we could imagine there are a series of expressions. Just brainstorming here. I haven't fully thought this through. |
I agree that it's overly cumbersome. Shorthand notation was one of the For the use case of "3 replicas with no 2 replicas on the same rack unless SQL with GROUP BY feels really odd to me, but SQL could work if we define |
I just added a WIP RFC for this. #7660 |
Converts ZoneConfig to the new format specified in the expressive ZoneConfig RFC. This is intermediate work on cockroachdb#4868. https://github.com/cockroachdb/cockroach/blob/develop/docs/RFCS/expressive_zone_config.md - Allocator and StorePool use []config.Constraint instead of roachpb.Attributes since the new type allows for different types of constraint. - Adds a `ZoneConfigLegacy` struct for upgrades to the new format. - Adds a `ZoneConfigHuman` struct for easier specification on the command line.
Converts ZoneConfig to the new format specified in the expressive ZoneConfig RFC. This is intermediate work on cockroachdb#4868. https://github.com/cockroachdb/cockroach/blob/develop/docs/RFCS/expressive_zone_config.md - Allocator and StorePool use []config.Constraint instead of roachpb.Attributes since the new type allows for different types of constraint. - Adds a `ZoneConfigLegacy` struct for upgrades to the new format. - Adds a `ZoneConfigHuman` struct for easier specification on the command line.
Converts ZoneConfig to the new format specified in the expressive ZoneConfig RFC. This is intermediate work on cockroachdb#4868. https://github.com/cockroachdb/cockroach/blob/develop/docs/RFCS/expressive_zone_config.md - Allocator and StorePool use []config.Constraint instead of roachpb.Attributes since the new type allows for different types of constraint. - Adds a `ZoneConfigLegacy` struct for upgrades to the new format. - Adds a `ZoneConfigHuman` struct for easier specification on the command line.
Converts ZoneConfig to the new format specified in the expressive ZoneConfig RFC. This is intermediate work on cockroachdb#4868. https://github.com/cockroachdb/cockroach/blob/develop/docs/RFCS/expressive_zone_config.md - Allocator and StorePool use []config.Constraint instead of roachpb.Attributes since the new type allows for different types of constraint. - Adds a `ZoneConfigLegacy` struct for upgrades to the new format. - Adds a `ZoneConfigHuman` struct for easier specification on the command line.
Converts ZoneConfig to the new format specified in the expressive ZoneConfig RFC. This is intermediate work on cockroachdb#4868. https://github.com/cockroachdb/cockroach/blob/develop/docs/RFCS/expressive_zone_config.md - Allocator and StorePool use []config.Constraint instead of roachpb.Attributes since the new type allows for different types of constraint. - Adds a `ZoneConfigLegacy` struct for upgrades to the new format. - Adds a `ZoneConfigHuman` struct for easier specification on the command line.
Converts ZoneConfig to the new format specified in the expressive ZoneConfig RFC. This is intermediate work on cockroachdb#4868. https://github.com/cockroachdb/cockroach/blob/develop/docs/RFCS/expressive_zone_config.md - Allocator and StorePool use []config.Constraint instead of roachpb.Attributes since the new type allows for different types of constraint. - Adds a `ZoneConfigLegacy` struct for upgrades to the new format. - Adds a `ZoneConfigHuman` struct for easier specification on the command line.
Closed by #12165. |
From a comment on #4866:
The text was updated successfully, but these errors were encountered: