Github user NicoK commented on a diff in the pull request: https://github.com/apache/flink/pull/4509#discussion_r153441043 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/RemoteInputChannel.java --- @@ -306,12 +306,10 @@ public void recycle(MemorySegment segment) { ExceptionUtils.rethrow(t); } } - - bufferQueue.addExclusiveBuffer(new Buffer(segment, this)); - floatingBufferRecycled = bufferQueue.maintainTargetSize(numRequiredBuffers); + numAddedBuffers = bufferQueue.addExclusiveBuffer(new Buffer(segment, this), numRequiredBuffers); } - if (!floatingBufferRecycled && unannouncedCredit.getAndAdd(1) == 0) { + if (numAddedBuffers > 0 && unannouncedCredit.getAndAdd(1) == 0) { --- End diff -- shouldn't this be `if (numAddedBuffers > 0 && unannouncedCredit.getAndAdd(numAddedBuffers) == 0) {` now? (although we only use 0 or 1 as return values for now)
---