Skip to content
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

Adds a consistent shard index to ShardSearchRequest #65706

Merged
merged 4 commits into from
Dec 7, 2020

Conversation

jimczi
Copy link
Contributor

@jimczi jimczi commented Dec 1, 2020

This change ensures that the shard index that is used to tiebreak documents with identical sort
remains consistent between two requests that target the same shards. The index is now always computed from the
natural order of the shards in the search request.
This change also adds the consistent shard index to the ShardSearchRequest. That allows the slice builder
to use this information to build more balanced slice query.

Relates #56828

This change ensures that the shard index that is used to tiebreak documents with identical sort
remains consistent between two requests that target the same shards. The index is now always computed from the
natural order of the shards in the search request.
This change also adds the consistent shard index to the ShardSearchRequest. That allows the slice builder
to use this information to build more balanced slice query.

Relates elastic#56828
@jimczi jimczi added >enhancement :Search/Search Search-related issues that do not fall into other categories v8.0.0 v7.11.0 labels Dec 1, 2020
@elasticmachine elasticmachine added the Team:Search Meta label for search team label Dec 1, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

Copy link
Contributor

@mayya-sharipova mayya-sharipova left a comment

Choose a reason for hiding this comment

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

@jimczi Thanks Jim, this LGTM. Nice to get rid of irrelevant indexRoutings and preference fields in ShardSearchRequest.

}
}

int shardIndex = request.shardIndex() != -1 ? request.shardIndex() : request.shardId().id();
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess a case when shardIdex() = -1 (when a coordinating node is v < 8.0) and there is a preference or indexRouting present in scroll slice is a very rare case, and we can disregard it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's my reasoning too.

@jimczi jimczi merged commit 9eb9f92 into elastic:master Dec 7, 2020
@jimczi jimczi deleted the shard_index_consistency branch December 7, 2020 08:16
jimczi added a commit that referenced this pull request Dec 7, 2020
This commit adapts the version check for #65706 in preparation of the backport in #65927.
The bwc tests are also disabled to not fail the build before #65927 gets merged.
jimczi added a commit that referenced this pull request Dec 7, 2020
This change ensures that the shard index that is used to tiebreak documents with identical sort
remains consistent between two requests that target the same shards. The index is now always computed from the
natural order of the shards in the search request.
This change also adds the consistent shard index to the ShardSearchRequest. That allows the slice builder
to use this information to build more balanced slice query.

Relates #56828
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team v7.11.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants