-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[Segment Replication] Handling resource close #6795
[Segment Replication] Handling resource close #6795
Conversation
Signed-off-by: Suraj Singh <surajrider@gmail.com>
server/src/main/java/org/opensearch/indices/recovery/RecoveryTarget.java
Show resolved
Hide resolved
Gradle Check (Jenkins) Run Completed with:
|
|
Signed-off-by: Suraj Singh <surajrider@gmail.com>
Gradle Check (Jenkins) Run Completed with:
|
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #6795 +/- ##
============================================
+ Coverage 70.75% 70.77% +0.01%
+ Complexity 59230 59227 -3
============================================
Files 4810 4810
Lines 283487 283491 +4
Branches 40877 40879 +2
============================================
+ Hits 200577 200635 +58
+ Misses 66408 66350 -58
- Partials 16502 16506 +4
... and 488 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
* [Segment Replication] Fix resource close handling Signed-off-by: Suraj Singh <surajrider@gmail.com> * Fix unit tests and change exception type Signed-off-by: Suraj Singh <surajrider@gmail.com> --------- Signed-off-by: Suraj Singh <surajrider@gmail.com> (cherry picked from commit e58a33d) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* [Segment Replication] Fix resource close handling Signed-off-by: Suraj Singh <surajrider@gmail.com> * Fix unit tests and change exception type Signed-off-by: Suraj Singh <surajrider@gmail.com> --------- Signed-off-by: Suraj Singh <surajrider@gmail.com>
* [Segment Replication] Fix resource close handling * Fix unit tests and change exception type --------- (cherry picked from commit e58a33d) Signed-off-by: Suraj Singh <surajrider@gmail.com> 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>
* [Segment Replication] Fix resource close handling Signed-off-by: Suraj Singh <surajrider@gmail.com> * Fix unit tests and change exception type Signed-off-by: Suraj Singh <surajrider@gmail.com> --------- Signed-off-by: Suraj Singh <surajrider@gmail.com> Signed-off-by: Valentin Mitrofanov <mitrofmep@gmail.com>
This PR also prevents NPE by invoking safe to use instance and thus resolves #6724 |
Description
Changes
Store decRef handling. Inside finalize step, sometimes the call to fetch store reference fails due to various reasons (ReplicationTarget refCounts to 0 - segrep cancelleation, store already closed - close/delete index etc). This results in skipping the incRef() on ontained store reference. The subsequent call to decRef inside finalize block thus results in extra decRef call on store object, causing failures in store references outside of segrep (index deletion, read store etc).
Handle closed shard. When shard is already closed (delete index/close index), the call to obtain store reference fails as resources are released by event listeners. We check for event cancellation before every step on target but it is not sufficient. The propose change here is to catch such exceptions and handle them gracefully.
Obtain safe reference of IndexService while results in
IndexNotFoundException
for deleted/closed indices. This is better than null pointer exception. Will raise a separate for handling on target and not fail segment replication and thus recovery.Changes ReplicationFailedException to OpenSearchException on ReplicationTarget which closely resembles to situation when target is already decRef'ed (closed).
Issues Resolved
#6776
#6795
Check List
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.