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
Allow to cancel recovery sources when shards are closed #8555
Conversation
final Set<ShardRecoveryHandler> shardRecoveryHandlers = ongoingRecoveries.get(shard); | ||
if (shardRecoveryHandlers != null) { | ||
for (ShardRecoveryHandler handlers : shardRecoveryHandlers) { | ||
handlers.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.
We should catch any exceptions during the cancel and log them so we can continue to cancel any other handlers? Otherwise the first exception will cause us to bail
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.
@dakrone there is nothing that can throw an exception there really today but I will add it, it might barf in the future
7518e79
to
e955110
Compare
@dakrone pushed a new commit |
shardRecoveryHandlers = new HashSet<>(); | ||
ongoingRecoveries.put(shard, shardRecoveryHandlers); | ||
} | ||
assert shardRecoveryHandlers.contains(handler) == false : "Handler was alread registered [" + handler + "]"; |
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.
alread => already
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.
might also want to add a toString implementation on ShardRecoveryHandler or add the shard in question to the assert.
I left some cosmetics related comments. O.w. LGTM. I lovel the CancelableThreads - will come handy in other places. |
Today recovery sources are not cancled if a shard is closed. The recovery target is already cancled when shards are closed but we should also cleanup and cancel the sources side since it holds on to shard locks / references until it's closed.
e955110
to
043f18d
Compare
haven't ported this to 1.5 yet... |
Today recovery sources are not cancled if a shard is closed. The recovery target
is already cancled when shards are closed but we should also cleanup and cancel
the sources side since it holds on to shard locks / references until it's closed.