You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2024/05/29 20:08:16 UTC
(lucene) branch main updated: Fix TestIndexWriterOnError.testIOError failure. (#13436)
This is an automated email from the ASF dual-hosted git repository.
jpountz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/main by this push:
new 750a7c4d3b3 Fix TestIndexWriterOnError.testIOError failure. (#13436)
750a7c4d3b3 is described below
commit 750a7c4d3b3e174023404bf363861dae31413901
Author: Adrien Grand <jp...@gmail.com>
AuthorDate: Wed May 29 22:08:10 2024 +0200
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
---
.../src/java/org/apache/lucene/index/SegmentDocValues.java | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/lucene/core/src/java/org/apache/lucene/index/SegmentDocValues.java b/lucene/core/src/java/org/apache/lucene/index/SegmentDocValues.java
index 82caf6ab0ef..ef2f832946d 100644
--- a/lucene/core/src/java/org/apache/lucene/index/SegmentDocValues.java
+++ b/lucene/core/src/java/org/apache/lucene/index/SegmentDocValues.java
@@ -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();
+ });
}
}