stevenzwu commented on code in PR #20852:
URL: https://github.com/apache/flink/pull/20852#discussion_r979031935


##########
flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/DispatcherCachedOperationsHandler.java:
##########
@@ -39,30 +40,66 @@ public class DispatcherCachedOperationsHandler {
     private final CompletedOperationCache<AsynchronousJobOperationKey, String>
             savepointTriggerCache;
 
+    private final CompletedOperationCache<AsynchronousJobOperationKey, Long> 
checkpointTriggerCache;
+
+    private final TriggerCheckpointFunction triggerCheckpointFunction;
+
     private final TriggerSavepointFunction triggerSavepointFunction;
 
     private final TriggerSavepointFunction stopWithSavepointFunction;
 
     DispatcherCachedOperationsHandler(
             DispatcherOperationCaches operationCaches,
+            TriggerCheckpointFunction triggerCheckpointFunction,
             TriggerSavepointFunction triggerSavepointFunction,
             TriggerSavepointFunction stopWithSavepointFunction) {
         this(
+                triggerCheckpointFunction,
+                operationCaches.getCheckpointTriggerCache(),
                 triggerSavepointFunction,
                 stopWithSavepointFunction,
                 operationCaches.getSavepointTriggerCache());
     }
 
     @VisibleForTesting
     DispatcherCachedOperationsHandler(
+            TriggerCheckpointFunction triggerCheckpointFunction,
+            CompletedOperationCache<AsynchronousJobOperationKey, Long> 
checkpointTriggerCache,
             TriggerSavepointFunction triggerSavepointFunction,
             TriggerSavepointFunction stopWithSavepointFunction,
             CompletedOperationCache<AsynchronousJobOperationKey, String> 
savepointTriggerCache) {
+        this.triggerCheckpointFunction = triggerCheckpointFunction;
+        this.checkpointTriggerCache = checkpointTriggerCache;
         this.triggerSavepointFunction = triggerSavepointFunction;
         this.stopWithSavepointFunction = stopWithSavepointFunction;
         this.savepointTriggerCache = savepointTriggerCache;
     }
 
+    public CompletableFuture<Acknowledge> triggerCheckpoint(
+            AsynchronousJobOperationKey operationKey,
+            CheckpointBackupType checkpointBackupType,
+            Time timeout) {
+
+        if (!checkpointTriggerCache.containsOperation(operationKey)) {
+            checkpointTriggerCache.registerOngoingOperation(
+                    operationKey,
+                    triggerCheckpointFunction.apply(
+                            operationKey.getJobId(), checkpointBackupType, 
timeout));
+        }
+
+        return CompletableFuture.completedFuture(Acknowledge.get());
+    }
+
+    public CompletableFuture<OperationResult<Long>> getCheckpointStatus(

Review Comment:
   The result type is `Long`. what does the long value result indicate? I 
assume the `Long` type is not meant for checkpoint Id.



-- 
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