mirror of https://github.com/apache/lucene.git
don't close segment private doc producers during merge
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1143855 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3d5532d75b
commit
3ad65686e5
|
@ -574,12 +574,12 @@ final class SegmentMerger {
|
||||||
final List<Bits> perDocBits = new ArrayList<Bits>();
|
final List<Bits> perDocBits = new ArrayList<Bits>();
|
||||||
final List<Integer> perDocBitsStarts = new ArrayList<Integer>();
|
final List<Integer> perDocBitsStarts = new ArrayList<Integer>();
|
||||||
int docBase = 0;
|
int docBase = 0;
|
||||||
try {
|
for (IndexReader r : readers) {
|
||||||
for(IndexReader r : readers) {
|
|
||||||
final int maxDoc = r.maxDoc();
|
final int maxDoc = r.maxDoc();
|
||||||
final PerDocValues producer = r.perDocValues();
|
final PerDocValues producer = r.perDocValues();
|
||||||
if (producer != null) {
|
if (producer != null) {
|
||||||
perDocSlices.add(new ReaderUtil.Slice(docBase, maxDoc, perDocProducers.size()));
|
perDocSlices.add(new ReaderUtil.Slice(docBase, maxDoc, perDocProducers
|
||||||
|
.size()));
|
||||||
perDocProducers.add(producer);
|
perDocProducers.add(producer);
|
||||||
perDocBits.add(r.getLiveDocs());
|
perDocBits.add(r.getLiveDocs());
|
||||||
perDocBitsStarts.add(docBase);
|
perDocBitsStarts.add(docBase);
|
||||||
|
@ -588,23 +588,23 @@ final class SegmentMerger {
|
||||||
}
|
}
|
||||||
perDocBitsStarts.add(docBase);
|
perDocBitsStarts.add(docBase);
|
||||||
if (!perDocSlices.isEmpty()) {
|
if (!perDocSlices.isEmpty()) {
|
||||||
mergeState.multiLiveDocs = new MultiBits(perDocBits, perDocBitsStarts, true);
|
mergeState.multiLiveDocs = new MultiBits(perDocBits, perDocBitsStarts,
|
||||||
|
true);
|
||||||
final PerDocConsumer docsConsumer = codec
|
final PerDocConsumer docsConsumer = codec
|
||||||
.docsConsumer(new PerDocWriteState(segmentWriteState));
|
.docsConsumer(new PerDocWriteState(segmentWriteState));
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
final MultiPerDocValues multiPerDocValues = new MultiPerDocValues(perDocProducers
|
final MultiPerDocValues multiPerDocValues = new MultiPerDocValues(
|
||||||
.toArray(PerDocValues.EMPTY_ARRAY), perDocSlices
|
perDocProducers.toArray(PerDocValues.EMPTY_ARRAY),
|
||||||
.toArray(ReaderUtil.Slice.EMPTY_ARRAY));
|
perDocSlices.toArray(ReaderUtil.Slice.EMPTY_ARRAY));
|
||||||
docsConsumer.merge(mergeState, multiPerDocValues);
|
docsConsumer.merge(mergeState, multiPerDocValues);
|
||||||
success = true;
|
success = true;
|
||||||
} finally {
|
} finally {
|
||||||
IOUtils.closeSafely(!success, docsConsumer);
|
IOUtils.closeSafely(!success, docsConsumer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
/* don't close the perDocProducers here since they are private segment producers
|
||||||
IOUtils.closeSafely(false, perDocProducers);
|
* and will be closed once the SegmentReader goes out of scope */
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private MergeState mergeState;
|
private MergeState mergeState;
|
||||||
|
|
Loading…
Reference in New Issue