You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2011/05/29 20:36:54 UTC

svn commit: r1128924 - /lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/IndexWriter.java

Author: shaie
Date: Sun May 29 18:36:54 2011
New Revision: 1128924

URL: http://svn.apache.org/viewvc?rev=1128924&view=rev
Log:
LUCENE-3147: reinstate calling checkpoint() from IW.closeMergeReaders

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

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/IndexWriter.java?rev=1128924&r1=1128923&r2=1128924&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/IndexWriter.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/IndexWriter.java Sun May 29 18:36:54 2011
@@ -3334,11 +3334,12 @@ public class IndexWriter implements Clos
     final int numSegments = merge.readers.size();
     Throwable th = null;
     
+    boolean anyChanges = false;
     boolean drop = !suppressExceptions;
     for (int i = 0; i < numSegments; i++) {
       if (merge.readers.get(i) != null) {
         try {
-          readerPool.release(merge.readers.get(i), drop);
+          anyChanges |= readerPool.release(merge.readers.get(i), drop);
         } catch (Throwable t) {
           if (th == null) {
             th = t;
@@ -3362,11 +3363,15 @@ public class IndexWriter implements Clos
       }
     }
     
-    // If any errors occured, throw it.
+    if (suppressExceptions && anyChanges) {
+      checkpoint();
+    }
+    
+    // If any error occured, throw it.
     if (!suppressExceptions && th != null) {
+      if (th instanceof IOException) throw (IOException) th;
       if (th instanceof RuntimeException) throw (RuntimeException) th;
       if (th instanceof Error) throw (Error) th;
-      // defensive code - we should not hit unchecked exceptions
       throw new RuntimeException(th);
     }
   }