Github user NicoK commented on a diff in the pull request:
https://github.com/apache/flink/pull/4559#discussion_r157538818
--- Diff:
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/SpillableSubpartitionTest.java
---
@@ -181,10 +182,27 @@ public void testConsumeSpilledPartition() throws
Exception {
partition.add(buffer);
partition.add(buffer);
+ assertEquals(3, partition.getTotalNumberOfBuffers());
+ assertEquals(3, partition.getBuffersInBacklog());
+ assertEquals(4096 * 3, partition.getTotalNumberOfBytes());
+
+ assertFalse(buffer.isRecycled());
assertEquals(3, partition.releaseMemory());
+ // now the buffer may be freed, depending on the timing of the
write operation
+ // -> let's do this check at the end of the test (to save some
time)
+ // still same statistics
+ assertEquals(3, partition.getTotalNumberOfBuffers());
+ assertEquals(3, partition.getBuffersInBacklog());
+ assertEquals(4096 * 3, partition.getTotalNumberOfBytes());
+
partition.finish();
+ // + one EndOfPartitionEvent
+ assertEquals(4, partition.getTotalNumberOfBuffers());
+ assertEquals(3, partition.getBuffersInBacklog());
+ assertEquals(4096 * 3 + 4, partition.getTotalNumberOfBytes());
--- End diff --
good, can you also add the backlog correctness checks to the
`reader.getNextBuffer()` lines below to ensure they are correct after taking
buffers out?
---