You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/09/04 12:44:00 UTC

[jira] [Commented] (FLINK-7513) remove TestBufferFactory#MOCK_BUFFER

    [ https://issues.apache.org/jira/browse/FLINK-7513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16152573#comment-16152573 ] 

ASF GitHub Bot commented on FLINK-7513:
---------------------------------------

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


> remove TestBufferFactory#MOCK_BUFFER
> ------------------------------------
>
>                 Key: FLINK-7513
>                 URL: https://issues.apache.org/jira/browse/FLINK-7513
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Network
>    Affects Versions: 1.4.0
>            Reporter: Nico Kruber
>            Assignee: Nico Kruber
>
> {{TestBufferFactory#MOCK_BUFFER}} is a static buffer in tests and did not allow proper reference counting and we should rather create test buffers in the tests which may also be released afterwards.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)