Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2408#discussion_r17598955
  
    --- Diff: 
core/src/main/scala/org/apache/spark/storage/ShuffleBlockFetcherIterator.scala 
---
    @@ -111,13 +112,21 @@ final class ShuffleBlockFetcherIterator(
         blockTransferService.fetchBlocks(req.address.host, req.address.port, 
blockIds,
           new BlockFetchingListener {
             override def onBlockFetchSuccess(blockId: String, data: 
ManagedBuffer): Unit = {
    -          results.put(new FetchResult(BlockId(blockId), sizeMap(blockId),
    -            () => serializer.newInstance().deserializeStream(
    -              blockManager.wrapForCompression(BlockId(blockId), 
data.inputStream())).asIterator
    -          ))
    -          shuffleMetrics.remoteBytesRead += data.size
    -          shuffleMetrics.remoteBlocksFetched += 1
    -          logDebug("Got remote block " + blockId + " after " + 
Utils.getUsedTimeMs(startTime))
    +          var is: InputStream = null
    +          try {
    +            is = data.inputStream()
    +            results.put(new FetchResult(BlockId(blockId), sizeMap(blockId),
    +              () => serializer.newInstance().deserializeStream(
    +                blockManager.wrapForCompression(BlockId(blockId), 
is)).asIterator
    +            ))
    +            shuffleMetrics.remoteBytesRead += data.size
    --- End diff --
    
    Can these three lines follow the `finally` block? the stream can be closed 
at this point I think.


---
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

Reply via email to