lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r775249 - /lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java
Date Fri, 15 May 2009 17:30:43 GMT
Author: mikemccand
Date: Fri May 15 17:30:43 2009
New Revision: 775249

URL: http://svn.apache.org/viewvc?rev=775249&view=rev
Log:
LUCENE-1638: fix thread hazard when autoCommit=true and multiple threads are committing

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java?rev=775249&r1=775248&r2=775249&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java Fri May 15 17:30:43
2009
@@ -4353,6 +4353,10 @@
     assert !segmentInfos.contains(merge.info);
     segmentInfos.add(start, merge.info);
 
+    // Must note the change to segmentInfos so any commits
+    // in-flight don't lose it:
+    changeCount++;
+
     // If the merged segments had pending changes, clear
     // them so that they don't bother writing them to
     // disk, updating SegmentInfo, etc.:
@@ -4865,7 +4869,9 @@
     // Must checkpoint before decrefing so any newly
     // referenced files in the new merge.info are incref'd
     // first:
-    checkpoint();
+    synchronized(this) {
+      deleter.checkpoint(segmentInfos, false);
+    }
     decrefMergeSegments(merge);
 
     if (merge.useCompoundFile) {



Mime
View raw message