Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-5672: Fix addIndexes to call maybeMerge

Robert Muiref0f56211d22
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index e81fad302dc..cc022273484 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -96,7 +96,6 @@ Other
perform as well as other options. (Robert Muir)
======================= Lucene 4.11.0 ======================
-(No Changes)
New Features
@@ -106,6 +105,11 @@ New Features
* LUCENE-5889: Add commit method to AnalyzingInfixSuggester, and allow just using .add
to build up the suggester. (Varun Thacker via Mike McCandless)
+Bug Fixes
+
+* LUCENE-5672: IndexWriter.addIndexes() calls maybeMerge(), to ensure the index stays
+ healthy. If you don't want merging use NoMergePolicy instead. (Robert Muir)
+
======================= Lucene 4.10.0 ======================
New Features
diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
index cf5d22778dc..7f076ec0291 100644
--- a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
@@ -2388,11 +2388,6 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable {
* free space required will be higher by the size of the
* starting index (see {@link #forceMerge(int)} for details).
*
- * <p>
- * <b>NOTE:</b> this method only copies the segments of the incoming indexes
- * and does not merge them. Therefore deleted documents are not removed and
- * the new segments are not merged with the existing ones.
- *
* <p>This requires this index not be among those to be added.
*
* <p>
@@ -2499,6 +2494,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable {
IOUtils.closeWhileHandlingException(locks);
}
}
+ maybeMerge();
}
/**
@@ -2654,6 +2650,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable {
} catch (OutOfMemoryError oom) {
handleOOM(oom, "addIndexes(IndexReader...)");
}
+ maybeMerge();
}
/** Copies the segment files as-is into the IndexWriter's directory. */