Skip to content

Commit 9c4823b

Browse files
committed
move the assertion back to recovery target
1 parent 662bbf0 commit 9c4823b

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

server/src/main/java/org/elasticsearch/indices/recovery/PeerRecoveryTargetService.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.apache.lucene.index.IndexCommit;
2727
import org.apache.lucene.store.AlreadyClosedException;
2828
import org.apache.lucene.store.RateLimiter;
29-
import org.elasticsearch.Assertions;
3029
import org.elasticsearch.ElasticsearchException;
3130
import org.elasticsearch.ElasticsearchTimeoutException;
3231
import org.elasticsearch.ExceptionsHelper;
@@ -515,11 +514,6 @@ public void onTimeout(TimeValue timeout) {
515514
ActionListener.wrap(
516515
checkpoint -> listener.onResponse(new RecoveryTranslogOperationsResponse(checkpoint)),
517516
e -> {
518-
if (Assertions.ENABLED) {
519-
if (e instanceof MapperException == false) {
520-
throw new AssertionError("unexpected failure while replicating translog entry", e);
521-
}
522-
}
523517
if (mappingVersionOnTarget < request.mappingVersion() && e instanceof MapperException) {
524518
retryOnMappingException.accept(e);
525519
} else {

server/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.apache.lucene.index.CorruptIndexException;
2424
import org.apache.lucene.index.IndexFormatTooNewException;
2525
import org.apache.lucene.index.IndexFormatTooOldException;
26+
import org.elasticsearch.Assertions;
2627
import org.elasticsearch.ElasticsearchException;
2728
import org.elasticsearch.ExceptionsHelper;
2829
import org.elasticsearch.Version;
@@ -351,6 +352,9 @@ public void indexTranslogOperations(
351352
throw new MapperException("mapping updates are not allowed [" + operation + "]");
352353
}
353354
if (result.getFailure() != null) {
355+
if (Assertions.ENABLED) {
356+
throw new AssertionError("unexpected failure while replicating translog entry", result.getFailure());
357+
}
354358
ExceptionsHelper.reThrowIfNotNull(result.getFailure());
355359
}
356360
}

server/src/test/java/org/elasticsearch/indices/recovery/IndexRecoveryIT.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,7 @@ public void testDoNotInfinitelyWaitForMapping() {
906906
}
907907
client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put("index.number_of_replicas", 1)).get();
908908
ensureGreen("test");
909+
client().admin().indices().prepareRefresh("test").get();
909910
assertHitCount(client().prepareSearch().get(), numDocs);
910911
}
911912

0 commit comments

Comments
 (0)