From 6a43fe348d923e67c931d30428e12965171a88bf Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Wed, 13 May 2015 16:47:18 +0200 Subject: [PATCH] Fail recovery if retry recovery if resetRecovery fails This might fail if the shard is closed for instance. This will leak a shard lock causing the shard being locked on this node forever. --- .../java/org/elasticsearch/indices/recovery/RecoveryTarget.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java b/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java index ec0cfe6b8f3..2c8119bfe44 100644 --- a/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java +++ b/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java @@ -148,7 +148,7 @@ public class RecoveryTarget extends AbstractComponent { logger.trace("will retrying recovery with id [{}] in [{}] (reason [{}])", recoveryStatus.recoveryId(), retryAfter, reason); try { recoveryStatus.resetRecovery(); - } catch (IOException e) { + } catch (Throwable e) { onGoingRecoveries.failRecovery(recoveryStatus.recoveryId(), new RecoveryFailedException(currentRequest, e), true); } threadPool.schedule(retryAfter, ThreadPool.Names.GENERIC, new RecoveryRunner(recoveryStatus.recoveryId()));