Skip to content

Conversation

@DiannaHohensee
Copy link
Contributor

@DiannaHohensee DiannaHohensee commented Oct 30, 2025

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

@DiannaHohensee DiannaHohensee self-assigned this Oct 30, 2025
@DiannaHohensee DiannaHohensee added >non-issue :Distributed Coordination/Allocation All issues relating to the decision making around placing a shard (both master logic & on the nodes) Team:Distributed Coordination Meta label for Distributed Coordination team v9.3.0 labels Oct 30, 2025
@DiannaHohensee DiannaHohensee requested a review from ywangd October 30, 2025 19:05
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination)

@DiannaHohensee
Copy link
Contributor Author

DiannaHohensee commented Oct 30, 2025

Working through adding NOT_PREFERRED to allocation explain and these refactors help me reason about it better.

Copy link
Member

@ywangd ywangd left a 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;
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed Coordination/Allocation All issues relating to the decision making around placing a shard (both master logic & on the nodes) >non-issue Team:Distributed Coordination Meta label for Distributed Coordination team v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants