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

[BUG] Unused fetch sub phase processors initialized during fetch phase #12502

Closed
jainankitk opened this issue Mar 1, 2024 · 2 comments · Fixed by #12503 or #12654
Closed

[BUG] Unused fetch sub phase processors initialized during fetch phase #12502

jainankitk opened this issue Mar 1, 2024 · 2 comments · Fixed by #12503 or #12654
Assignees
Labels
bug Something isn't working Search:Performance v2.13.0 Issues and PRs related to version 2.13.0 v3.0.0 Issues and PRs related to version 3.0.0

Comments

@jainankitk
Copy link
Collaborator

Describe the bug

Opensearch initializes sub processors even if are not getting used during the fetch phase. Can be prevented by validating if size of fields is greater than zero in addition to it being non-null. Take below snippet from InnerHitsPhase class:

public FetchSubPhaseProcessor getProcessor(FetchContext searchContext) {
        if (searchContext.innerHits() == null) {
            return null;
        }

This should not get initialized if the innerHits count is 0

Related component

Search:Performance

To Reproduce

  1. Add data http_logs into Opensearch
  2. Run below query:
curl -XGET "http://localhost:9200/logs-241998/_search?pretty" -H 'Content-Type: application/json' -d'
{"size": 1000,
  "query": {
    "match_all": {}
  },"docvalue_fields":["clientip"],
 "sort": [{"size":"asc"}]
}'
  1. Attach debugger to above code reference

Expected behavior

Unnecessary initialization of fetch sub phase processor should be skipped

Additional Details

No response

@andrross
Copy link
Member

andrross commented Mar 5, 2024

@jainankitk This is an enhancement not a bug, right? There's no correctness issue here right?

@jainankitk
Copy link
Collaborator Author

@jainankitk This is an enhancement not a bug, right? There's no correctness issue here right?

I would say it is both bug and enhancement. Bug - because it was not intended to be so. Although, there should not be any perceived difference from customer experience perspective. So, should be okay to label it as enhancement

@reta reta added v3.0.0 Issues and PRs related to version 3.0.0 v2.13.0 Issues and PRs related to version 2.13.0 labels Mar 11, 2024
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in Search Project Board Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Search:Performance v2.13.0 Issues and PRs related to version 2.13.0 v3.0.0 Issues and PRs related to version 3.0.0
Projects
Status: Done
Status: No status
3 participants