flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnowojski <...@git.apache.org>
Subject [GitHub] flink pull request #4581: [FLINK-7499][io] fix double buffer release in Spil...
Date Thu, 23 Nov 2017 16:18:51 GMT
Github user pnowojski commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4581#discussion_r152829734
  
    --- Diff: flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/SpillableSubpartitionTest.java
---
    @@ -320,4 +559,40 @@ void awaitNotifications(long awaitedNumNotifiedBuffers, long timeoutMillis)
thro
     			}
     		}
     	}
    +
    +	/**
    +	 * An {@link IOManagerAsync} that creates closed {@link BufferFileWriter} instances
in its
    +	 * {@link #createBufferFileWriter(FileIOChannel.ID)} method.
    +	 *
    +	 * <p>These {@link BufferFileWriter} objects will thus throw an exception when
trying to add
    +	 * write requests, e.g. by calling {@link BufferFileWriter#writeBlock(Object)}.
    +	 */
    +	private static class IOManagerAsyncWithClosedBufferFileWriter extends IOManagerAsync
{
    +		@Override
    +		public BufferFileWriter createBufferFileWriter(FileIOChannel.ID channelID)
    +				throws IOException {
    +			BufferFileWriter bufferFileWriter = super.createBufferFileWriter(channelID);
    +			bufferFileWriter.close();
    +			return bufferFileWriter;
    +		}
    +	}
    +
    +	/**
    +	 * An {@link IOManagerAsync} that creates stalling {@link BufferFileWriter} instances
in its
    +	 * {@link #createBufferFileWriter(FileIOChannel.ID)} method.
    +	 *
    +	 * <p>These {@link BufferFileWriter} objects will accept {@link BufferFileWriter#writeBlock(Object)}
    +	 * requests but never actually perform any write operation (be sure to clean up the
buffers
    +	 * manually!).
    +	 */
    +	private static class IOManagerAsyncWithStallingBufferFileWriter extends IOManagerAsync
{
    +		@Override
    +		public BufferFileWriter createBufferFileWriter(FileIOChannel.ID channelID)
    +			throws IOException {
    +			BufferFileWriter bufferFileWriter = spy(super.createBufferFileWriter(channelID));
    --- End diff --
    
    again, why mockito? It's terrible for debugging and completely fails with refactoring
(like added new overloaded method `BlockChannelWriterWithCallback::writeBlock` or changing
signatures). Especially that at the same time overloading returning here anonymous class overloading
`AsynchronousBufferFileWriter`, that replaces `writeBlock` with empty method is just as easy
:(


---

Mime
View raw message