parent
b08cd058bc
commit
2a863ac8ff
|
@ -4973,11 +4973,15 @@ public class InternalEngineTests extends EngineTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
engine.flush(false, randomBoolean());
|
engine.flush(false, randomBoolean());
|
||||||
List<IndexCommit> commits = DirectoryReader.listCommits(store.directory());
|
globalCheckpoint.set(randomLongBetween(globalCheckpoint.get(), engine.getPersistedLocalCheckpoint()));
|
||||||
// Global checkpoint advanced but not enough - all commits are kept.
|
|
||||||
globalCheckpoint.set(randomLongBetween(globalCheckpoint.get(), engine.getPersistedLocalCheckpoint() - 1));
|
|
||||||
engine.syncTranslog();
|
engine.syncTranslog();
|
||||||
assertThat(DirectoryReader.listCommits(store.directory()), equalTo(commits));
|
List<IndexCommit> commits = DirectoryReader.listCommits(store.directory());
|
||||||
|
assertThat(Long.parseLong(commits.get(0).getUserData().get(SequenceNumbers.MAX_SEQ_NO)),
|
||||||
|
lessThanOrEqualTo(globalCheckpoint.get()));
|
||||||
|
for (int i = 1; i < commits.size(); i++) {
|
||||||
|
assertThat(Long.parseLong(commits.get(i).getUserData().get(SequenceNumbers.MAX_SEQ_NO)),
|
||||||
|
greaterThan(globalCheckpoint.get()));
|
||||||
|
}
|
||||||
// Global checkpoint advanced enough - only the last commit is kept.
|
// Global checkpoint advanced enough - only the last commit is kept.
|
||||||
globalCheckpoint.set(randomLongBetween(engine.getPersistedLocalCheckpoint(), Long.MAX_VALUE));
|
globalCheckpoint.set(randomLongBetween(engine.getPersistedLocalCheckpoint(), Long.MAX_VALUE));
|
||||||
engine.syncTranslog();
|
engine.syncTranslog();
|
||||||
|
|
Loading…
Reference in New Issue