Skip to content

Commit 7fe62d0

Browse files
authored
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 4c00a02 commit 7fe62d0

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
@@ -438,7 +438,6 @@ public void testResyncAfterPrimaryPromotion() throws Exception {
438438
}
439439
}
440440

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

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

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

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

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

0 commit comments

Comments
 (0)