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

Allow to cancel recovery sources when shards are closed #8555

Merged
merged 1 commit into from Nov 19, 2014

Conversation

s1monw
Copy link
Contributor

@s1monw s1monw commented Nov 19, 2014

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.

final Set<ShardRecoveryHandler> shardRecoveryHandlers = ongoingRecoveries.get(shard);
if (shardRecoveryHandlers != null) {
for (ShardRecoveryHandler handlers : shardRecoveryHandlers) {
handlers.cancel(reason);
Copy link
Member

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

Copy link
Contributor Author

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

@s1monw
Copy link
Contributor Author

s1monw commented Nov 19, 2014

@dakrone pushed a new commit

shardRecoveryHandlers = new HashSet<>();
ongoingRecoveries.put(shard, shardRecoveryHandlers);
}
assert shardRecoveryHandlers.contains(handler) == false : "Handler was alread registered [" + handler + "]";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alread => already

Copy link
Contributor

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.

@bleskes
Copy link
Contributor

bleskes commented Nov 19, 2014

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.
@s1monw s1monw merged commit 043f18d into elastic:master Nov 19, 2014
@s1monw
Copy link
Contributor Author

s1monw commented Nov 19, 2014

haven't ported this to 1.5 yet...

@s1monw s1monw removed the v1.5.0 label Nov 19, 2014
@clintongormley clintongormley added the :Distributed/Recovery Anything around constructing a new shard, either from a local or a remote source. label Jun 7, 2015
@clintongormley clintongormley changed the title [RECOVERY] Allow to cancle recovery sources when shards are closed Allow to cancel recovery sources when shards are closed Jun 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed/Recovery Anything around constructing a new shard, either from a local or a remote source. >enhancement v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants