From 088a42b846eb4d2eb270e4cd2aee9f272c74a345 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Tue, 16 Sep 2008 18:49:16 +0000 Subject: [PATCH] LUCENE-1135: fix rare deadlock case in testAddIndexOnDiskFull git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@696005 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/lucene/index/IndexWriter.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/java/org/apache/lucene/index/IndexWriter.java b/src/java/org/apache/lucene/index/IndexWriter.java index 8585e1a5e18..39101662d83 100644 --- a/src/java/org/apache/lucene/index/IndexWriter.java +++ b/src/java/org/apache/lucene/index/IndexWriter.java @@ -4584,6 +4584,14 @@ public class IndexWriter { synchronized(this) { + // sizeInBytes > 0 means this is an autoCommit at + // the end of a merge. If at this point stopMerges + // is true (which means a rollback() or + // rollbackTransaction() is waiting for us to + // finish), we skip the commit to avoid deadlock + if (sizeInBytes > 0 && stopMerges) + return; + // Wait for any running addIndexes to complete // first, then block any from running until we've // copied the segmentInfos we intend to sync: