Skip to content

Revert "#17593 Add Extension Points For Pre and Post Collection of Scores in QueryPhase" - #18913

Merged
owaiskazi19 merged 1 commit into
opensearch-project:mainfrom
martin-gaievski:revert-18814-add_querytime_extensions
Aug 5, 2025
Merged

Revert "#17593 Add Extension Points For Pre and Post Collection of Scores in QueryPhase"#18913
owaiskazi19 merged 1 commit into
opensearch-project:mainfrom
martin-gaievski:revert-18814-add_querytime_extensions

Conversation

@martin-gaievski

@martin-gaievski martin-gaievski commented Aug 5, 2025

Copy link
Copy Markdown
Member

Reverts #18814.

We adopted this change in neural-search for hybrid query and found that it increases latency and drop throughput 10-15%. As there is no urgency in this feature except for request from neural-search contributors it's better to revert the change from core and do deep dive to figure out what is causes the problem.
Ref: opensearch-project/neural-search#1493

@owaiskazi19

Copy link
Copy Markdown
Member

@atris FYI

@owaiskazi19

Copy link
Copy Markdown
Member

@martin-gaievski can you sign the commit to pass DCO?

…t Collection of Scores in …"

This reverts commit eda3a48.

Signed-off-by: Martin Gaievski <gaievski@amazon.com>
@martin-gaievski
martin-gaievski force-pushed the revert-18814-add_querytime_extensions branch from 6bba140 to 7b10f60 Compare August 5, 2025 02:21
@martin-gaievski

Copy link
Copy Markdown
Member Author

@martin-gaievski can you sign the commit to pass DCO?

yes, done. btw this is what gh workflow creates, we may need to look into possible improvements for CI

@github-actions

github-actions Bot commented Aug 5, 2025

Copy link
Copy Markdown
Contributor

✅ Gradle check result for 7b10f60: SUCCESS

@codecov

codecov Bot commented Aug 5, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 45.45455% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.85%. Comparing base (220ab52) to head (7b10f60).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...n/java/org/opensearch/search/query/QueryPhase.java 45.45% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #18913      +/-   ##
============================================
+ Coverage     72.75%   72.85%   +0.10%     
- Complexity    68822    68862      +40     
============================================
  Files          5600     5599       -1     
  Lines        316247   316236      -11     
  Branches      45866    45864       -2     
============================================
+ Hits         230085   230408     +323     
+ Misses        67543    67139     -404     
- Partials      18619    18689      +70     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@owaiskazi19
owaiskazi19 merged commit c0b9879 into opensearch-project:main Aug 5, 2025
30 of 31 checks passed
atris added a commit to atris/OpenSearch that referenced this pull request Aug 8, 2025
  This commit reintroduces the QueryPhaseListener functionality that was reverted
  in opensearch-project#18913 due to performance regressions, now with optimizations that eliminate
  the overhead.

  Changes:
  - Add QueryPhaseListener interface for plugins to hook into query phase
  - Add AbstractQueryPhaseSearcher implementing template pattern for listeners
  - Modify QueryPhaseSearcher interface to support listener registration
  - Add comprehensive tests for listener functionality

  Performance optimizations:
  - Fast-path in DefaultQueryPhaseSearcher bypasses template pattern when no listeners
  - Direct hasQueryPhaseListeners() check avoids virtual method calls
  - Single listener optimization avoids iterator creation
  - Zero overhead for the common case (no listeners registered)

  The original implementation caused 10-15% regression in neural-search because it
  forced all searches through the template pattern even without listeners. This
  optimized version maintains the extension functionality while eliminating overhead
  for plugins that extend DefaultQueryPhaseSearcher without using listeners.

  Fixes opensearch-project#17593
  Resolves performance regression from opensearch-project#18913

Signed-off-by: Atri Sharma <atri.jiit@gmail.com>
atris added a commit to atris/OpenSearch that referenced this pull request Aug 8, 2025
  This commit reintroduces the QueryPhaseListener functionality that was reverted
  in opensearch-project#18913 due to performance regressions, now with optimizations that eliminate
  the overhead.

  Changes:
  - Add QueryPhaseListener interface for plugins to hook into query phase
  - Add AbstractQueryPhaseSearcher implementing template pattern for listeners
  - Modify QueryPhaseSearcher interface to support listener registration
  - Add comprehensive tests for listener functionality

  Performance optimizations:
  - Fast-path in DefaultQueryPhaseSearcher bypasses template pattern when no listeners
  - Direct hasQueryPhaseListeners() check avoids virtual method calls
  - Single listener optimization avoids iterator creation
  - Zero overhead for the common case (no listeners registered)

  The original implementation caused 10-15% regression in neural-search because it
  forced all searches through the template pattern even without listeners. This
  optimized version maintains the extension functionality while eliminating overhead
  for plugins that extend DefaultQueryPhaseSearcher without using listeners.

  Fixes opensearch-project#17593
  Resolves performance regression from opensearch-project#18913

Signed-off-by: Atri Sharma <atri.jiit@gmail.com>
atris added a commit to atris/OpenSearch that referenced this pull request Aug 8, 2025
  This commit reintroduces the QueryPhaseListener functionality that was reverted
  in opensearch-project#18913 due to performance regressions, now with optimizations that eliminate
  the overhead.

  Changes:
  - Add QueryPhaseListener interface for plugins to hook into query phase
  - Add AbstractQueryPhaseSearcher implementing template pattern for listeners
  - Modify QueryPhaseSearcher interface to support listener registration
  - Add comprehensive tests for listener functionality

  Performance optimizations:
  - Fast-path in DefaultQueryPhaseSearcher bypasses template pattern when no listeners
  - Direct hasQueryPhaseListeners() check avoids virtual method calls
  - Single listener optimization avoids iterator creation
  - Zero overhead for the common case (no listeners registered)

  The original implementation caused 10-15% regression in neural-search because it
  forced all searches through the template pattern even without listeners. This
  optimized version maintains the extension functionality while eliminating overhead
  for plugins that extend DefaultQueryPhaseSearcher without using listeners.

  Fixes opensearch-project#17593
  Resolves performance regression from opensearch-project#18913

Signed-off-by: Atri Sharma <atri.jiit@gmail.com>
vinaykpud pushed a commit to vinaykpud/OpenSearch that referenced this pull request Sep 26, 2025
…t Collection of Scores in …" (opensearch-project#18913)

This reverts commit eda3a48.

Signed-off-by: Martin Gaievski <gaievski@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants