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

Fix the rewrite method for MatchOnlyText field query #14154

Merged

Conversation

rishabhmaurya
Copy link
Contributor

@rishabhmaurya rishabhmaurya commented Jun 11, 2024

Description

Using indexSearcher.rewrite(delegateQuery) instead of delegateQuery.rewrite(indexSearcher); can have side effects when profile is set to true, as it can start reusing the profile objects created in parent query and can interfere with timers if they were already started. Whereas, query.rewrite(indexSearcher) it just uses the lucene APIs and doesn't use the wrapped functionality in OpenSearch.

In query phase, when rewrite is called

the ContextIndexSearch will start the timer for the query and will start noting the rewrite() time for all clauses in the clauses for the complete query tree.

But if we try to use indexSearcher.rewrite(delegateQuery) within rewrite of any of the query, it will try to initialize the profiler and timer again and will result in the assertion error here -

»  java.lang.AssertionError
»       at org.opensearch.search.profile.query.AbstractQueryProfileTree.startRewriteTime(AbstractQueryProfileTree.java:48)
»       at org.opensearch.search.profile.query.QueryProfiler.startRewriteTime(QueryProfiler.java:80)
»       at org.opensearch.search.internal.ContextIndexSearcher.rewrite(ContextIndexSearcher.java:192)
»       at org.opensearch.index.query.SourceFieldMatchQuery.rewrite(SourceFieldMatchQuery.java:76)
»       at org.apache.lucene.search.IndexSearcher.rewrite(IndexSearcher.java:777)
»       at org.opensearch.search.internal.ContextIndexSearcher.rewrite(ContextIndexSearcher.java:196)
»       at org.opensearch.search.DefaultSearchContext.preProcess(DefaultSearchContext.java:362)
»       at org.opensearch.search.query.QueryPhase.preProcess(QueryPhase.java:127)
»       at org.opensearch.search.SearchService.createContext(SearchService.java:1053)

Related Issues

Fixes #14156

Check List

  • [ ] Functionality includes testing. There are already unit and integ tests present for match_only_text field.
  • [ ] API changes companion pull request created, if applicable.
  • [ ] Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link
Contributor

❌ Gradle check result for e911b4b: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

✅ Gradle check result for f31b3b0: SUCCESS

Copy link

codecov bot commented Jun 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.67%. Comparing base (b15cb0c) to head (0fe4f72).
Report is 416 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #14154      +/-   ##
============================================
+ Coverage     71.42%   71.67%   +0.25%     
- Complexity    59978    62012    +2034     
============================================
  Files          4985     5117     +132     
  Lines        282275   291686    +9411     
  Branches      40946    42166    +1220     
============================================
+ Hits         201603   209059    +7456     
- Misses        63999    65356    +1357     
- Partials      16673    17271     +598     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

❌ Gradle check result for ffd19d0: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Signed-off-by: Rishabh Maurya <rishabhmaurya05@gmail.com>
@rishabhmaurya rishabhmaurya force-pushed the fix-rewrite-matchonlytext branch from ffd19d0 to 0fe4f72 Compare June 12, 2024 22:24
@rishabhmaurya rishabhmaurya added v2.15.0 Issues and PRs related to version 2.15.0 backport 2.x Backport to 2.x branch and removed v2.16.0 Issues and PRs related to version 2.16.0 labels Jun 12, 2024
Copy link
Contributor

❌ Gradle check result for 0fe4f72: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@rishabhmaurya
Copy link
Contributor Author

rishabhmaurya commented Jun 12, 2024

test failures are flaky tests - #13540 and #14243
@reta can we merge it with these failing flaky test?

This was referenced Jun 13, 2024
Copy link
Contributor

❌ Gradle check result for 0fe4f72: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@rishabhmaurya
Copy link
Contributor Author

hitting another flaky test - #5329

@reta
Copy link
Collaborator

reta commented Jun 13, 2024

@reta can we merge it with these failing flaky test?

No merges with failing checks please, @rishabhmaurya could you please add entry to https://github.com/opensearch-project/OpenSearch/blob/main/release-notes/opensearch.release-notes-2.15.0.md? (we could do it in separate pull request if checks are green for this one)

Copy link
Contributor

❕ Gradle check result for 0fe4f72: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

@reta reta merged commit 435af89 into opensearch-project:main Jun 13, 2024
38 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jun 13, 2024
Signed-off-by: Rishabh Maurya <rishabhmaurya05@gmail.com>
(cherry picked from commit 435af89)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@rishabhmaurya
Copy link
Contributor Author

#14251 to add this change to 2.15 release notes.

reta pushed a commit that referenced this pull request Jun 13, 2024
(cherry picked from commit 435af89)

Signed-off-by: Rishabh Maurya <rishabhmaurya05@gmail.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
harshavamsi pushed a commit to harshavamsi/OpenSearch that referenced this pull request Jul 12, 2024
…ect#14154)

Signed-off-by: Rishabh Maurya <rishabhmaurya05@gmail.com>
kkewwei pushed a commit to kkewwei/OpenSearch that referenced this pull request Jul 24, 2024
…ect#14154) (opensearch-project#14250)

(cherry picked from commit 435af89)

Signed-off-by: Rishabh Maurya <rishabhmaurya05@gmail.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Signed-off-by: kkewwei <kkewwei@163.com>
wdongyu pushed a commit to wdongyu/OpenSearch that referenced this pull request Aug 22, 2024
…ect#14154)

Signed-off-by: Rishabh Maurya <rishabhmaurya05@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch bug Something isn't working Search Search query, autocomplete ...etc skip-changelog v2.15.0 Issues and PRs related to version 2.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] asserting error when profile is set to true and phrase queries are run on match_only_text_field
3 participants