From 4773574578f089802fe3f36bff6951c4a29a3628 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Tue, 28 Jan 2020 12:24:31 -0500 Subject: [PATCH] LUCENE-9189: TestIndexWriterDelete.testDeletesOnDiskFull can run for minutes The issue is that MockDirectoryWrapper's disk full check is horribly inefficient. On every writeByte/etc, it totally recomputes disk space across all files. This means it calls listAll() on the underlying Directory (which sorts all the underlying files), then sums up fileLength() for each of those files. This leads to many pathological cases in the disk full tests... but the number of tests impacted by this is minimal, and the logic is scary. --- .../test/org/apache/lucene/index/TestIndexWriterDelete.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterDelete.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterDelete.java index 57d4f58ff84..b32ea30840f 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterDelete.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterDelete.java @@ -482,11 +482,13 @@ public class TestIndexWriterDelete extends LuceneTestCase { return hitCount; } + // TODO: can we fix MockDirectoryWrapper disk full checking to be more efficient (not recompute on every write)? + @Nightly public void testDeletesOnDiskFull() throws IOException { doTestOperationsOnDiskFull(false); } - // TODO: can we tone this test down so it isn't crazy slow? + // TODO: can we fix MockDirectoryWrapper disk full checking to be more efficient (not recompute on every write)? @Nightly public void testUpdatesOnDiskFull() throws IOException { doTestOperationsOnDiskFull(true);