AHeise commented on a change in pull request #14008:
URL: https://github.com/apache/flink/pull/14008#discussion_r520602043



##########
File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/BoundedBlockingSubpartitionTest.java
##########
@@ -117,6 +121,34 @@ public void testCloseBoundedData() throws Exception {
                assertTrue(reader.closed);
        }
 
+       @Test
+       public void testRecycleCurrentBufferOnFailure() throws Exception {
+               final ResultPartition resultPartition = 
createPartition(ResultPartitionType.BLOCKING, fileChannelManager);
+               final BoundedBlockingSubpartition subpartition = new 
BoundedBlockingSubpartition(
+                               0,
+                               resultPartition,
+                               new FailingBoundedData(),
+                               !sslEnabled && type == 
BoundedBlockingSubpartitionType.FILE);
+               final BufferConsumer consumer = 
BufferBuilderTestUtils.createFilledFinishedBufferConsumer(100);
+
+               try {
+                       try {
+                               subpartition.add(consumer);
+                               subpartition.createReadView(new 
NoOpBufferAvailablityListener());
+                               fail("should fail with an exception");
+                       } catch (Exception ignored) {
+                               // expected
+                       }
+
+                       assertNotNull(subpartition.getCurrentBuffer());
+                       
assertFalse(subpartition.getCurrentBuffer().isRecycled());
+               } finally {
+                       subpartition.release();
+
+                       assertNull(subpartition.getCurrentBuffer());

Review comment:
       The code is not testing if the buffer is really recycled.
   `assertTrue(subpartition.getCurrentBuffer().isRecycled())`




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