benwtrent commented on code in PR #13436:
URL: https://github.com/apache/lucene/pull/13436#discussion_r1619307513


##########
lucene/core/src/java/org/apache/lucene/index/SegmentDocValues.java:
##########
@@ -76,10 +76,12 @@ synchronized DocValuesProducer getDocValuesProducer(
 
   /** 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();
+        });

Review Comment:
   My only minor concern is that this reverts the minor improvement of using 
primitive values. But, it fixes a much bigger issue. I am fine with reverting 
only this part of the optimization that caused the bug.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to