Skip to content

Commit c4f6821

Browse files
committed
Force flush in FrozenEngine#testSearchers (#51635)
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
1 parent 7135ce2 commit c4f6821

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

x-pack/plugin/frozen-indices/src/test/java/org/elasticsearch/index/engine/FrozenEngineTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,9 @@ public void testSearchers() throws Exception {
342342
applyOperations(engine, generateHistoryOnReplica(between(10, 1000), false, randomBoolean(), randomBoolean()));
343343
globalCheckpoint.set(engine.getProcessedLocalCheckpoint());
344344
engine.syncTranslog();
345-
engine.flush();
345+
// We need to force flush to make the last commit a safe commit; otherwise, we might fail to open ReadOnlyEngine
346+
// See TransportVerifyShardBeforeCloseAction#executeShardOperation
347+
engine.flush(true, true);
346348
engine.refresh("test");
347349
try (Engine.Searcher searcher = engine.acquireSearcher("test")) {
348350
totalDocs = searcher.search(new MatchAllDocsQuery(), Integer.MAX_VALUE).scoreDocs.length;

0 commit comments

Comments
 (0)