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

[Search pipelines] Pass "adhocness" flag to processor factories (#8164) #8522

Merged
merged 1 commit into from
Jul 11, 2023

Conversation

msfroh
Copy link
Collaborator

@msfroh msfroh commented Jul 7, 2023

Description

A named search pipeline may be created with a PUT request, while an "anonymous" or "ad hoc" search pipeline can be defined in the search request source. In the latter case, we don't want to create any "resource-heavy" processors, since they're potentially increasing the cost of every search request, whereas named pipeline processors get reused.

This change passes a configuration flag to a processor factory if it's being called as part of an ad hoc pipeline. The factory can use that information to avoid allocating expensive resources (maybe by throwing an exception instead).

Related Issues

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

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)

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.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 7, 2023

Gradle Check (Jenkins) Run Completed with:

…search-project#8164)

* [Search pipelines] Pass "adhocness" flag to processor factories

A named search pipeline may be created with a PUT request, while
an "anonymous" or "ad hoc" search pipeline can be defined in the
search request source. In the latter case, we don't want to create any
"resource-heavy" processors, since they're potentially increasing the
cost of every search request, whereas names pipeline processors get
reused.

This change passes a configuration flag to a processor factory if it's
being called as part of an ad hoc pipeline. The factory can use that
information to avoid allocating expensive resources (maybe by throwing
an exception instead).

Signed-off-by: Michael Froh <froh@amazon.com>

* Pass pipeline creation source as enum

Thanks to @dblock for the suggestion to pass the pipeline creation
source in a way that accounts for possible future pipeline sources (and
lets us distinguish between actual named pipeline creation and the
validation create() that executes before we write a pipeline definition
to cluster state).

Signed-off-by: Michael Froh <froh@amazon.com>

* Move PipelineSource into PipelineContext and explicitly pass to create

Signed-off-by: Michael Froh <froh@amazon.com>

* Fix formatting on merge conflict resolution

Signed-off-by: Michael Froh <froh@amazon.com>

---------

Signed-off-by: Michael Froh <froh@amazon.com>
(cherry picked from commit 431b246)
@msfroh msfroh force-pushed the backport/backport-8164-to-2.x branch from dab49cb to 80e1d53 Compare July 10, 2023 08:18
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.search.SearchWeightedRoutingIT.testStrictWeightedRoutingWithCustomString
      1 org.opensearch.indices.replication.SegmentReplicationIT.testCancellation

@codecov
Copy link

codecov bot commented Jul 10, 2023

Codecov Report

Merging #8522 (80e1d53) into 2.x (aecf435) will decrease coverage by 0.05%.
The diff coverage is 79.06%.

@@             Coverage Diff              @@
##                2.x    #8522      +/-   ##
============================================
- Coverage     70.59%   70.54%   -0.05%     
+ Complexity    57082    57052      -30     
============================================
  Files          4744     4744              
  Lines        270579   270590      +11     
  Branches      39939    39938       -1     
============================================
- Hits         191003   190901     -102     
- Misses        63139    63303     +164     
+ Partials      16437    16386      -51     
Impacted Files Coverage Δ
.../pipeline/common/RenameFieldResponseProcessor.java 94.59% <ø> (ø)
...search/pipeline/common/ScriptRequestProcessor.java 30.00% <0.00%> (-5.30%) ⬇️
...eline/common/SearchPipelineCommonModulePlugin.java 0.00% <ø> (ø)
...pensearch/search/pipeline/PipelineWithMetrics.java 90.65% <88.88%> (-0.44%) ⬇️
...h/pipeline/common/FilterQueryRequestProcessor.java 96.00% <100.00%> (+10.70%) ⬆️
...a/org/opensearch/plugins/SearchPipelinePlugin.java 80.00% <100.00%> (+80.00%) ⬆️
...java/org/opensearch/search/pipeline/Processor.java 100.00% <100.00%> (ø)
...nsearch/search/pipeline/SearchPipelineService.java 84.54% <100.00%> (ø)

... and 467 files with indirect coverage changes

@mingshl
Copy link
Contributor

mingshl commented Jul 10, 2023

This is a backporting PR for #8164. @reta @andrross @dblock @owaiskazi19 @saratvemulapalli @tlfeng requesting reviews, we are targeting at GA for search pipeline for 2.9.0

@mingshl mingshl added the v2.9.0 'Issues and PRs related to version v2.9.0' label Jul 10, 2023
@mingshl
Copy link
Contributor

mingshl commented Jul 11, 2023

Thanks @tlfeng !!

@tlfeng tlfeng merged commit a4e5cd0 into opensearch-project:2.x Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v2.9.0 'Issues and PRs related to version v2.9.0'
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants