Apache Lucene open-source search software
LUCENE-5374: Call IW#processEvents before IndexWriter is closed
Simon Willnauerad6c85ef96a6
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex 14472cde63b..e154059d8eb 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -104,6 +104,12 @@ Bug fixes* LUCENE-5285: Improved highlighting of multi-valued fields withFastVectorHighlighter. (Nik Everett via Adrien Grand)+* LUCENE-5374: IndexWriter processes internal events after the it+ closed itself internally. This rare condition can happen if an+ IndexWriter has internal changes that were not fully applied yet+ like when index / flush requests happen concurrently to the close or+ rollback call. (Simon Willnauer)+Changes in Runtime Behavior* LUCENE-5362: IndexReader and SegmentCoreReaders now throwdiff --git a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.javaindex 453134f7585..f9524768dff 100644--- a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java+++ b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java@@ -1028,7 +1028,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit{if (doFlush) {commitInternal();}-+ processEvents(false, true);synchronized(this) {// commitInternal calls ReaderPool.commit, which// writes any pending liveDocs from ReaderPool, so@@ -1063,7 +1063,6 @@ public class IndexWriter implements Closeable, TwoPhaseCommit{}// finally, restore interrupt status:if (interrupted) Thread.currentThread().interrupt();- processEvents(false, true);}}