zhijiangW commented on a change in pull request #11507: [FLINK-16587] Add basic
CheckpointBarrierHandler for unaligned checkpoint
URL: https://github.com/apache/flink/pull/11507#discussion_r400309436
##########
File path:
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java
##########
@@ -880,6 +893,31 @@ private boolean performCheckpoint(
}
}
+ private void prepareInflightDataSnapshot(long checkpointId) throws
IOException {
+ // For source task we do not have input processor
+ CompletableFuture<?> inputPreparedFuture;
+ if (inputProcessor != null) {
+ inputPreparedFuture =
inputProcessor.prepareSnapshot(checkpointId);
+ } else {
+ inputPreparedFuture =
CompletableFuture.completedFuture(null);
+ }
+
+ ResultPartitionWriter[] writers =
getEnvironment().getAllWriters();
+ for (ResultPartitionWriter writer : writers) {
+ for (int i = 0; i < writer.getNumberOfSubpartitions();
i++) {
+ ResultSubpartition subpartition =
writer.getSubpartition(i);
+ channelStateWriter.addOutputData(
+ checkpointId,
+ subpartition.getSubpartitionInfo(),
+
ChannelStateWriter.SEQUENCE_NUMBER_UNKNOWN,
+
subpartition.getInflightBufferSnapshot().toArray(new Buffer[0]));
+ }
+ }
+
+ // finish channelStateWriter after all input (future) and
output (above block) buffers have been added
+ inputPreparedFuture.thenAccept(unused ->
channelStateWriter.finish(checkpointId));
Review comment:
nit:
```
if (inputProcessor != null) {
inputProcessor.prepareSnapshot(checkpointId).thenAccept(unused
-> channelStateWriter.finish(checkpointId));
} else {
channelStateWriter.finish(checkpointId);
}
```
----------------------------------------------------------------
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]
With regards,
Apache Git Services