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 @@ -4973,11 +4973,15 @@ public void testCleanUpCommitsWhenGlobalCheckpointAdvanced() throws Exception {
4973
4973
}
4974
4974
}
4975
4975
engine .flush (false , randomBoolean ());
4976
- List <IndexCommit > commits = DirectoryReader .listCommits (store .directory ());
4977
- // Global checkpoint advanced but not enough - all commits are kept.
4978
- globalCheckpoint .set (randomLongBetween (globalCheckpoint .get (), engine .getPersistedLocalCheckpoint () - 1 ));
4976
+ globalCheckpoint .set (randomLongBetween (globalCheckpoint .get (), engine .getPersistedLocalCheckpoint ()));
4979
4977
engine .syncTranslog ();
4980
- assertThat (DirectoryReader .listCommits (store .directory ()), equalTo (commits ));
4978
+ List <IndexCommit > commits = DirectoryReader .listCommits (store .directory ());
4979
+ assertThat (Long .parseLong (commits .get (0 ).getUserData ().get (SequenceNumbers .MAX_SEQ_NO )),
4980
+ lessThanOrEqualTo (globalCheckpoint .get ()));
4981
+ for (int i = 1 ; i < commits .size (); i ++) {
4982
+ assertThat (Long .parseLong (commits .get (i ).getUserData ().get (SequenceNumbers .MAX_SEQ_NO )),
4983
+ greaterThan (globalCheckpoint .get ()));
4984
+ }
4981
4985
// Global checkpoint advanced enough - only the last commit is kept.
4982
4986
globalCheckpoint .set (randomLongBetween (engine .getPersistedLocalCheckpoint (), Long .MAX_VALUE ));
4983
4987
engine .syncTranslog ();
You can’t perform that action at this time.
0 commit comments