add comment explaining why flush isn't sync'd

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1031480 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2010-11-05 09:01:51 +00:00
parent fe82745769
commit d29a64d182

View File

@ -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)