zhijiangW commented on a change in pull request #7911: [FLINK-11082][network] Fix the logic of getting backlog in sub partition URL: https://github.com/apache/flink/pull/7911#discussion_r265856906
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/ResultSubpartition.java ########## @@ -118,13 +117,19 @@ protected Throwable getFailureCause() { /** * Gets the number of non-event buffers in this subpartition. - * - * <p><strong>Beware:</strong> This method should only be used in tests in non-concurrent access - * scenarios since it does not make any concurrency guarantees. */ - @VisibleForTesting - public int getBuffersInBacklog() { - return buffersInBacklog; + public abstract int getBuffersInBacklog(); + + /** + * @param lastBufferAvailable whether the last buffer in this subpartition is available for consumption + * @return the number of non-event buffers in this subpartition + */ + protected int getBuffersInBacklog(boolean lastBufferAvailable) { Review comment: Yes, it makes sense to keep the `Unsafe` here consistent with `decreaseBuffersInBacklog`. In another aspect, the existence of `Unsafe` is for distinguishing the different usages compared with `safe`. For `getBuffersInBacklog` there might need only one way for use either `safe` or `Unsafe`. Anyway I am willing to make it `Unsafe` here, then we could avoid explaining it in method comments. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services