Always prefer YES over NOT_PREFERRED when allocating unassigned shards#138464
Merged
nicktindall merged 2 commits intoelastic:mainfrom Nov 24, 2025
Merged
Always prefer YES over NOT_PREFERRED when allocating unassigned shards#138464nicktindall merged 2 commits intoelastic:mainfrom
nicktindall merged 2 commits intoelastic:mainfrom
Conversation
Collaborator
|
Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination) |
nicktindall
commented
Nov 24, 2025
| // YES over THROTTLE/NO/NOT_PREFERRED | ||
| assertAssignedTo(allocationService, "yes", shuffledList("not-preferred", "yes", "throttle", "no")); | ||
| assertAssignedTo(allocationDeciders, balancingWeightsFactory, "yes", shuffledList("not-preferred", "yes", "throttle", "no")); | ||
| assertAssignedTo(allocationDeciders, balancingWeightsFactory, "yes-high", shuffledList("not-preferred-low", "yes-high")); |
Contributor
Author
There was a problem hiding this comment.
This new case triggers the bug.
Collaborator
|
Hi @nicktindall, I've created a changelog YAML for you. |
nicktindall
commented
Nov 24, 2025
| AllocationDeciders allocationDeciders, | ||
| BalancingWeightsFactory balancingWeightsFactory, | ||
| ClusterState clusterState | ||
| ) { |
Contributor
Author
There was a problem hiding this comment.
I had to switch over to this approach (removing AllocationService from the test) so that we could randomise the debugMode
ywangd
pushed a commit
to ywangd/elasticsearch
that referenced
this pull request
Nov 24, 2025
ncordon
pushed a commit
to ncordon/elasticsearch
that referenced
this pull request
Nov 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There was a bug when explain was turned off whereby we'd take a
NOT_PREFERREDdecision over aYESdecision if it had a lower weight. This PR removes the problematic optimisation to ensureYESis always preferred regardless of the weights.