Github user pnowojski commented on a diff in the pull request:
https://github.com/apache/flink/pull/4559#discussion_r152008221
--- Diff:
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/SpillableSubpartitionView.java
---
@@ -145,6 +145,10 @@ public Buffer getNextBuffer() throws IOException,
InterruptedException {
listener.notifyBuffersAvailable(1);
}
+ if (current.isBuffer()) {
--- End diff --
This logic is a copy/paste with `SpilledSubpartitionView` and
`PipelinedSubpartition`. It gets even more complicated in next PR.
How about changing `ResultSubpartitionView` to an abstract class with
`ResultSubpartition parent` field and following methods:
```
Buffer getNextBuffer() throws IOException, InterruptedException {
Buffer next = getNextBufferInternal();
if (buffer != null) {
parent.decreaseStatistics(buffer);
}
return next;
}
protected abstract Buffer getNextBufferInternal() throws IOException,
InterruptedException;
```
And rename all current implementations of `getNextBuffer` to
`getNextBufferInternal`.
Thus:
1. You wouldn't have to reimplement and handle decrementing in many places,
but only one
2. `protected int backlog;` field from `ResultSubpartition` could be made
private.
---