akalash commented on a change in pull request #17024:
URL: https://github.com/apache/flink/pull/17024#discussion_r700028580



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/BufferWritingResultPartition.java
##########
@@ -330,8 +330,16 @@ private BufferBuilder 
appendBroadcastDataForRecordContinuation(
     private void createBroadcastBufferConsumers(BufferBuilder buffer, int 
partialRecordBytes)
             throws IOException {
         try (final BufferConsumer consumer = 
buffer.createBufferConsumerFromBeginning()) {
+            int desirableBufferSize = Integer.MAX_VALUE;
             for (ResultSubpartition subpartition : subpartitions) {
-                subpartition.add(consumer.copy(), partialRecordBytes);
+                int subPartitionBufferSize = subpartition.add(consumer.copy(), 
partialRecordBytes);
+                desirableBufferSize =
+                        subPartitionBufferSize > 0
+                                ? Math.min(desirableBufferSize, 
subPartitionBufferSize)
+                                : desirableBufferSize;
+            }
+            if (desirableBufferSize != Integer.MAX_VALUE) {

Review comment:
       Just a minor comment: it is up to you but this condition is not really 
needed here because buffer.trim(MAX_VALUE) is not a problem it just set the 
buffer size to the maximum possible value which is ok. But it is not a mistake 
if you left this condition 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to