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

    https://github.com/apache/spark/pull/17744#discussion_r113323069
  
    --- Diff: 
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockHandler.java
 ---
    @@ -93,14 +92,25 @@ protected void handleMessage(
             OpenBlocks msg = (OpenBlocks) msgObj;
             checkAuth(client, msg.appId);
     
    -        List<ManagedBuffer> blocks = Lists.newArrayList();
    -        long totalBlockSize = 0;
    -        for (String blockId : msg.blockIds) {
    -          final ManagedBuffer block = blockManager.getBlockData(msg.appId, 
msg.execId, blockId);
    -          totalBlockSize += block != null ? block.size() : 0;
    -          blocks.add(block);
    -        }
    -        long streamId = streamManager.registerStream(client.getClientId(), 
blocks.iterator());
    +        Iterator<ManagedBuffer> iter = new Iterator<ManagedBuffer>() {
    +          private int index = 0;
    +
    +          @Override
    +          public boolean hasNext() {
    +            return index < msg.blockIds.length;
    +          }
    +
    +          @Override
    +          public ManagedBuffer next() {
    +            final ManagedBuffer block = 
blockManager.getBlockData(msg.appId, msg.execId,
    +              msg.blockIds[index]);
    --- End diff --
    
    I need to look more to verify, but I don't think you can hang onto the msg 
here without duplicating it.  TransportRequestHandler.processRpcRequest is 
going to release the request so I think it could get reused.  @rxin can perhaps 
verify.


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