1996fanrui commented on code in PR #22447: URL: https://github.com/apache/flink/pull/22447#discussion_r1175969922
########## flink-runtime/src/test/java/org/apache/flink/runtime/io/network/buffer/LocalBufferPoolTest.java: ########## @@ -878,6 +874,18 @@ private void assertRequestedBufferAndIsAvailable( // Helpers // ------------------------------------------------------------------------ + private static int getNumberRequestedOverdraftBuffers(LocalBufferPool bufferPool) { + return bufferPool.getNumberOfRequestedMemorySegments() > bufferPool.getNumBuffers() + ? bufferPool.getNumberOfRequestedMemorySegments() - bufferPool.getNumBuffers() + : 0; Review Comment: How about this? ```suggestion return Math.max(bufferPool.getNumberOfRequestedMemorySegments() - bufferPool.getNumBuffers(), 0); ``` ########## flink-runtime/src/test/java/org/apache/flink/runtime/io/network/buffer/LocalBufferPoolTest.java: ########## @@ -878,6 +874,18 @@ private void assertRequestedBufferAndIsAvailable( // Helpers // ------------------------------------------------------------------------ + private static int getNumberRequestedOverdraftBuffers(LocalBufferPool bufferPool) { + return bufferPool.getNumberOfRequestedMemorySegments() > bufferPool.getNumBuffers() + ? bufferPool.getNumberOfRequestedMemorySegments() - bufferPool.getNumBuffers() + : 0; + } + + private static int getNumberRequestedOrdinaryBuffers(LocalBufferPool bufferPool) { + return bufferPool.getNumberOfRequestedMemorySegments() > bufferPool.getNumBuffers() + ? bufferPool.getNumBuffers() + : bufferPool.getNumberOfRequestedMemorySegments(); Review Comment: ```suggestion return Math.min(bufferPool.getNumBuffers(), bufferPool.getNumberOfRequestedMemorySegments()); ``` -- 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. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org