File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
server/src/test/java/org/elasticsearch/index/engine Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -291,9 +291,6 @@ tests:
291291- class : org.elasticsearch.env.NodeEnvironmentTests
292292 method : testGetBestDowngradeVersion
293293 issue : https://github.com/elastic/elasticsearch/issues/121316
294- - class : org.elasticsearch.index.engine.ShuffleForcedMergePolicyTests
295- method : testDiagnostics
296- issue : https://github.com/elastic/elasticsearch/issues/121336
297294- class : org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
298295 method : test {yaml=reference/rest-api/security/invalidate-tokens/line_194}
299296 issue : https://github.com/elastic/elasticsearch/issues/121337
Original file line number Diff line number Diff line change 2020import org .apache .lucene .index .LeafReaderContext ;
2121import org .apache .lucene .index .MergePolicy ;
2222import org .apache .lucene .index .SegmentInfos ;
23+ import org .apache .lucene .index .TieredMergePolicy ;
2324import org .apache .lucene .search .Sort ;
2425import org .apache .lucene .search .SortField ;
2526import org .apache .lucene .store .Directory ;
@@ -37,7 +38,14 @@ public void testDiagnostics() throws IOException {
3738 IndexWriterConfig iwc = newIndexWriterConfig ();
3839 // Disable merging on flush.
3940 iwc .setMaxFullFlushMergeWaitMillis (0L );
40- MergePolicy mp = new ShuffleForcedMergePolicy (newTieredMergePolicy ());
41+ // Even though we set setMaxFullFlushMergeWaitMillis=0, opening the DirectoryReader
42+ // might trigger a merge after flushing the in-memory documents. Therefore, we set
43+ // a high enough number of maxSegmentsPerTier (we index at most 300 documents, and we flush
44+ // a new segment per 10 documents) that would prevent merging all the segments into one and
45+ // making the force merge a no-op.
46+ var tieredMergePolicy = new TieredMergePolicy ();
47+ tieredMergePolicy .setSegmentsPerTier (100 );
48+ MergePolicy mp = new ShuffleForcedMergePolicy (tieredMergePolicy );
4149 iwc .setMergePolicy (mp );
4250 boolean sorted = random ().nextBoolean ();
4351 if (sorted ) {
You can’t perform that action at this time.
0 commit comments