-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Relocation targets are assigned shards too #43276
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
Relocation targets are assigned shards too #43276
Conversation
Adds relocation targets to the output of `IndexShardRoutingTable#assignedShards`.
|
Pinging @elastic/es-distributed |
ywelsch
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.
Thanks for the PR. I have just one small ask.
| // trim entries that have no corresponding shard routing in the cluster state (i.e. trim unavailable copies) | ||
| List<ShardRouting> assignedShards = newShardRoutingTable.assignedShards(); | ||
| assert assignedShards.size() <= maxActiveShards : | ||
| assert assignedShards.stream().filter(s -> s.isRelocationTarget() == false).count() <= maxActiveShards : |
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.
This only filters the relocation targets from the assertion here, but leaves them in for the trimming logic later. As (initializing) relocation targets are never in the in-sync set (same as for initializing replicas), this should be fine, but I find it a bit dangerous to leave the code like this. I would prefer to have the sorting further down below adapted so that we prefer to keep in-sync IDs of active shards, and then those of regular initializing shards, and then those of initializing relocation targets.
Alternatively, filter out the relocation targets again from the assignedShards list here.
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.
Ok, I added an assertion of your statement, and moved the filter, in c49e275.
ywelsch
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
Adds relocation targets to the output of `IndexShardRoutingTable#assignedShards`.
Adds relocation targets to the output of
IndexShardRoutingTable#assignedShards.