lindong28 commented on code in PR #20454: URL: https://github.com/apache/flink/pull/20454#discussion_r941401822
########## flink-runtime/src/main/java/org/apache/flink/runtime/operators/coordination/OperatorCoordinatorHolder.java: ########## @@ -299,9 +352,67 @@ public void resetToCheckpoint(long checkpointId, @Nullable byte[] checkpointData } private void checkpointCoordinatorInternal( - final long checkpointId, final CompletableFuture<byte[]> result) { + long checkpointId, CompletableFuture<byte[]> result) { mainThreadExecutor.assertRunningInMainThread(); + try { + subtaskGatewayMap.forEach( + (subtask, gateway) -> gateway.markForCheckpoint(checkpointId)); + + if (currentPendingCheckpointId != NO_CHECKPOINT + && currentPendingCheckpointId != checkpointId) { + throw new IllegalStateException( + String.format( + "Cannot checkpoint coordinator for checkpoint %d, " + + "since checkpoint %d has already started.", + checkpointId, currentPendingCheckpointId)); + } + + if (latestAttemptedCheckpointId >= checkpointId) { Review Comment: Do we need to do this check inside this try/catch block? -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org