LUCENE-2618: make sure optimize merge complete even if a close is pending

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1026336 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2010-10-22 14:13:54 +00:00
parent 8b4c80f04b
commit 25828363ec
1 changed files with 2 additions and 1 deletions

View File

@ -3662,10 +3662,11 @@ public class IndexWriter implements Closeable {
// This merge (and, generally, any change to the // This merge (and, generally, any change to the
// segments) may now enable new merges, so we call // segments) may now enable new merges, so we call
// merge policy & update pending merges. // merge policy & update pending merges.
if (success && !merge.isAborted() && !closed && !closing) if (success && !merge.isAborted() && (merge.optimize || (!closed && !closing))) {
updatePendingMerges(merge.maxNumSegmentsOptimize, merge.optimize); updatePendingMerges(merge.maxNumSegmentsOptimize, merge.optimize);
} }
} }
}
} catch (OutOfMemoryError oom) { } catch (OutOfMemoryError oom) {
handleOOM(oom, "merge"); handleOOM(oom, "merge");
} }