pnowojski commented on a change in pull request #11564: [FLINK-16864][metrics]
Add IdleTime metric for task.
URL: https://github.com/apache/flink/pull/11564#discussion_r403043161
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/writer/RecordWriter.java
##########
@@ -276,6 +281,21 @@ protected void checkErroneous() throws IOException {
}
}
+ protected void addBufferConsumer(BufferConsumer consumer, int
targetChannel) throws IOException {
+ targetPartition.addBufferConsumer(consumer, targetChannel);
+ }
+
+ protected BufferBuilder getBufferBuilder() throws IOException,
InterruptedException {
+ BufferBuilder builder;
+ if (!targetPartition.isApproximatelyAvailable()) {
+ long start = System.currentTimeMillis();
+ builder = targetPartition.getBufferBuilder();
+
idleTimeMsPerSecond.markEvent(System.currentTimeMillis() - start);
+ } else {
+ builder = targetPartition.getBufferBuilder();
+ }
+ return builder;
+ }
Review comment:
The thing is that the code might change/evolve over time making this check
even more wrong. Yes now this bug is pretty harmless, but if we can make it
easily completely correct, why not doing it? Proper fix is just ~5 lines of
code in `LocalBufferPool` to provide `LocalBufferPool#requestBufferBuilder`,
maybe 5 more lines `TestPooledBufferProvider`, add the method to the
`BufferPool` interface and proxy/expose it in the `ResultPartition`.
----------------------------------------------------------------
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]
With regards,
Apache Git Services