lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1394464 - /lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
Date Fri, 05 Oct 2012 12:01:23 GMT
Author: mikemccand
Date: Fri Oct  5 12:01:23 2012
New Revision: 1394464

URL: http://svn.apache.org/viewvc?rev=1394464&view=rev
Log:
LUCENE-4456: close merged readers first, then checkpoint

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

Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java?rev=1394464&r1=1394463&r2=1394464&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java Fri Oct
 5 12:01:23 2012
@@ -3211,15 +3211,27 @@ public class IndexWriter implements Clos
       deleter.deleteNewFiles(merge.info.files());
     }
 
-    // Must note the change to segmentInfos so any commits
-    // in-flight don't lose it (IFD will incRef/protect the
-    // new files we created):
-    checkpoint();
-
-    // Must close before checkpoint, otherwise IFD won't be
-    // able to delete the held-open files from the merge
-    // readers:
-    closeMergeReaders(merge, false);
+    boolean success = false;
+    try {
+      // Must close before checkpoint, otherwise IFD won't be
+      // able to delete the held-open files from the merge
+      // readers:
+      closeMergeReaders(merge, false);
+      success = true;
+    } finally {
+      // Must note the change to segmentInfos so any commits
+      // in-flight don't lose it (IFD will incRef/protect the
+      // new files we created):
+      if (success) {
+        checkpoint();
+      } else {
+        try {
+          checkpoint();
+        } catch (Throwable t) {
+          // Ignore so we keep throwing original exception.
+        }
+      }
+    }
 
     deleter.deletePendingFiles();
 



Mime
View raw message