Skip to content

Commit

Permalink
Assert recovery done in testDoNotWaitForPendingSeqNo (#39595)
Browse files Browse the repository at this point in the history
Since #39006 we should be able to complete a peer-recovery without
waiting for pending indexing operations. Thus, the assertion in
testDoNotWaitForPendingSeqNo should be updated from false to true.

Closes #39510
  • Loading branch information
dnhatn committed Mar 4, 2019
1 parent f86f1ee commit 0799ff1
Showing 1 changed file with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,6 @@ public void testResyncAfterPrimaryPromotion() throws Exception {
}
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/39510")
public void testDoNotWaitForPendingSeqNo() throws Exception {
IndexMetaData metaData = buildIndexMetaData(1);

Expand Down Expand Up @@ -490,20 +489,14 @@ protected EngineFactory getEngineFactory(ShardRouting routing) {
IndexShard newReplica = shards.addReplicaWithExistingPath(replica.shardPath(), replica.routingEntry().currentNodeId());

CountDownLatch recoveryStart = new CountDownLatch(1);
AtomicBoolean opsSent = new AtomicBoolean(false);
AtomicBoolean recoveryDone = new AtomicBoolean(false);
final Future<Void> recoveryFuture = shards.asyncRecoverReplica(newReplica, (indexShard, node) -> {
recoveryStart.countDown();
return new RecoveryTarget(indexShard, node, recoveryListener, l -> {}) {
@Override
public void indexTranslogOperations(
final List<Translog.Operation> operations,
final int totalTranslogOps,
final long maxSeenAutoIdTimestamp,
final long msu,
final RetentionLeases retentionLeases,
final ActionListener<Long> listener) {
opsSent.set(true);
super.indexTranslogOperations(operations, totalTranslogOps, maxSeenAutoIdTimestamp, msu, retentionLeases, listener);
public void finalizeRecovery(long globalCheckpoint, ActionListener<Void> listener) {
recoveryDone.set(true);
super.finalizeRecovery(globalCheckpoint, listener);
}
};
});
Expand All @@ -514,7 +507,7 @@ public void indexTranslogOperations(
final int indexedDuringRecovery = shards.indexDocs(randomInt(5));
docs += indexedDuringRecovery;

assertBusy(() -> assertFalse("recovery should not wait for on pending docs", opsSent.get()));
assertBusy(() -> assertTrue("recovery should not wait for on pending docs", recoveryDone.get()));

primaryEngineFactory.releaseLatchedIndexers();
pendingDocsDone.await();
Expand Down

0 comments on commit 0799ff1

Please sign in to comment.