LUCENE-1639: fix case where doc stores are incorrectly double opened, thus leaving open file handles after IndexWriter is closed

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@786545 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2009-06-19 15:30:05 +00:00
parent 0b5cbca110
commit ec65df2156
3 changed files with 15 additions and 1 deletions

View File

@ -4829,7 +4829,7 @@ public class IndexWriter {
}
for(int i=0;i<numSegments;i++) {
merge.readersClone[i].openDocStores();
merge.readersClone[i].openDocStores(merge.readers[i]);
}
// Clear DSS

View File

@ -133,6 +133,9 @@ public abstract class MergePolicy {
b.append(" into ").append(info.name);
if (optimize)
b.append(" [optimize]");
if (mergeDocStores) {
b.append(" [mergeDocStores]");
}
return b.toString();
}
}

View File

@ -475,6 +475,17 @@ class SegmentReader extends IndexReader implements Cloneable {
return instance;
}
synchronized void openDocStores(SegmentReader orig) throws IOException {
if (fieldsReaderOrig == null) {
orig.openDocStores();
fieldsReaderOrig = orig.fieldsReaderOrig;
termVectorsReaderOrig = orig.termVectorsReaderOrig;
storeCFSReader = orig.storeCFSReader;
cfsReader = orig.cfsReader;
}
}
synchronized void openDocStores() throws IOException {
if (fieldsReaderOrig == null) {
final Directory storeDir;