dawidwys commented on a change in pull request #16589:
URL: https://github.com/apache/flink/pull/16589#discussion_r679126859



##########
File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/SourceStreamTask.java
##########
@@ -249,10 +248,28 @@ private void interruptSourceThread(boolean interrupt) {
     // ------------------------------------------------------------------------
 
     @Override
-    public Future<Boolean> triggerCheckpointAsync(
+    public CompletableFuture<Boolean> triggerCheckpointAsync(
             CheckpointMetaData checkpointMetaData, CheckpointOptions 
checkpointOptions) {
         if (!externallyInducedCheckpoints) {
-            return super.triggerCheckpointAsync(checkpointMetaData, 
checkpointOptions);
+            if (checkpointOptions.getCheckpointType().shouldDrain()) {
+                mainMailboxExecutor.execute(
+                        () -> {
+                            
setSynchronousSavepoint(checkpointMetaData.getCheckpointId(), true);
+                            wasDrained = true;
+                            if (mainOperator != null) {
+                                mainOperator.stop();
+                            }
+                        },
+                        "stop legacy source and set synchronous savepoint");
+                return sourceThread
+                        .getCompletionFuture()
+                        .thenCompose(
+                                ignore ->
+                                        super.triggerCheckpointAsync(
+                                                checkpointMetaData, 
checkpointOptions));

Review comment:
       Yes, we would time out on the savepoint triggering which should cause 
job failover.




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