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

Avoid I/O operations when rewriting shard search request #54044

Merged
merged 4 commits into from
Mar 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1184,12 +1184,12 @@ public void failShard(String reason, @Nullable Exception e) {
}

/**
* Acquire the searcher without applying the additional reader wrapper.
* Acquire a lightweight searcher which can be used to rewrite shard search requests.
*/
public Engine.Searcher acquireSearcherNoWrap(String source) {
public Engine.Searcher acquireCanMatchSearcher() {
readAllowed();
markSearcherAccessed();
return getEngine().acquireSearcher(source, Engine.SearcherScope.EXTERNAL);
return getEngine().acquireSearcher("can_match", Engine.SearcherScope.EXTERNAL);
}

public Engine.Searcher acquireSearcher(String source) {
Expand All @@ -1208,10 +1208,7 @@ private Engine.Searcher acquireSearcher(String source, Engine.SearcherScope scop
return wrapSearcher(searcher);
}

/**
* Wraps the provided searcher acquired with {@link #acquireSearcherNoWrap(String)}.
*/
public Engine.Searcher wrapSearcher(Engine.Searcher searcher) {
private Engine.Searcher wrapSearcher(Engine.Searcher searcher) {
assert ElasticsearchDirectoryReader.unwrap(searcher.getDirectoryReader())
!= null : "DirectoryReader must be an instance or ElasticsearchDirectoryReader";
boolean success = false;
Expand Down
Loading