Use CloseableRetryableRefreshListener to drain ongoing after refresh tasks on relocation#8683
Merged
sachinpkale merged 7 commits intoopensearch-project:mainfrom Jul 18, 2023
Merged
Conversation
Contributor
Gradle Check (Jenkins) Run Completed with:
|
Contributor
Gradle Check (Jenkins) Run Completed with:
|
…tasks on relocation Signed-off-by: Ashish Singh <ssashish@amazon.com>
Signed-off-by: Ashish Singh <ssashish@amazon.com>
Contributor
Gradle Check (Jenkins) Run Completed with:
|
Codecov Report
@@ Coverage Diff @@
## main #8683 +/- ##
============================================
+ Coverage 70.87% 70.95% +0.07%
- Complexity 57201 57252 +51
============================================
Files 4771 4772 +1
Lines 270312 270352 +40
Branches 39505 39513 +8
============================================
+ Hits 191590 191823 +233
+ Misses 62619 62414 -205
- Partials 16103 16115 +12
|
Bukhtawar
reviewed
Jul 14, 2023
server/src/main/java/org/opensearch/index/shard/CloseableRetryableRefreshListener.java
Show resolved
Hide resolved
Bukhtawar
reviewed
Jul 14, 2023
Contributor
Bukhtawar
left a comment
There was a problem hiding this comment.
Where are we closing the listeners?
Contributor
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Ashish Singh <ssashish@amazon.com>
Member
Author
Have added it now. |
Contributor
Gradle Check (Jenkins) Run Completed with:
|
sachinpkale
reviewed
Jul 14, 2023
server/src/main/java/org/opensearch/index/shard/CloseableRetryableRefreshListener.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/index/shard/CloseableRetryableRefreshListener.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/index/shard/CloseableRetryableRefreshListener.java
Show resolved
Hide resolved
Signed-off-by: Ashish Singh <ssashish@amazon.com>
Contributor
Gradle Check (Jenkins) Run Completed with:
|
sachinpkale
reviewed
Jul 17, 2023
server/src/main/java/org/opensearch/index/shard/CloseableRetryableRefreshListener.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/index/shard/RemoteStoreRefreshListener.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Ashish Singh <ssashish@amazon.com>
Contributor
Gradle Check (Jenkins) Run Completed with:
|
sachinpkale
approved these changes
Jul 17, 2023
server/src/main/java/org/opensearch/index/shard/CheckpointRefreshListener.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Ashish Singh <ssashish@amazon.com>
Contributor
Gradle Check (Jenkins) Run Completed with:
|
sachinpkale
reviewed
Jul 18, 2023
server/src/main/java/org/opensearch/index/shard/CloseableRetryableRefreshListener.java
Show resolved
Hide resolved
Contributor
|
The backport to To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-8683-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 2ba1157947c84418234386ad5671719a99f4b889
# Push it to GitHub
git push --set-upstream origin backport/backport-8683-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-2.xThen, create a pull request where the |
ashking94
added a commit
to ashking94/OpenSearch
that referenced
this pull request
Jul 19, 2023
…tasks on relocation (opensearch-project#8683) * Use CloesableRetryableRefreshListener to drain ongoing after refresh tasks on relocation --------- Signed-off-by: Ashish Singh <ssashish@amazon.com>
6 tasks
baba-devv
pushed a commit
to baba-devv/OpenSearch
that referenced
this pull request
Jul 29, 2023
…tasks on relocation (opensearch-project#8683) * Use CloesableRetryableRefreshListener to drain ongoing after refresh tasks on relocation --------- Signed-off-by: Ashish Singh <ssashish@amazon.com>
kaushalmahi12
pushed a commit
to kaushalmahi12/OpenSearch
that referenced
this pull request
Sep 12, 2023
…tasks on relocation (opensearch-project#8683) * Use CloesableRetryableRefreshListener to drain ongoing after refresh tasks on relocation --------- Signed-off-by: Ashish Singh <ssashish@amazon.com> Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
6 tasks
shiv0408
pushed a commit
to Gaurav614/OpenSearch
that referenced
this pull request
Apr 25, 2024
…tasks on relocation (opensearch-project#8683) * Use CloesableRetryableRefreshListener to drain ongoing after refresh tasks on relocation --------- Signed-off-by: Ashish Singh <ssashish@amazon.com> Signed-off-by: Shivansh Arora <hishiv@amazon.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
RefreshListeners are async in nature and are triggered after segments are refreshed. Today, during relocation handoff, it is possible that the remote segments upload are happening from the older primary while the relocation has happened. Now, we are introducing a
CloseableRetryableRefreshListenerwhich will be extended byRemoteStoreRefreshListenerandCheckpointRefreshListener. TheCloseableRetryableRefreshListenerhas capabilities to be closed which guarantees that refreshes would not trigger any after refresh operations on these listeners once closed.In summary, the PR does the following -
CloseableRetryableRefreshListenerwhich has capabilities to be closed. It achieves the same by acquiring all available permits during close and leading to no further invocation ofvoid afterRefresh(boolean didRefresh)method.CloseableRetryableRefreshListenerinvokes theperformAfterRefresh(boolean didRefresh, boolean isRetry)synchronously on the same calling thread. TheperformAfterRefreshmethod returns true if the invocation was successful and otherwise false.CloseableRetryableRefreshListenerprovides capabilities to schedule retry if the originalperformAfterRefreshreturns false. It would retry the sameperformAfterRefreshafter an interval returned by the implementor of theCloseableRetryableRefreshListenerabstract class.CloseableRetryableRefreshListeneralso has constructs present internally to ensure that there are at max at a time no more than 1 retry scheduled for a future time. It also ensures that if theperformAfterRefreshandretryruns do not overlap by using semaphore permits.IndexShard, therelocationmethod has been updated to ensure that the refresh listeners are closed before the handoff which ensures consistency of the uploaded segments data.REMOTE_REFRESHthreadpool has been renamed toREMOTE_REFRESH_RETRY.afterRefreshmethod invocation in the RemoteStoreRefreshListener is synchronous as before but also happens on the originalREFRESHthreadpool.Related Issues
Resolves #8345
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.