TanYuxin-tyx commented on code in PR #23851: URL: https://github.com/apache/flink/pull/23851#discussion_r1472472085
########## flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/BufferManager.java: ########## @@ -132,16 +134,44 @@ private boolean shouldContinueRequest(BufferPool bufferPool) { } } - /** Requests exclusive buffers from the provider. */ - void requestExclusiveBuffers(int numExclusiveBuffers) throws IOException { - checkArgument(numExclusiveBuffers >= 0, "Num exclusive buffers must be non-negative."); - if (numExclusiveBuffers == 0) { - return; + private void resizeBufferQueue() { + SingleInputGate inputGate = inputChannel.inputGate; + int currentSize = inputGate.getBufferPool().getNumBuffers(); + int numRemoteChannels = + inputGate.getNumberOfInputChannels() - inputGate.getNumberOfLocalInputChannels(); + if (numRemoteChannels == 0) { + numExclusiveBuffers = 0; + } else if (currentSize > 1 && currentSize != bufferPoolSize) { + int targetExclusivePerChannel = + Math.min(initialCredit, (currentSize - 1) / numRemoteChannels); Review Comment: Why do we `currentSize - 1` here? -- 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