ijuma commented on code in PR #20768:
URL: https://github.com/apache/kafka/pull/20768#discussion_r2483898264


##########
core/src/main/scala/kafka/server/DelayedFetch.scala:
##########
@@ -154,9 +154,9 @@ class DelayedFetch(
    * Upon completion, read whatever data is available and pass to the complete 
callback
    */
   override def onComplete(): Unit = {
-    val fetchInfos = fetchPartitionStatus.map { case (tp, status) =>
+    val fetchInfos = fetchPartitionStatus.asScala.iterator.map { case (tp, 
status) =>
       tp -> status.fetchInfo
-    }
+    }.toBuffer
 
     val logReadResults = replicaManager.readFromLog(

Review Comment:
   Iterators can be exhausted and hence are a bit more brittle. I would only 
use them as a method parameter if there is a meaningful difference in 
performance.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to