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.
This commit is contained in:
Jason Tedor 2017-06-28 08:42:13 -04:00
parent 1900d9c447
commit ebdae09df3
1 changed files with 6 additions and 1 deletions

View File

@ -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) {