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

    https://github.com/apache/flink/pull/4590#discussion_r136814158
  
    --- Diff: 
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/consumer/RemoteInputChannelTest.java
 ---
    @@ -55,19 +58,25 @@ public void testExceptionOnReordering() throws 
Exception {
                // Setup
                final SingleInputGate inputGate = mock(SingleInputGate.class);
                final RemoteInputChannel inputChannel = 
createRemoteInputChannel(inputGate);
    +           final Buffer buffer = TestBufferFactory.createBuffer();
    +           buffer.retain(); // used twice
    --- End diff --
    
    inline `buffer.retain()` into second usage:
    
    ```
    inputChannel.onBuffer(buffer, 0);
    
    // This does not yet throw the exception, but sets the error at the channel.
    inputChannel.onBuffer(buffer.retain(), 29);
    ```
    
    Because now it's a little bit unclear where/how/who is using using buffer 
second time. With inlining that will become obvious (and you even do not have 
to modify `retain()` method to return `this`, because someone already did that 
neat self documenting trick :) )


---

Reply via email to