mirror of https://github.com/apache/lucene.git
Fix TestIndexWriterOnError.testIOError failure. (#13436)
Pull request #13406 inadvertly broke Lucene's handling of tragic exceptions by stopping after the first `DocValuesProducer` whose `close()` calls throws an exception, instead of keeping calling `close()` on further producers in the list. This moves back to the previous behavior. Closes #13434
This commit is contained in:
parent
9a3dbd5dd7
commit
750a7c4d3b
|
@ -20,10 +20,10 @@ import java.io.IOException;
|
|||
import org.apache.lucene.codecs.DocValuesFormat;
|
||||
import org.apache.lucene.codecs.DocValuesProducer;
|
||||
import org.apache.lucene.internal.hppc.LongArrayList;
|
||||
import org.apache.lucene.internal.hppc.LongCursor;
|
||||
import org.apache.lucene.internal.hppc.LongObjectHashMap;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.IOContext;
|
||||
import org.apache.lucene.util.IOUtils;
|
||||
import org.apache.lucene.util.RefCount;
|
||||
|
||||
/**
|
||||
|
@ -76,10 +76,12 @@ final class SegmentDocValues {
|
|||
|
||||
/** Decrement the reference count of the given {@link DocValuesProducer} generations. */
|
||||
synchronized void decRef(LongArrayList dvProducersGens) throws IOException {
|
||||
for (LongCursor gen : dvProducersGens) {
|
||||
RefCount<DocValuesProducer> dvp = genDVProducers.get(gen.value);
|
||||
assert dvp != null : "gen=" + gen;
|
||||
dvp.decRef();
|
||||
}
|
||||
IOUtils.applyToAll(
|
||||
dvProducersGens.stream().mapToObj(Long::valueOf).toList(),
|
||||
gen -> {
|
||||
RefCount<DocValuesProducer> dvp = genDVProducers.get(gen);
|
||||
assert dvp != null : "gen=" + gen;
|
||||
dvp.decRef();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue