File tree 1 file changed +8
-4
lines changed
server/src/test/java/org/elasticsearch/index/engine
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -4955,11 +4955,15 @@ public void testCleanUpCommitsWhenGlobalCheckpointAdvanced() throws Exception {
4955
4955
}
4956
4956
}
4957
4957
engine .flush (false , randomBoolean ());
4958
- List <IndexCommit > commits = DirectoryReader .listCommits (store .directory ());
4959
- // Global checkpoint advanced but not enough - all commits are kept.
4960
- globalCheckpoint .set (randomLongBetween (globalCheckpoint .get (), engine .getPersistedLocalCheckpoint () - 1 ));
4958
+ globalCheckpoint .set (randomLongBetween (globalCheckpoint .get (), engine .getPersistedLocalCheckpoint ()));
4961
4959
engine .syncTranslog ();
4962
- assertThat (DirectoryReader .listCommits (store .directory ()), equalTo (commits ));
4960
+ List <IndexCommit > commits = DirectoryReader .listCommits (store .directory ());
4961
+ assertThat (Long .parseLong (commits .get (0 ).getUserData ().get (SequenceNumbers .MAX_SEQ_NO )),
4962
+ lessThanOrEqualTo (globalCheckpoint .get ()));
4963
+ for (int i = 1 ; i < commits .size (); i ++) {
4964
+ assertThat (Long .parseLong (commits .get (i ).getUserData ().get (SequenceNumbers .MAX_SEQ_NO )),
4965
+ greaterThan (globalCheckpoint .get ()));
4966
+ }
4963
4967
// Global checkpoint advanced enough - only the last commit is kept.
4964
4968
globalCheckpoint .set (randomLongBetween (engine .getPersistedLocalCheckpoint (), Long .MAX_VALUE ));
4965
4969
engine .syncTranslog ();
You can’t perform that action at this time.
0 commit comments