pnowojski commented on a change in pull request #13614:
URL: https://github.com/apache/flink/pull/13614#discussion_r508271579



##########
File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/ResultPartitionTest.java
##########
@@ -526,6 +526,44 @@ public void testFlushBoundedBlockingResultPartition() 
throws IOException {
                assertNull(readView2.getNextBuffer());
        }
 
+       @Test
+       public void testEmitRecordWithRecordSpanningMultipleBuffers() throws 
Exception {
+               BufferWritingResultPartition bufferWritingResultPartition = 
createResultPartition(ResultPartitionType.PIPELINED);
+               PipelinedSubpartition pipelinedSubpartition = 
(PipelinedSubpartition) bufferWritingResultPartition.subpartitions[0];
+               int partialLength = bufferSize / 3;
+
+               try {
+                       // emit the first record, record length = partialLength
+                       
bufferWritingResultPartition.emitRecord(ByteBuffer.allocate(partialLength), 0);
+                       // emit the second record, record length = bufferSize
+                       
bufferWritingResultPartition.emitRecord(ByteBuffer.allocate(bufferSize), 0);
+               } finally {
+                       assertEquals(2, 
pipelinedSubpartition.getCurrentNumberOfBuffers());
+                       assertEquals(0, 
pipelinedSubpartition.getNextBuffer().getPartialRecordLength());

Review comment:
       Ok I get it now, thanks for the explanation. I missed that 
`view.pollBuffer()` is doing much more. If you think it's valuable to have this 
unit tested in `ResultPartitionTest`, then such `@VisibleForTesting` method is 
ok 👍 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to