TEST: Adjust rollback condition when shard is empty

If a shard is empty, it won't rollback its engine on promotion.
This commit adjusts the expectation in the rollback test.

Relates #33473
This commit is contained in:
Nhat Nguyen 2018-09-12 08:24:11 -04:00
parent 96c49e5ed0
commit d9bbb89b26
1 changed files with 2 additions and 1 deletions

View File

@ -963,7 +963,8 @@ public class IndexShardTests extends IndexShardTestCase {
Set<String> docsBelowGlobalCheckpoint = getShardDocUIDs(indexShard).stream()
.filter(id -> Long.parseLong(id) <= Math.max(globalCheckpointOnReplica, globalCheckpoint)).collect(Collectors.toSet());
final CountDownLatch latch = new CountDownLatch(1);
final boolean shouldRollback = Math.max(globalCheckpoint, globalCheckpointOnReplica) < indexShard.seqNoStats().getMaxSeqNo();
final boolean shouldRollback = Math.max(globalCheckpoint, globalCheckpointOnReplica) < indexShard.seqNoStats().getMaxSeqNo()
&& indexShard.seqNoStats().getMaxSeqNo() != SequenceNumbers.NO_OPS_PERFORMED;
final Engine beforeRollbackEngine = indexShard.getEngine();
indexShard.acquireReplicaOperationPermit(
indexShard.pendingPrimaryTerm + 1,