Apache Lucene open-source search software
add comment explaining why flush isn't sync'd
Michael McCandlessd29a64d182cc
diff --git a/lucene/src/java/org/apache/lucene/index/IndexWriter.java b/lucene/src/java/org/apache/lucene/index/IndexWriter.javaindex 78dad85ad56..75ba136cb9c 100644--- a/lucene/src/java/org/apache/lucene/index/IndexWriter.java+++ b/lucene/src/java/org/apache/lucene/index/IndexWriter.java@@ -3229,6 +3229,14 @@ public class IndexWriter implements Closeable {* be flushed*/protected final void flush(boolean triggerMerge, boolean flushDocStores, boolean flushDeletes) throws CorruptIndexException, IOException {++ // NOTE: this method cannot be sync'd because+ // maybeMerge() in turn calls mergeScheduler.merge which+ // in turn can take a long time to run and we don't want+ // to hold the lock for that. In the case of+ // ConcurrentMergeScheduler this can lead to deadlock+ // when it stalls due to too many running merges.+// We can be called during close, when closing==true, so we must pass false to ensureOpen:ensureOpen(false);if (doFlush(flushDocStores, flushDeletes) && triggerMerge)