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 @@ -4957,11 +4957,15 @@ public void testCleanUpCommitsWhenGlobalCheckpointAdvanced() throws Exception {
4957
4957
}
4958
4958
}
4959
4959
engine .flush (false , randomBoolean ());
4960
- List <IndexCommit > commits = DirectoryReader .listCommits (store .directory ());
4961
- // Global checkpoint advanced but not enough - all commits are kept.
4962
- globalCheckpoint .set (randomLongBetween (globalCheckpoint .get (), engine .getPersistedLocalCheckpoint () - 1 ));
4960
+ globalCheckpoint .set (randomLongBetween (globalCheckpoint .get (), engine .getPersistedLocalCheckpoint ()));
4963
4961
engine .syncTranslog ();
4964
- assertThat (DirectoryReader .listCommits (store .directory ()), equalTo (commits ));
4962
+ List <IndexCommit > commits = DirectoryReader .listCommits (store .directory ());
4963
+ assertThat (Long .parseLong (commits .get (0 ).getUserData ().get (SequenceNumbers .MAX_SEQ_NO )),
4964
+ lessThanOrEqualTo (globalCheckpoint .get ()));
4965
+ for (int i = 1 ; i < commits .size (); i ++) {
4966
+ assertThat (Long .parseLong (commits .get (i ).getUserData ().get (SequenceNumbers .MAX_SEQ_NO )),
4967
+ greaterThan (globalCheckpoint .get ()));
4968
+ }
4965
4969
// Global checkpoint advanced enough - only the last commit is kept.
4966
4970
globalCheckpoint .set (randomLongBetween (engine .getPersistedLocalCheckpoint (), Long .MAX_VALUE ));
4967
4971
engine .syncTranslog ();
You can’t perform that action at this time.
0 commit comments