-
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
storage: Fix allocator diversity score calculations #17570
Conversation
I think we should make bad diversity a reason to rebalance early in the 1.2 cycle. Review status: 0 of 2 files reviewed at latest revision, all discussions resolved, all commit checks successful. Comments from Reviewable |
Yeah, there's already plenty of change in this release and it's quite late, so I'm fine waiting. The main counterargument, though, is that it's not clear it'll really get much extra testing in the next release cycle given that we don't have many folks running alpha versions with localities enabled. |
Perhaps write this in a way that is less sensitive to time of reading. How long was it running? I don't even know when this commit was written. Reviewed 1 of 1 files at r1, 1 of 1 files at r2, 2 of 2 files at r3. pkg/storage/allocator_scorer.go, line 680 at r3 (raw file):
where does pkg/storage/allocator_scorer_test.go, line 598 at r3 (raw file):
singular? Comments from Reviewable |
Good point, done. Review status: all files reviewed at latest revision, 2 unresolved discussions, all commit checks successful. pkg/storage/allocator_scorer.go, line 680 at r3 (raw file): Previously, tamird (Tamir Duberstein) wrote…
Yeah, it's the max score returned by pkg/storage/allocator_scorer_test.go, line 598 at r3 (raw file): Previously, tamird (Tamir Duberstein) wrote…
Done. Comments from Reviewable |
Reviewed 2 of 2 files at r4, 3 of 3 files at r5. pkg/storage/allocator_scorer.go, line 680 at r3 (raw file): Previously, a-robinson (Alex Robinson) wrote…
Nice, thanks. Comments from Reviewable |
I've removed the second commit (the one with the tiny scoring change) since it's included in / superceded by #17593 |
Great job locating some weirdness in the scores. What about the situation where we have [a,a,b,c]. Would this allow movement of either a to another a, or a b or a c? On a side note, when we have a larger set of replica than the available top level localities, should we also try for the most diverse scores in a second round? So if you have 3 localities, a, b, c, and we have 6 replicas, than we should try to double up in each locality. That's a bit easier if there's a second locality tier, but should happen regardless. Reviewed 1 of 1 files at r1, 1 of 1 files at r2, 3 of 3 files at r6, 2 of 3 files at r7. Comments from Reviewable |
Oh, forgot to mention, LGTM. I'm starting to wonder if we might need specialized diversity scoring based not just on what operation is being performed (add/remove/rebalance) but also one for if the replica count is greater, equal or less than the locality count. But this change is a clear improvement over the status quo. Reviewed 1 of 3 files at r7. Comments from Reviewable |
It differs slightly depending on the situation:
I wouldn't say it's super urgent, but yeah, that'd certainly be nice. Review status: all files reviewed at latest revision, all discussions resolved, all commit checks successful. Comments from Reviewable |
Yeah, I think we may to handle the case mentioned in my above response. Review status: all files reviewed at latest revision, all discussions resolved, all commit checks successful. Comments from Reviewable |
Fixes both problems specified in cockroachdb#17479, which were: 1. "When considering a rebalance, we use one diversity score method for existing replicas and a different one for other replicas. We consider an existing replica to have good diversity if we can remove it and the range will still be diverse, but we only consider a new replica diverse if it doesn't overlap with any existing replica's locality. That means that we never choose to rebalance from one node in a locality to another node in the same locality." 2. "diversityRemovalScore doesn't seem to do what we want. It returns the max diversity of any remaining pair of replicas in a range. That means that if a range has 6 replicas (say it's down-replicating from 6 to 5) in localities [a, b, c, c, c, c] respectively, it'll consider all replicas to be equally valid for removal because no matter which one is removed, there will still be a pair of replicas with no locality tiers in common. To a human, this seems like an obviously bad choice. We may want to do something like average locality remaining after removing a replica to ensure that in cases like this we'd pick one of the replicas in locality c to remove."
Well, if we go with 5, which is going to be a common case,
Review status: 2 of 3 files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
Plus a couple other small changes.
This still leaves open the question (in my mind, at least) of whether bad data diversity should be included in the conditions for
shouldRebalance
. Right now, we don't consider bad diversity a reason to rebalance a range even though a human would probably consider something like all of a range's replicas being in the same locality a pretty great reason to rebalance. What do you think? In a clean-slate implementation I'd definitely say yes, but I'm not sure about changing it at this point in the release cycle.