Github user JoshRosen commented on a diff in the pull request: https://github.com/apache/spark/pull/10705#discussion_r53729151 --- Diff: core/src/main/scala/org/apache/spark/CacheManager.scala --- @@ -46,7 +48,14 @@ private[spark] class CacheManager(blockManager: BlockManager) extends Logging { val existingMetrics = context.taskMetrics().registerInputMetrics(blockResult.readMethod) existingMetrics.incBytesReadInternal(blockResult.bytes) - val iter = blockResult.data.asInstanceOf[Iterator[T]] + val iter = { + val dataIter = blockResult.data.asInstanceOf[Iterator[T]] + if (blockResult.readMethod != DataReadMethod.Network) { + CompletionIterator[T, Iterator[T]](dataIter, blockManager.releaseLock(key)) --- End diff -- In 66202f2d7eda4abcf1b315a85f91b43d4424d93e, I updated BlockManager to pass CompletionIterators to BlockResult. This felt a bit cleaner than putting a BlockManager reference into the BlockResult constructor in order to be able to reference it in the completion iterator, although I suppose that I could call SparkEnv.get.blockManager... from the completion iterator's cleanup task instead.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org