Skip to content

Commit 0799ff1

Browse files
committed
Assert recovery done in testDoNotWaitForPendingSeqNo (#39595)
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
1 parent f86f1ee commit 0799ff1

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

server/src/test/java/org/elasticsearch/index/replication/RecoveryDuringReplicationTests.java

+5-12
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,6 @@ public void testResyncAfterPrimaryPromotion() throws Exception {
439439
}
440440
}
441441

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

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

492491
CountDownLatch recoveryStart = new CountDownLatch(1);
493-
AtomicBoolean opsSent = new AtomicBoolean(false);
492+
AtomicBoolean recoveryDone = new AtomicBoolean(false);
494493
final Future<Void> recoveryFuture = shards.asyncRecoverReplica(newReplica, (indexShard, node) -> {
495494
recoveryStart.countDown();
496495
return new RecoveryTarget(indexShard, node, recoveryListener, l -> {}) {
497496
@Override
498-
public void indexTranslogOperations(
499-
final List<Translog.Operation> operations,
500-
final int totalTranslogOps,
501-
final long maxSeenAutoIdTimestamp,
502-
final long msu,
503-
final RetentionLeases retentionLeases,
504-
final ActionListener<Long> listener) {
505-
opsSent.set(true);
506-
super.indexTranslogOperations(operations, totalTranslogOps, maxSeenAutoIdTimestamp, msu, retentionLeases, listener);
497+
public void finalizeRecovery(long globalCheckpoint, ActionListener<Void> listener) {
498+
recoveryDone.set(true);
499+
super.finalizeRecovery(globalCheckpoint, listener);
507500
}
508501
};
509502
});
@@ -514,7 +507,7 @@ public void indexTranslogOperations(
514507
final int indexedDuringRecovery = shards.indexDocs(randomInt(5));
515508
docs += indexedDuringRecovery;
516509

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

519512
primaryEngineFactory.releaseLatchedIndexers();
520513
pendingDocsDone.await();

0 commit comments

Comments
 (0)