From ad0d2802ec4a7b6bbfdaf0cbe62acb92b1ca0670 Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Wed, 9 Oct 2024 16:24:02 +0200 Subject: [PATCH] Disable CFS in TestDefaultCodecParallelizesIO. (#13875) `SerialIODirectory` doesn't count reads to files that are open with `ReadAdvice#RANDOM_PRELOAD` as these files are expected to be loaded in memory. Unfortunately, we cannot detect such files on compound segments, so this test now disables compound segments. Closes #13854 --- .../lucene/index/TestDefaultCodecParallelizesIO.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lucene/core/src/test/org/apache/lucene/index/TestDefaultCodecParallelizesIO.java b/lucene/core/src/test/org/apache/lucene/index/TestDefaultCodecParallelizesIO.java index 2c4351fa170..58579ab93a4 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestDefaultCodecParallelizesIO.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestDefaultCodecParallelizesIO.java @@ -40,7 +40,14 @@ public class TestDefaultCodecParallelizesIO extends LuceneTestCase { Directory bbDir = new ByteBuffersDirectory(); try (LineFileDocs docs = new LineFileDocs(random()); IndexWriter w = - new IndexWriter(bbDir, new IndexWriterConfig().setCodec(TestUtil.getDefaultCodec()))) { + new IndexWriter( + bbDir, + new IndexWriterConfig() + // Disable CFS, this test needs to know about files that are open with the + // RANDOM_PRELOAD advice, which CFS doesn't allow us to detect. + .setUseCompoundFile(false) + .setMergePolicy(newLogMergePolicy(false)) + .setCodec(TestUtil.getDefaultCodec()))) { final int numDocs = atLeast(10_000); for (int d = 0; d < numDocs; ++d) { Document doc = docs.nextDoc();