Skip to content

Commit

Permalink
Adjust testWaitForPendingSeqNo (#39404)
Browse files Browse the repository at this point in the history
Since #39006, we should either remove `testWaitForPendingSeqNo` 
or adjust it not to wait for the pending operations. This change picks 
the latter.

Relates #39006
  • Loading branch information
dnhatn committed Feb 26, 2019
1 parent 4f1a0cc commit eff7ae8
Showing 1 changed file with 2 additions and 18 deletions.
Expand Up @@ -75,15 +75,13 @@
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;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
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 {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit eff7ae8

Please sign in to comment.