OpenSearch icon indicating copy to clipboard operation
OpenSearch copied to clipboard

Optimize the canMatch phase on the data node

Open bugmakerrrrrr opened this issue 1 year ago • 4 comments

Description

Two changes here:

  1. short circuit can match check, respond with CanMatchResponse(false, null) if cannot match(minMax value is useless if corresponding shard is not match);
  2. only primary searchAfter field will be evaluated if exists.

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • [x] Functionality includes testing.
  • [x] API changes companion pull request created, if applicable.
  • [x] 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.

bugmakerrrrrr avatar Jun 23 '24 08:06 bugmakerrrrrr

:white_check_mark: Gradle check result for ada899d32e736538afad67be5287bb9e7dc3a46d: SUCCESS

github-actions[bot] avatar Jun 23 '24 09:06 github-actions[bot]

Codecov Report

Attention: Patch coverage is 60.60606% with 13 lines in your changes missing coverage. Please review.

Project coverage is 71.72%. Comparing base (49b7cd4) to head (8c91a12). Report is 199 commits behind head on main.

Files with missing lines Patch % Lines
...main/java/org/opensearch/search/SearchService.java 75.00% 0 Missing and 6 partials :warning:
...ensearch/search/internal/ContextIndexSearcher.java 0.00% 4 Missing and 1 partial :warning:
...nsearch/search/searchafter/SearchAfterBuilder.java 33.33% 1 Missing and 1 partial :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #14511      +/-   ##
============================================
- Coverage     71.84%   71.72%   -0.12%     
+ Complexity    62820    62720     -100     
============================================
  Files          5169     5169              
  Lines        294664   294672       +8     
  Branches      42615    42621       +6     
============================================
- Hits         211691   211344     -347     
- Misses        65530    65898     +368     
+ Partials      17443    17430      -13     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jun 23 '24 09:06 codecov[bot]

Is there any way to quantify the impact of this change? Also, are the existing tests sufficient to catch any regressions?

No, this optimization is just for reducing unnecessary computation or IO. Currently, I am unable to accurately measure the impact of this change.

If not, can we add test cases for the missing code paths?

Sure.

bugmakerrrrrr avatar Jun 29 '24 15:06 bugmakerrrrrr

:x: Gradle check result for 51866646f1e80e0ac90d08a3bf93619430128548: 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?

github-actions[bot] avatar Jun 29 '24 17:06 github-actions[bot]

@jainankitk friendly ping

bugmakerrrrrr avatar Jul 10 '24 15:07 bugmakerrrrrr

@bugmakerrrrrr - While the changes look okay, I am still unsure about the impact and need of this code change. Even if not using some benchmark, having some idea of potential improvement with this change will be good!

jainankitk avatar Jul 16 '24 19:07 jainankitk

Also can you add entry in CHANGELOG.md, before this change can be reviewed by maintainer and merged!

jainankitk avatar Aug 05 '24 16:08 jainankitk

:white_check_mark: Gradle check result for 8c91a1274f52e136e9008d978dade031615cf5ad: SUCCESS

github-actions[bot] avatar Aug 06 '24 13:08 github-actions[bot]

@bugmakerrrrrr - Can you resolve the failing CHANGELOG verifier and codecov check while one of the maintainer reviews this PR?

jainankitk avatar Aug 07 '24 20:08 jainankitk

This PR is stalled because it has been open for 30 days with no activity.