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

Restore with wait_for_completion:true should wait for succesfully restored shards to get started #8545

Conversation

imotov
Copy link
Contributor

@imotov imotov commented Nov 19, 2014

This commit ensures that restore operation with wait_for_completion=true doesn't return until all successfully restored shards are started. Before it was returning as soon as restore operation was over, which cause some shards to be unavailable immediately after restore completion.

Fixes #8340

@imotov imotov added :Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >bug review v1.4.1 v1.5.0 v2.0.0-beta1 labels Nov 19, 2014
// Shard disappeared (index deleted) or became active
if (shardRouting == null || shardRouting.active()) {
iterator.remove();
logger.debug("[{}][{}] shard started - removing", request.snapshotId(), shardId);
Copy link
Member

Choose a reason for hiding this comment

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

shard started is misleading if shardRouting == null.

@pickypg
Copy link
Member

pickypg commented Nov 19, 2014

Left some minor comments. LGTM

@s1monw s1monw self-assigned this Nov 21, 2014
@s1monw s1monw changed the title Snapshot/Restore: restore with wait_for_completion=true should wait for ... Snapshot/Restore: restore with wait_for_completion=true should wait for succesfully restored shards to get started Nov 21, 2014
@@ -76,25 +75,26 @@ protected void masterOperation(final RestoreSnapshotRequest request, ClusterStat
request.indices(), request.indicesOptions(), request.renamePattern(), request.renameReplacement(),
request.settings(), request.masterNodeTimeout(), request.includeGlobalState(), request.partial(), request.includeAliases());

restoreService.restoreSnapshot(restoreRequest, new RestoreSnapshotListener() {
restoreService.restoreSnapshot(restoreRequest, new ActionListener<RestoreInfo>() {
Copy link
Contributor

Choose a reason for hiding this comment

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

unrelated but I think we should use DelegatingActionListener here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, I don't see how this is going to be useful delegated listener is not called every time and DelegatingActionListener doesn't really provide a simple way to suppress calling onResponse of the delegated listener when needed.

@s1monw
Copy link
Contributor

s1monw commented Nov 21, 2014

I left a couple of comments

@s1monw s1monw removed the review label Nov 21, 2014
@s1monw
Copy link
Contributor

s1monw commented Nov 21, 2014

@imotov should this go into 1.3.6 too?

@s1monw
Copy link
Contributor

s1monw commented Nov 24, 2014

LGTM

…or succesfully restored shards to get started

This commit ensures that restore operation with wait_for_completion=true doesn't return until all successfully restored shards are started. Before it was returning as soon as restore operation was over, which cause some shards to be unavailable immediately after restore completion.

Fixes elastic#8340
@imotov imotov force-pushed the issue-8340-wait-for-shards-to-start-at-restore-completion branch from df0cc44 to 1aff863 Compare November 25, 2014 01:54
@imotov imotov merged commit 1aff863 into elastic:master Nov 25, 2014
@clintongormley clintongormley changed the title Snapshot/Restore: restore with wait_for_completion=true should wait for succesfully restored shards to get started Restore with wait_for_completion:true should wait for succesfully restored shards to get started Jun 8, 2015
@imotov imotov deleted the issue-8340-wait-for-shards-to-start-at-restore-completion branch May 1, 2020 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Several recoveries cause IndexShardGatewayRecoveryException
4 participants