Skip to content

Commit

Permalink
Force flush in FrozenEngine#testSearchers (#51635)
Browse files Browse the repository at this point in the history
We need to force flush to make the last commit safe; otherwise, we might 
fail to open FrozenEngine. Note that we force flush before closing a
shard.

Closes #51620
  • Loading branch information
dnhatn authored Jan 29, 2020
1 parent 5b4ef60 commit b96ec74
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,9 @@ public void testSearchers() throws Exception {
applyOperations(engine, generateHistoryOnReplica(between(10, 1000), false, randomBoolean(), randomBoolean()));
globalCheckpoint.set(engine.getProcessedLocalCheckpoint());
engine.syncTranslog();
engine.flush();
// We need to force flush to make the last commit a safe commit; otherwise, we might fail to open ReadOnlyEngine
// See TransportVerifyShardBeforeCloseAction#executeShardOperation
engine.flush(true, true);
engine.refresh("test");
try (Engine.Searcher searcher = engine.acquireSearcher("test")) {
totalDocs = searcher.search(new MatchAllDocsQuery(), Integer.MAX_VALUE).scoreDocs.length;
Expand Down

0 comments on commit b96ec74

Please sign in to comment.