Relax max_seq_no_of_updates assertion in follow tests

If there's a failover on the follower, then its max_seq_no_of_updates is
bootstrapped from its max_seq_no which might be higher than the
max_seq_no_of_updates of the leader. We need to relax this check.

Relates #40249
This commit is contained in:
Nhat Nguyen 2019-03-21 18:05:08 -04:00
parent 6ea3272f41
commit 0e12065b54
1 changed files with 3 additions and 1 deletions

View File

@ -78,6 +78,7 @@ import java.util.stream.Collectors;
import static java.util.Collections.emptyMap; import static java.util.Collections.emptyMap;
import static java.util.Collections.emptySet; import static java.util.Collections.emptySet;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;
@ -618,7 +619,8 @@ public class ShardFollowTaskReplicationTests extends ESIndexLevelReplicationTest
} }
for (IndexShard followingShard : follower) { for (IndexShard followingShard : follower) {
if (assertMaxSeqNoOfUpdatesOrDeletes) { if (assertMaxSeqNoOfUpdatesOrDeletes) {
assertThat(followingShard.getMaxSeqNoOfUpdatesOrDeletes(), equalTo(leader.getPrimary().getMaxSeqNoOfUpdatesOrDeletes())); assertThat(followingShard.getMaxSeqNoOfUpdatesOrDeletes(),
greaterThanOrEqualTo(leader.getPrimary().getMaxSeqNoOfUpdatesOrDeletes()));
} }
List<Tuple<String, Long>> docAndSeqNosOnFollower = getDocIdAndSeqNos(followingShard).stream() List<Tuple<String, Long>> docAndSeqNosOnFollower = getDocIdAndSeqNos(followingShard).stream()
.map(d -> Tuple.tuple(d.getId(), d.getSeqNo())).collect(Collectors.toList()); .map(d -> Tuple.tuple(d.getId(), d.getSeqNo())).collect(Collectors.toList());