Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assert recovery done in testDoNotWaitForPendingSeqNo #39595

Merged
merged 3 commits into from
Mar 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,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 @@ -489,20 +488,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 @@ -513,7 +506,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