From eff7ae820b8c96f55da0473c45788d34c529024f Mon Sep 17 00:00:00 2001 From: Nhat Nguyen Date: Tue, 26 Feb 2019 15:51:11 -0500 Subject: [PATCH] Adjust testWaitForPendingSeqNo (#39404) Since #39006, we should either remove `testWaitForPendingSeqNo` or adjust it not to wait for the pending operations. This change picks the latter. Relates #39006 --- .../RecoveryDuringReplicationTests.java | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/server/src/test/java/org/elasticsearch/index/replication/RecoveryDuringReplicationTests.java b/server/src/test/java/org/elasticsearch/index/replication/RecoveryDuringReplicationTests.java index 725225773a682..e387ecaca3d24 100644 --- a/server/src/test/java/org/elasticsearch/index/replication/RecoveryDuringReplicationTests.java +++ b/server/src/test/java/org/elasticsearch/index/replication/RecoveryDuringReplicationTests.java @@ -75,7 +75,6 @@ import java.util.stream.Collectors; import static org.hamcrest.Matchers.anyOf; -import static org.hamcrest.Matchers.both; import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.everyItem; @@ -83,7 +82,6 @@ import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.isIn; import static org.hamcrest.Matchers.lessThan; -import static org.hamcrest.Matchers.lessThanOrEqualTo; import static org.hamcrest.Matchers.not; public class RecoveryDuringReplicationTests extends ESIndexLevelReplicationTestCase { @@ -440,17 +438,7 @@ public void testResyncAfterPrimaryPromotion() throws Exception { } } - @TestLogging( - "_root:DEBUG," - + "org.elasticsearch.action.bulk:TRACE," - + "org.elasticsearch.action.get:TRACE," - + "org.elasticsearch.cluster.service:TRACE," - + "org.elasticsearch.discovery:TRACE," - + "org.elasticsearch.indices.cluster:TRACE," - + "org.elasticsearch.indices.recovery:TRACE," - + "org.elasticsearch.index.seqno:TRACE," - + "org.elasticsearch.index.shard:TRACE") - public void testWaitForPendingSeqNo() throws Exception { + public void testDoNotWaitForPendingSeqNo() throws Exception { IndexMetaData metaData = buildIndexMetaData(1); final int pendingDocs = randomIntBetween(1, 5); @@ -524,7 +512,7 @@ public void indexTranslogOperations( final int indexedDuringRecovery = shards.indexDocs(randomInt(5)); docs += indexedDuringRecovery; - assertFalse("recovery should wait on pending docs", opsSent.get()); + assertBusy(() -> assertFalse("recovery should not wait for on pending docs", opsSent.get())); primaryEngineFactory.releaseLatchedIndexers(); pendingDocsDone.await(); @@ -533,10 +521,6 @@ public void indexTranslogOperations( recoveryFuture.get(); assertThat(newReplica.recoveryState().getIndex().fileDetails(), empty()); - assertThat(newReplica.recoveryState().getTranslog().recoveredOperations(), - // we don't know which of the inflight operations made it into the translog range we re-play - both(greaterThanOrEqualTo(docs-indexedDuringRecovery)).and(lessThanOrEqualTo(docs))); - shards.assertAllEqual(docs); } finally { primaryEngineFactory.close();