lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r576934 - in /lucene/java/trunk/src: java/org/apache/lucene/index/IndexWriter.java test/org/apache/lucene/index/TestIndexWriterDelete.java
Date Tue, 18 Sep 2007 14:44:04 GMT
Author: mikemccand
Date: Tue Sep 18 07:44:04 2007
New Revision: 576934

URL: http://svn.apache.org/viewvc?rev=576934&view=rev
Log:
LUCENE-845: fixed a case that was allowing same segment name to be used twice when a concurrent
merge was aborted in between

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java
    lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterDelete.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=576934&r1=576933&r2=576934&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 Tue Sep 18 07:44:04
2007
@@ -1472,6 +1472,12 @@
     // Cannot synchronize on IndexWriter because that causes
     // deadlock
     synchronized(segmentInfos) {
+      // Important to set commitPending so that the
+      // segmentInfos is written on close.  Otherwise we
+      // could close, re-open and re-return the same segment
+      // name that was previously returned which can cause
+      // problems at least with ConcurrentMergeScheduler.
+      commitPending = true;
       return "_" + Integer.toString(segmentInfos.counter++, Character.MAX_RADIX);
     }
   }
@@ -1906,6 +1912,7 @@
   private synchronized void checkpoint() throws IOException {
     if (autoCommit) {
       segmentInfos.write(directory);
+      commitPending = false;
       if (infoStream != null)
         message("checkpoint: wrote segments file \"" + segmentInfos.getCurrentSegmentFileName()
+ "\"");
     } else {

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterDelete.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterDelete.java?rev=576934&r1=576933&r2=576934&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterDelete.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterDelete.java Tue Sep
18 07:44:04 2007
@@ -698,6 +698,7 @@
         }
         public void eval(MockRAMDirectory dir)  throws IOException {
           if (!failed) {
+            failed = true;
             throw new IOException("fail in add doc");
           }
         }



Mime
View raw message