pnowojski commented on a change in pull request #12120:
URL: https://github.com/apache/flink/pull/12120#discussion_r425390633



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/channel/ChannelStateWriteRequest.java
##########
@@ -46,8 +47,23 @@ static CheckpointInProgressRequest completeOutput(long 
checkpointId) {
                return new CheckpointInProgressRequest("completeOutput", 
checkpointId, ChannelStateCheckpointWriter::completeOutput, false);
        }
 
-       static ChannelStateWriteRequest write(long checkpointId, 
InputChannelInfo info, Buffer... flinkBuffers) {
-               return new CheckpointInProgressRequest("writeInput", 
checkpointId, writer -> writer.writeInput(info, flinkBuffers), 
recycle(flinkBuffers), false);
+       static ChannelStateWriteRequest write(long checkpointId, 
InputChannelInfo info, CloseableIterator<Buffer> iterator) {
+               return new CheckpointInProgressRequest(
+                       "writeInput",
+                       checkpointId,
+                       writer -> {
+                               try {
+                                       while (iterator.hasNext()) {
+                                               Buffer buffer = iterator.next();
+                                               
checkArgument(buffer.isBuffer());
+                                               writer.writeInput(info, buffer);
+                                       }
+                               } finally {
+                                       iterator.close();
+                               }
+                       },
+                       throwable -> iterator.close(),

Review comment:
       are you sure this won't be called twice? Or if it will, that it will not 
double release the buffers/files?




----------------------------------------------------------------
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:
[email protected]


Reply via email to