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

[Backport 2.x] Fix bug where ReplicationListeners would not complete on cancellation. #8630

Merged
merged 1 commit into from
Jul 11, 2023

Conversation

opensearch-trigger-bot[bot]
Copy link
Contributor

Backport 4ccbf9d from #8478.

#8478)

* [Segment Replication] Fix bug where ReplicationListeners would not complete on target cancellation.

This change updates cancellation with Segment Replication to ensure all listeners are resolved.
It does this by requesting cancellation before shard closure instead of using ReplicationCollection's cancelForShard which immediately removes it from the replicationCollection.  This would cause the underlying ReplicationListener to never get invoked on close.

This change includes new tests using suite scope to catch for any open tasks.
This caught other locations where this was possible:
1. On a replica during force sync if the shard was closed while resolving its listeners, it would never call back to the primary if an exception was caught in the onDone method. - Fixed by refactoring those paths to use a ChannelActionListener and always reply to primary.
2. On the primary during forceSync, the primary would not successfully cancel before shard close during a forceSync, Fixed by wrapping the synchronous recoveryTarget::forceSync call in cancellableThreads.

Signed-off-by: Marc Handalian <handalm@amazon.com>

PR cleanup.

Signed-off-by: Marc Handalian <handalm@amazon.com>

Update log message

Signed-off-by: Marc Handalian <handalm@amazon.com>

* PR feedback.

Signed-off-by: Marc Handalian <handalm@amazon.com>

* Update server/src/main/java/org/opensearch/indices/replication/SegmentReplicationTargetService.java

Co-authored-by: Suraj Singh <surajrider@gmail.com>
Signed-off-by: Marc Handalian <handalm@amazon.com>

* Add more tests.

Signed-off-by: Marc Handalian <handalm@amazon.com>

---------

Signed-off-by: Marc Handalian <handalm@amazon.com>
Co-authored-by: Suraj Singh <surajrider@gmail.com>
(cherry picked from commit 4ccbf9d)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@mch2 mch2 merged commit da59ae5 into 2.x Jul 11, 2023
@mch2 mch2 deleted the backport/backport-8478-to-2.x branch July 11, 2023 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants