-
Notifications
You must be signed in to change notification settings - Fork 46
Add option to warm lucene core query only #838
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
Closed
fragosoluana
wants to merge
7
commits into
profiling
from
luanafragoso_stripped_warming_queries_lucene_query
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ec789ef
partial update POC with v0.x as base branch
RavirajDataEngineering ca2b598
skipping some partial fields
RavirajDataEngineering cdba000
fix a typo
RavirajDataEngineering 8087899
registering metrics
RavirajDataEngineering c0bf1f4
correcting the metric when addDocuments call is used
RavirajDataEngineering 780f3cf
spotless apply formatting changes
RavirajDataEngineering b58a249
Add option to warm lucene core query only
fragosoluana File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -323,6 +323,47 @@ public SearchResponse handle(IndexState indexState, SearchRequest searchRequest) | |
return searchResponse; | ||
} | ||
|
||
public void handleStrippedWarmingQuery(IndexState indexState, SearchRequest searchRequest) { | ||
SearchContext searchContext; | ||
SearcherTaxonomyManager.SearcherAndTaxonomy s = null; | ||
ShardState shardState = indexState.getShard(0); | ||
|
||
try { | ||
s = getSearcherAndTaxonomy( | ||
searchRequest, | ||
indexState, | ||
shardState, | ||
SearchResponse.Diagnostics.newBuilder(), | ||
indexState.getSearchThreadPoolExecutor()); | ||
|
||
searchContext = | ||
SearchRequestProcessor.buildContextForLuceneQueryOnly( | ||
searchRequest, indexState, shardState, s); | ||
|
||
s.searcher.search(searchContext.getQuery(), searchContext.getCollector().getWrappedManager()); | ||
} catch (InterruptedException | IOException e) { | ||
logger.warn(e.getMessage(), e); | ||
throw new RuntimeException(e); | ||
} finally { | ||
// NOTE: this is a little iffy, because we may not | ||
// have obtained this searcher from the NRTManager | ||
// (i.e. sometimes we pulled from | ||
// SearcherLifetimeManager, other times (if | ||
// snapshot was specified) we opened ourselves, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We may not want to warm the query with specific generation, i.e. snapshot. But this is likely a fix in saving criteria. |
||
// but under-the-hood all these methods just call | ||
// s.getIndexReader().decRef(), which is what release | ||
// does: | ||
try { | ||
if (s != null) { | ||
shardState.release(s); | ||
} | ||
} catch (IOException e) { | ||
logger.warn("Failed to release searcher reference previously acquired by acquire()", e); | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Fetch/compute field values for the top hits. This operation may be done in parallel, based on | ||
* the setting for the fetch thread pool. In addition to filling hit fields, any query {@link | ||
|
Oops, something went wrong.
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 problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can still use the % settings in your final PR if you prefer