Skip to content

Fix ingest pipeline cannot be executed when retry the failed index requests for update_by_query and reindex #18003

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

Merged
merged 6 commits into from
Apr 23, 2025

Conversation

gaobinlong
Copy link
Contributor

@gaobinlong gaobinlong commented Apr 18, 2025

Description

This PR fixes the bug that ingest pipeline cannot be executed again when retrying the failed index requests for update_by_query and reindex, update_by_query and reindex are kind of AbstractAsyncBulkByScrollAction, they have retry logic when the index requests failed with 429 status code, but when build a new bulk request for retry, it doesn't honor the global pipeline specified the api request and the isPipelineResolved field was set to true in all of the failed indexRequests, so the pipeline won't be executed again when retrying the bulk request.

In addition, we need to find a way to mark the failure step if the BulkItemResponse, only if the ingest pipeline failed with 429 status code, then the isPipelineResolved field need to be reset, so I add a source field to the Failure class to mark which step has failure during the bulk processing, for other cases like the index has a read_only_allow_delete block which is also retryable, we shouldn't reset the isPipelineResolved field.

Some unit test are added for the code change, but failed to add some yaml tests or IT because pipeline execution failure with 429 status code is not easy to mock.

Related Issues

Resolves #14337.

Check List

  • Functionality includes testing.
  • 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.

…quests for update_by_query API and reindex API

Signed-off-by: Binlong Gao <[email protected]>
Signed-off-by: Binlong Gao <[email protected]>
Copy link
Contributor

❌ Gradle check result for 949410a: 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 38f6bb5: 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.

Copy link

codecov bot commented Apr 19, 2025

Codecov Report

Attention: Patch coverage is 86.36364% with 6 lines in your changes missing coverage. Please review.

Project coverage is 72.61%. Comparing base (54e02a7) to head (0e4401a).
Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
...a/org/opensearch/action/bulk/BulkItemResponse.java 82.75% 4 Missing and 1 partial ⚠️
...rc/main/java/org/opensearch/action/bulk/Retry.java 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #18003      +/-   ##
============================================
+ Coverage     72.47%   72.61%   +0.14%     
- Complexity    67034    67165     +131     
============================================
  Files          5478     5478              
  Lines        310132   310168      +36     
  Branches      45087    45091       +4     
============================================
+ Hits         224775   225238     +463     
+ Misses        66960    66516     -444     
- Partials      18397    18414      +17     

☔ 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.

Copy link
Member

@owaiskazi19 owaiskazi19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good with few minor comments

Copy link
Member

@martin-gaievski martin-gaievski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you

Signed-off-by: Binlong Gao <[email protected]>
Signed-off-by: Binlong Gao <[email protected]>
Copy link
Contributor

❌ Gradle check result for 7fa102c: 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: Binlong Gao <[email protected]>
Copy link
Contributor

❌ Gradle check result for 0e4401a: 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 0e4401a: 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 0e4401a: SUCCESS

@owaiskazi19
Copy link
Member

@andrross can you also take a look here?

@owaiskazi19 owaiskazi19 merged commit 9a3fc30 into opensearch-project:main Apr 23, 2025
32 of 34 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Apr 24, 2025
…quests for update_by_query and reindex (#18003)

* Fix ingest pipeline cannot be executed when retry the failed index requests for update_by_query API and reindex API

Signed-off-by: Binlong Gao <[email protected]>

* Modify changelog

Signed-off-by: Binlong Gao <[email protected]>

* Optimize some code

Signed-off-by: Binlong Gao <[email protected]>

* Fix precommit failure

Signed-off-by: Binlong Gao <[email protected]>

---------

Signed-off-by: Binlong Gao <[email protected]>
(cherry picked from commit 9a3fc30)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
andrross pushed a commit that referenced this pull request Apr 24, 2025
…quests for update_by_query and reindex (#18003) (#18074)

* Fix ingest pipeline cannot be executed when retry the failed index requests for update_by_query API and reindex API



* Modify changelog



* Optimize some code



* Fix precommit failure



---------


(cherry picked from commit 9a3fc30)

Signed-off-by: Binlong Gao <[email protected]>
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 3.0 bug Something isn't working Indexing Indexing, Bulk Indexing and anything related to indexing ingest-pipeline
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Update_by_query call updates document even if ingest pipeline processor has failed with exception
4 participants