From 100a783ab26c905b3291c4ab4fd0b9140be226b3 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Tue, 15 Sep 2015 01:19:20 +0000 Subject: [PATCH] LUCENE-6804: fix test bug, to properly handle tragic merge exceptions git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1703082 13f79535-47bb-0310-9956-ffa450edef68 --- .../lucene/index/TestIndexWriterOutOfFileDescriptors.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOutOfFileDescriptors.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOutOfFileDescriptors.java index f180b58954c..30aac07a31e 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOutOfFileDescriptors.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOutOfFileDescriptors.java @@ -84,7 +84,13 @@ public class TestIndexWriterOutOfFileDescriptors extends LuceneTestCase { w.addDocument(docs.nextDoc()); } dir.setRandomIOExceptionRateOnOpen(0.0); - w.close(); + if (ms instanceof ConcurrentMergeScheduler) { + ((ConcurrentMergeScheduler) ms).sync(); + } + // If exc hit CMS then writer will be tragically closed: + if (w.getTragicException() == null) { + w.close(); + } w = null; // NOTE: This is O(N^2)! Only enable for temporary debugging: