From e9d275d3a9dddaee3dc2f1941e5b4f3dfa491175 Mon Sep 17 00:00:00 2001 From: Boaz Leskes Date: Wed, 10 Jun 2015 17:12:14 +0200 Subject: [PATCH] Recovery: fix MapperException detection during translog ops replay The current ExceptionsHelper.unwrapCause(exception) requires the incoming exception to support ElasticsearchWrapperException , which TranslogRecoveryPerformer.BatchOperationException doesn't implement. I opted for a more generic solution --- .../org/elasticsearch/indices/recovery/RecoveryTarget.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java b/core/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java index 18f08c929ee45..22bd433697444 100644 --- a/core/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java +++ b/core/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java @@ -306,7 +306,8 @@ public void messageReceived(final RecoveryTranslogOperationsRequest request, fin try { recoveryStatus.indexShard().performBatchRecovery(request.operations()); } catch (TranslogRecoveryPerformer.BatchOperationException exception) { - if (ExceptionsHelper.unwrapCause(exception) instanceof MapperException == false) { + MapperException mapperException = (MapperException) ExceptionsHelper.unwrap(exception, MapperException.class); + if (mapperException == null) { throw exception; } // in very rare cases a translog replay from primary is processed before a mapping update on this node