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

    https://github.com/apache/flink/pull/6254#discussion_r200245464
  
    --- Diff: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/RemoteInputChannel.java
 ---
    @@ -594,22 +626,22 @@ public String getMessage() {
                }
     
                /**
    -            * Adds an exclusive buffer (back) into the queue and recycles 
one floating buffer if the
    +            * Adds an exclusive buffer (back) into the queue and removes 
one floating buffer if the
                 * number of available buffers in queue is more than the 
required amount.
                 *
                 * @param buffer The exclusive buffer to add
                 * @param numRequiredBuffers The number of required buffers
                 *
    -            * @return How many buffers were added to the queue
    +            * @return How many buffers were added to the queue (<tt>0</tt> 
or <tt>1</tt>) and the
    +            *         floating buffer which was removed and should be 
released (outside!)
                 */
    -           int addExclusiveBuffer(Buffer buffer, int numRequiredBuffers) {
    +           Tuple2<Integer, Optional<Buffer>> addExclusiveBuffer(Buffer 
buffer, int numRequiredBuffers) {
                        exclusiveBuffers.add(buffer);
                        if (getAvailableBufferSize() > numRequiredBuffers) {
    --- End diff --
    
    For more strict, `getAvailableBufferSize() > numRequiredBuffers` should be 
`getAvailableBufferSize() == numRequiredBuffers + 1`? 
    Otherwise, it may be understood the number of available buffers may exceed 
more than required buffers, but we only return one floating buffer each time. 
Actually it can only more than one in our design. Maybe it is out of this jira, 
and you can ignore it.


---

Reply via email to