-
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
asim: enable random zone config event generation #110967
Conversation
Thank you for contributing to CockroachDB. Please ensure you have followed the guidelines for creating a PR. Before a member of our team reviews your PR, I have some potential action items for you:
I was unable to automatically find a reviewer. You can try CCing one of the following members:
🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
Thank you for updating your pull request. Before a member of our team reviews your PR, I have some potential action items for you:
I was unable to automatically find a reviewer. You can try CCing one of the following members:
🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
Thank you for updating your pull request. Before a member of our team reviews your PR, I have some potential action items for you:
I was unable to automatically find a reviewer. You can try CCing one of the following members:
🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
Thank you for updating your pull request. Before a member of our team reviews your PR, I have some potential action items for you:
I was unable to automatically find a reviewer. You can try CCing one of the following members:
🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
Thank you for updating your pull request. Before a member of our team reviews your PR, I have some potential action items for you:
🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
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 9 of 9 files at r3, 7 of 7 files at r4, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @wenyihu6)
pkg/kv/kvserver/asim/tests/rand_gen.go
line 344 at r1 (raw file):
Previously, wenyihu6 (Wenyi Hu) wrote…
Is this better?
Yup, just a minor nit: "... two hardcoded zone configurations." plural.
pkg/sql/region_util.go
line 132 at r1 (raw file):
Previously, wenyihu6 (Wenyi Hu) wrote…
I couldn't think of an easy way to do this since
zoneConfigForMultiRegionDatabase
andDefaultZoneConfig
both creates a new struct. I could think of these options: 1. Create a method to combine two structs 2. Create an extension method similar to zoneConfigForMultiRegionDatabase that would extend from DefaultZoneConfig rather than creating a new one 3. Create a new method that takes in a ZoneConfig and returns the hydrated version of it after filling in the required fields. Option 3 seems most suitable. But if making a zone config hydrated is only useful here, the current approach seems fine
Perhaps a middle ground between 1 (combining the structs), and the current approach could work:
zc, err := zoneConfigForMultiRegionDatabase(regionConfig)
defaultZoneConfig := zonepb.DefaultZoneConfig()
zc.RangeMinBytes = defaultZoneConfig.RangeMinBytes
zc.RangeMaxBytes = defaultZoneConfig.RangeMaxBytes
zc.GC = defaultZoneConfig.GC
zc.NullVoterConstraintsIsEmpty = true
return zc, err
My concern is with too many magic numbers floating around makes it harder for others quickly dropping by this code to find the "source of truth", and by extension easier to introduce related bugs in the future.
pkg/kv/kvserver/asim/tests/testdata/rand/rand_event
line 88 at r1 (raw file):
Previously, wenyihu6 (Wenyi Hu) wrote…
Yup
Nice, thanks for clarifying.
pkg/kv/kvserver/asim/tests/testdata/rand/rand_event
line 134 at r1 (raw file):
Previously, wenyihu6 (Wenyi Hu) wrote…
These lines are because failed assertions output include an extra empty line (in PrintSpanConfigConformanceList). And empty lines emits "----" in datadriven. I opened up a separate PR to get rid of this. #111204
Nice, thanks!
Thank you for updating your pull request. Before a member of our team reviews your PR, I have some potential action items for you:
🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
Previously, kvoli (Austen) wrote…
I see. That is much neater. Done. |
Thank you for updating your pull request. Before a member of our team reviews your PR, I have some potential action items for you:
🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
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 7 of 7 files at r5, 7 of 7 files at r6, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @wenyihu6)
Previously, zone config event generation used hardcoded span configurations. This limits our ability to test the allocator more thoroughly. To improve this, this patch enables random span configs to be generated and applied as part of the simulation. These configurations are generated by randomly selecting the primary region, region V.S. zone survival goal, and leaseholder preference. ``` The following command is now supported: "rand_events" [cycle_via_random_survival_goals] ``` Part of: cockroachdb#106192 Release Note: none Epic: none
Rebased on master to pickup #111204. |
bors r=kvoli |
Build succeeded: |
Thanks for the review and helping me merge it ❤️ |
Now that we have added the option to generate random span configurations in cockroachdb#110967, we want to have a way to check whether these configurations are satisfiable with the cluster setting. This patch adds the validation check. Please note that the validation process can be expensive with a time complexity of O(max(node count in the cluster, number of replica constraints, number of voter constraints)). To perform this validation and see which span config could lead to failure, please use following command: ``` "eval" [verbose=validate] ``` See also: cockroachdb#110967 Part of: cockroachdb#106192 Release Note: none Epic: none
Now that we have added the option to generate random span configurations in cockroachdb#110967, we want to have a way to check whether these configurations are satisfiable with the cluster setting. This patch adds the validation check. Please note that the validation process can be expensive with a time complexity of O(max(node count in the cluster, number of replica constraints, number of voter constraints)). To perform this validation and see which span config could lead to failure, please use following command: ``` "eval" [verbose=validate] ``` See also: cockroachdb#110967 Part of: cockroachdb#106192 Release Note: none Epic: none
Now that we have added the option to generate random span configurations in cockroachdb#110967, we want to have a way to check whether these configurations are satisfiable with the cluster setting. This patch adds the validation check. Please note that the validation process can be expensive with a time complexity of O(max(node count in the cluster, number of replica constraints, number of voter constraints)). To perform this validation and see which span config could lead to failure, please use following command: ``` "eval" [verbose=validate] ``` See also: cockroachdb#110967 Part of: cockroachdb#106192 Release Note: none Epic: none
Now that we have added the option to generate random span configurations in cockroachdb#110967, we want to have a way to check whether these configurations are satisfiable with the cluster setting. This patch adds the validation check. Please note that the validation process can be expensive with a time complexity of O(max(node count in the cluster, number of replica constraints, number of voter constraints)). To perform this validation and see which span config could lead to failure, please use following command: ``` "eval" [verbose=validate] ``` See also: cockroachdb#110967 Part of: cockroachdb#106192 Release Note: none Epic: none
Now that we have added the option to generate random span configurations in cockroachdb#110967, we want to have a way to check whether these configurations are satisfiable with the cluster setting. This patch adds the validation check. Please note that the validation process can be expensive with a time complexity of O(max(node count in the cluster, number of replica constraints, number of voter constraints)). To perform this validation and see which span config could lead to failure, please use following command: ``` "eval" [verbose=validate] ``` See also: cockroachdb#110967 Part of: cockroachdb#106192 Release Note: none Epic: none
Now that we have added the option to generate random span configurations in cockroachdb#110967, we want to have a way to check whether these configurations are satisfiable with the cluster setting. This patch adds the validation check. Please note that the validation process can be expensive with a time complexity of O(max(node count in the cluster, number of replica constraints, number of voter constraints)). To perform this validation and see which span config could lead to failure, please use following command: ``` "eval" [verbose=validate] ``` See also: cockroachdb#110967 Part of: cockroachdb#106192 Release Note: none Epic: none
Now that we have added the option to generate random span configurations in cockroachdb#110967, we want to have a way to check whether these configurations are satisfiable with the cluster setting. This patch adds the validation check. Please note that the validation process can be expensive with a time complexity of O(max(node count in the cluster, number of replica constraints, number of voter constraints)). To perform this validation and see which span config could lead to failure, please use following command: ``` "eval" [verbose=validate] ``` See also: cockroachdb#110967 Part of: cockroachdb#106192 Release Note: none Epic: none
Previously, zone config event generation used hardcoded span configurations.
This limits our ability to test the allocator more thoroughly.
To improve this, this patch enables random span configs to be generated and
applied as part of the simulation. These configurations are generated by
randomly selecting the primary region, region V.S. zone survival goal, and
leaseholder preference.
Part of: #106192
Release Note: none
Epic: none