summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorJason Tedor <jason@tedor.me>2017-06-28 08:42:13 -0400
committerJason Tedor <jason@tedor.me>2017-06-28 08:42:13 -0400
commitebdae09df3137e3dee3a7556de0909d2223ea96b (patch)
tree6c71c207eaeab355c8227ce288e829e76feb5367 /core
parent1900d9c447a800609aba4897cdbdf6f34fa36dba (diff)
Do not swallow exception when relocating
When relocating a shard before changing the state to relocated, we verify that a relocation is a still taking place. Yet, this can throw an exception if the relocation is in fact no longer valid. Sadly, we were swallowing the exception in this situation. This commit allows such an exception to bubble up after safely releasing resources.
Diffstat (limited to 'core')
-rw-r--r--core/src/main/java/org/elasticsearch/index/shard/IndexShard.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/src/main/java/org/elasticsearch/index/shard/IndexShard.java b/core/src/main/java/org/elasticsearch/index/shard/IndexShard.java
index 10fe3ccfd7..5d39292a46 100644
--- a/core/src/main/java/org/elasticsearch/index/shard/IndexShard.java
+++ b/core/src/main/java/org/elasticsearch/index/shard/IndexShard.java
@@ -545,7 +545,12 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
changeState(IndexShardState.RELOCATED, reason);
}
} catch (final Exception e) {
- getEngine().seqNoService().releasePrimaryContext();
+ try {
+ getEngine().seqNoService().releasePrimaryContext();
+ } catch (final Exception inner) {
+ e.addSuppressed(inner);
+ }
+ throw e;
}
});
} catch (TimeoutException e) {