adapt testWaitForPendingSeqNo to stricter operation recovery range

Before we use to ship anything in the translog above a certain point. #27580 changed to have a strict upper bound.
This commit is contained in:
Boaz Leskes 2017-12-03 15:36:44 +01:00
parent f58a3d0b96
commit 2900e3f345
1 changed files with 7 additions and 2 deletions

View File

@ -58,10 +58,12 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
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.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.lessThan;
import static org.hamcrest.Matchers.lessThanOrEqualTo;
import static org.hamcrest.Matchers.not;
public class RecoveryDuringReplicationTests extends ESIndexLevelReplicationTestCase {
@ -390,7 +392,8 @@ public class RecoveryDuringReplicationTests extends ESIndexLevelReplicationTestC
recoveryStart.await();
// index some more
docs += shards.indexDocs(randomInt(5));
final int indexedDuringRecovery = shards.indexDocs(randomInt(5));
docs += indexedDuringRecovery;
assertFalse("recovery should wait on pending docs", opsSent.get());
@ -401,7 +404,9 @@ public class RecoveryDuringReplicationTests extends ESIndexLevelReplicationTestC
recoveryFuture.get();
assertThat(newReplica.recoveryState().getIndex().fileDetails(), empty());
assertThat(newReplica.recoveryState().getTranslog().recoveredOperations(), equalTo(docs));
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 {