zhijiangW commented on a change in pull request #11515: [FLINK-16744][task] implement channel state persistence for unaligned checkpoints URL: https://github.com/apache/flink/pull/11515#discussion_r401530563
########## File path: flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/SubtaskCheckpointCoordinatorImpl.java ########## @@ -97,24 +123,26 @@ public void checkpointState( // Step (3): Take the state snapshot. This should be largely asynchronous, to not // impact progress of the streaming topology - CheckpointStreamFactory storage = checkpointStorage.resolveCheckpointStorageLocation( - checkpointMetaData.getCheckpointId(), - checkpointOptions.getTargetLocation()); - long startSyncPartNano = System.nanoTime(); HashMap<OperatorID, OperatorSnapshotFutures> operatorSnapshotsInProgress = new HashMap<>(operatorChain.getNumberOfOperators()); + ChannelStateWriteResult channelStateWriteResult = + checkpointOptions.getCheckpointType() == CHECKPOINT ? channelStateWriter.getWriteResult(checkpointMetaData.getCheckpointId()) : + ChannelStateWriteResult.EMPTY; try { for (StreamOperatorWrapper<?, ?> operatorWrapper : operatorChain.getAllOperators(true)) { - StreamOperator<?> op = operatorWrapper.getStreamOperator(); - OperatorSnapshotFutures snapshotInProgress = checkpointStreamOperator( - op, - checkpointMetaData, - checkpointOptions, - storage, - isCanceled); - operatorSnapshotsInProgress.put(op.getOperatorID(), snapshotInProgress); + operatorSnapshotsInProgress.put( + operatorWrapper.getStreamOperator().getOperatorID(), + buildOperatorSnapshotFutures( + checkpointMetaData, + checkpointOptions, + operatorChain, + operatorWrapper.getStreamOperator(), + isCanceled, + channelStateWriteResult) + ); } + checkpointStorage.clearCacheFor(checkpointMetaData.getCheckpointId()); Review comment: nit: I prefer to extracting `checkpointStorage.resolveCheckpointStorageLocation` from `buildOperatorSnapshotFutures` and put it before `for` loop, then it is easy to trace both the creation and clear actions in the same page. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services