-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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] Extend FileChunkWriter to allow cancel on transport client #4386
Changes from all commits
a6bc3f8
b67fcdb
afc5030
45428ad
67f23e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,6 @@ void writeFileChunk( | |
int totalTranslogOps, | ||
ActionListener<Void> listener | ||
); | ||
|
||
default void cancel() {} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,8 @@ class SegmentReplicationSourceHandler { | |
private final DiscoveryNode targetNode; | ||
private final String allocationId; | ||
|
||
private final FileChunkWriter writer; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
|
@@ -96,6 +98,7 @@ class SegmentReplicationSourceHandler { | |
); | ||
this.allocationId = allocationId; | ||
this.copyState = copyState; | ||
this.writer = writer; | ||
} | ||
|
||
/** | ||
|
@@ -186,9 +189,10 @@ public synchronized void sendFiles(GetSegmentFilesRequest request, ActionListene | |
} | ||
|
||
/** | ||
* Cancels the recovery and interrupts all eligible threads. | ||
* Cancels the replication and interrupts all eligible threads. | ||
*/ | ||
public void cancel(String reason) { | ||
writer.cancel(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does order matter here at all? Should we cancel threads first? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the transport requests are taken up in TransportService thread. So, these two actions can be in any order. |
||
cancellableThreads.cancel(reason); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this specific file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was to execute if block only once, so added one random file check as well along with
lastChunk()