Fix testShouldPeriodicallyFlushAfterMerge (#52243)
MockRandomMergePolicy randomly determines if a segment should use a compound format. This can cause a force merge performing two merges: (1) merging to a single segment, (2) rewriting the new segment using the compound format. If the second merge completes after we have flushed, then it can flip the flag shouldPeriodicallyFlushAfterBigMerge to true. Closes #52205
This commit is contained in:
parent
257eb0212c
commit
e098e837f7
|
@ -5131,6 +5131,9 @@ public class InternalEngineTests extends EngineTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testShouldPeriodicallyFlushAfterMerge() throws Exception {
|
public void testShouldPeriodicallyFlushAfterMerge() throws Exception {
|
||||||
|
engine.close();
|
||||||
|
// Do not use MockRandomMergePolicy as it can cause a force merge performing two merges.
|
||||||
|
engine = createEngine(copy(engine.config(), newMergePolicy(random(), false)));
|
||||||
assertThat("Empty engine does not need flushing", engine.shouldPeriodicallyFlush(), equalTo(false));
|
assertThat("Empty engine does not need flushing", engine.shouldPeriodicallyFlush(), equalTo(false));
|
||||||
ParsedDocument doc =
|
ParsedDocument doc =
|
||||||
testParsedDocument(Integer.toString(0), null, testDocumentWithTextField(), SOURCE, null);
|
testParsedDocument(Integer.toString(0), null, testDocumentWithTextField(), SOURCE, null);
|
||||||
|
|
Loading…
Reference in New Issue