From 9f973b6988e82d1afe3c963879022cbd3c843e3f Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Wed, 19 May 2010 18:37:21 +0000 Subject: [PATCH] add comment git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@946330 13f79535-47bb-0310-9956-ffa450edef68 --- lucene/src/java/org/apache/lucene/index/IndexWriter.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lucene/src/java/org/apache/lucene/index/IndexWriter.java b/lucene/src/java/org/apache/lucene/index/IndexWriter.java index a3baa2e2b37..2833f6533df 100644 --- a/lucene/src/java/org/apache/lucene/index/IndexWriter.java +++ b/lucene/src/java/org/apache/lucene/index/IndexWriter.java @@ -4401,6 +4401,15 @@ public class IndexWriter implements Closeable { if (mergeDocStores && !merge.mergeDocStores) { merge.mergeDocStores = true; synchronized(this) { + + // If 1) we must now merge doc stores, and 2) at + // least one of the segments we are merging uses + // the doc store we are now writing to, we must at + // this point force this doc store closed (by + // calling flush). If we didn't do this then the + // readers will attempt to open an IndexInput + // on files that have still-open IndexOutputs + // against them: if (dss.contains(docWriter.getDocStoreSegment())) { if (infoStream != null) message("now flush at mergeMiddle");