Skip to content

Commit 601c056

Browse files
committed
Fix global checkpoints test bug
This commit fixes a test bug in a global checkpoints integration test. Namely, if the replica shard is slow to start and is peer recovered from the primary, it will not have the expected global checkpoint due to these not being persisted and transferred on recovery. Relates #18755
1 parent ea0c91a commit 601c056

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

core/src/test/java/org/elasticsearch/index/seqno/CheckpointsIT.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,19 @@ public void testCheckpointsAdvance() throws Exception {
6161
XContentHelper.toString(shardStats.getSeqNoStats(),
6262
new ToXContent.MapParams(Collections.singletonMap("pretty", "false"))));
6363
final Matcher<Long> localCheckpointRule;
64+
final Matcher<Long> globalCheckpointRule;
6465
if (shardStats.getShardRouting().primary()) {
6566
localCheckpointRule = equalTo(numDocs - 1L);
67+
globalCheckpointRule = equalTo(numDocs - 1L);
6668
} else {
67-
// nocommit: recovery doesn't transfer local checkpoints yet (we don't persist them in lucene).
69+
// nocommit: recovery doesn't transfer checkpoints yet (we don't persist them in lucene).
6870
localCheckpointRule = anyOf(equalTo(numDocs - 1L), equalTo(SequenceNumbersService.NO_OPS_PERFORMED));
71+
globalCheckpointRule = anyOf(equalTo(numDocs - 1L), equalTo(SequenceNumbersService.UNASSIGNED_SEQ_NO));
6972
}
7073
assertThat(shardStats.getShardRouting() + " local checkpoint mismatch",
7174
shardStats.getSeqNoStats().getLocalCheckpoint(), localCheckpointRule);
7275
assertThat(shardStats.getShardRouting() + " global checkpoint mismatch",
73-
shardStats.getSeqNoStats().getGlobalCheckpoint(), equalTo(numDocs - 1L));
76+
shardStats.getSeqNoStats().getGlobalCheckpoint(), globalCheckpointRule);
7477
assertThat(shardStats.getShardRouting() + " max seq no mismatch",
7578
shardStats.getSeqNoStats().getMaxSeqNo(), equalTo(numDocs - 1L));
7679
}

0 commit comments

Comments
 (0)