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