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

    https://github.com/apache/spark/pull/21593#discussion_r196933769
  
    --- Diff: 
common/network-common/src/main/java/org/apache/spark/network/protocol/MessageWithHeader.java
 ---
    @@ -137,30 +137,15 @@ protected void deallocate() {
       }
     
       private int copyByteBuf(ByteBuf buf, WritableByteChannel target) throws 
IOException {
    -    ByteBuffer buffer = buf.nioBuffer();
    -    int written = (buffer.remaining() <= NIO_BUFFER_LIMIT) ?
    -      target.write(buffer) : writeNioBuffer(target, buffer);
    +    // SPARK-24578: cap the sub-region's size of returned nio buffer to 
improve the performance
    +    // for the case that the passed-in buffer has too many components.
    +    int length = Math.min(buf.readableBytes(), NIO_BUFFER_LIMIT);
    +    ByteBuffer buffer = buf.nioBuffer(buf.readerIndex(), length);
    --- End diff --
    
    this pr is fixing a pretty serious issue, we know Wenbo is going to roll 
this out immediately, and I suspect even more users will.  this fix is also 
"obviously correct" -- the followup here is not super complicated, but also 
will be more prone to bugs.  So I'm inclined to just get this in.
    
    anyway if @WenboZhao can do the other part today, then sure, but I think we 
should get this in quickly.


---

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

Reply via email to