Skip to content

Conversation

@DaveCTurner
Copy link
Contributor

Adds relocation targets to the output of
IndexShardRoutingTable#assignedShards.

Adds relocation targets to the output of
`IndexShardRoutingTable#assignedShards`.
@DaveCTurner DaveCTurner added >non-issue :Distributed Coordination/Allocation All issues relating to the decision making around placing a shard (both master logic & on the nodes) v8.0.0 v7.3.0 labels Jun 17, 2019
@DaveCTurner DaveCTurner requested a review from ywelsch June 17, 2019 11:49
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

Copy link
Contributor

@ywelsch ywelsch left a 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 :
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@DaveCTurner DaveCTurner requested a review from ywelsch June 17, 2019 12:44
Copy link
Contributor

@ywelsch ywelsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DaveCTurner DaveCTurner merged commit 6d0d449 into elastic:master Jun 17, 2019
@DaveCTurner DaveCTurner deleted the 2019-06-17-relocation-targets-are-assigned-shards branch June 17, 2019 16:13
DaveCTurner added a commit that referenced this pull request Jun 17, 2019
Adds relocation targets to the output of
`IndexShardRoutingTable#assignedShards`.
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Jun 18, 2019
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 v7.3.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants