flink-issues mailing list archives

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

    https://github.com/apache/flink/pull/4581#discussion_r152944166
  
    --- 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 --
    
    I don't have (too) hard feelings about it, so there it is - along with some more minor
fixes in the tests and one additional test for `AsynchronousBufferFileWriter` itself (the
change there was not covered yet)


---

Mime
View raw message