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



##########
File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/SourceOperatorStreamTask.java
##########
@@ -119,9 +113,13 @@ protected void finishTask() throws Exception {
     }
 
     @Override
-    public Future<Boolean> triggerCheckpointAsync(
+    public CompletableFuture<Boolean> triggerCheckpointAsync(
             CheckpointMetaData checkpointMetaData, CheckpointOptions 
checkpointOptions) {
         if (!isExternallyInducedSource) {
+            if (checkpointOptions.getCheckpointType().shouldDrain()) {
+                setSynchronousSavepoint(checkpointMetaData.getCheckpointId(), 
true);
+                mainMailboxExecutor.execute(this::endData, "Drain pipeline on 
stop-with-savepoint");
+            }
             return super.triggerCheckpointAsync(checkpointMetaData, 
checkpointOptions);

Review comment:
       I can't see any problem with it. I did spend some time thinking about 
calling the `endData` from within the `triggerCheckpointAsync`, so that we can 
call it in a single mailbox action. Unfortunately it is not possible without a 
bigger rework of said method. The PR already touches a lot of fragile code and 
I did not want to change even more.
   
   At the same time I don't see a problem if there is something executed in 
between. The only important thing is that one is executed after the other. 
That's the only requirement.




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