-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Refactor some allocation explain / move decision code #137400
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
Refactor some allocation explain / move decision code #137400
Conversation
|
Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination) |
|
Working through adding NOT_PREFERRED to allocation explain and these refactors help me reason about it better. |
ywangd
left a comment
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.
LGTM
| */ | ||
| public boolean cannotRemain() { | ||
| checkDecisionState(); | ||
| return canRemainDecision.type() != Type.YES; |
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.
Can we either assert the boolean result here is the opposite to canRemain() or delegate it to canRemain(), i.e. return canRemain() == false? It would be nice to prevent these methods to go out of sync for any reason.
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.
I hesitate because they may not always be opposites: NOT_PREFERRED makes the ideas muddier. But that's a future 'if". I'll go ahead with canRemain() == false since that's how it works now 👍
Add `MoveDecision#cannotRemain()` to replace the numerous `canRemain() == false` checks Rename `Balancer#decideRebalance()` to `Balancer#explainRebalanceDecision()` Rename a `Decision canRemain` variable to `Decision canRemainDecision` so it doesn't sound like a boolean Relates ES-12833
Add
MoveDecision#cannotRemain()to replacethe numerous
canRemain() == falsechecksRename
Balancer#decideRebalance()toBalancer#explainRebalanceDecision()Rename a
Decision canRemainvariable toDecision canRemainDecisionso it doesn'tsound like a boolean
Relates ES-12833