Apache Solr open-source search software
LUCENE-3147: reinstate calling checkpoint() from IW.closeMergeReaders
Shai Ererae8ce61f9db34
diff --git a/lucene/src/java/org/apache/lucene/index/IndexWriter.java b/lucene/src/java/org/apache/lucene/index/IndexWriter.javaindex 2728b9abf8a..057292c7599 100644--- a/lucene/src/java/org/apache/lucene/index/IndexWriter.java+++ b/lucene/src/java/org/apache/lucene/index/IndexWriter.java@@ -3334,11 +3334,12 @@ public class IndexWriter implements Closeable {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 Closeable {}}- // 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 exceptionsthrow new RuntimeException(th);}}