Fix testKeepTranslogAfterGlobalCheckpoint

Read the last synced global checkpoint after flushing as
we might advance it during committing.

CI: https://gradle-enterprise.elastic.co/s/7o6qengg4gva2
This commit is contained in:
Nhat Nguyen 2020-02-25 11:46:43 -05:00
parent 51c6aefa55
commit a88d54eb2d

View File

@ -4891,8 +4891,8 @@ public class InternalEngineTests extends EngineTestCase {
engine.syncTranslog();
}
if (frequently()) {
final long lastSyncedGlobalCheckpoint = Translog.readGlobalCheckpoint(translogPath, translogUUID);
engine.flush(randomBoolean(), true);
final long lastSyncedGlobalCheckpoint = Translog.readGlobalCheckpoint(translogPath, translogUUID);
final List<IndexCommit> commits = DirectoryReader.listCommits(store.directory());
// Keep only one safe commit as the oldest commit.
final IndexCommit safeCommit = commits.get(0);