Fix testKeepTranslogAfterGlobalCheckpoint (#53704)

Read the global checkpoint after flushed as we might advance it while flushing.

Closes #53505
This commit is contained in:
Nhat Nguyen 2020-03-18 11:24:19 -04:00 committed by GitHub
parent 75c367de13
commit 1615c4b379
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -4828,7 +4828,6 @@ public class InternalEngineTests extends EngineTestCase {
}
}
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/53505")
public void testKeepTranslogAfterGlobalCheckpoint() throws Exception {
IOUtils.close(engine, store);
final IndexSettings indexSettings = new IndexSettings(defaultSettings.getIndexMetaData(), defaultSettings.getNodeSettings(),
@ -4870,8 +4869,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);