gaoyunhaii commented on a change in pull request #16184:
URL: https://github.com/apache/flink/pull/16184#discussion_r669555440



##########
File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/SourceStreamTask.java
##########
@@ -158,7 +158,16 @@ protected void 
processInput(MailboxDefaultAction.Controller controller) throws E
         // compatibility reasons with the current source interface (source 
functions run as a loop,
         // not in steps).
         sourceThread.setTaskDescription(getName());
-        sourceThread.start();
+
+        if (operatorChain.isFinishedOnRestore()) {
+            LOG.debug(
+                    "Legacy source {} skip execution since the task is 
finished on restore",
+                    getTaskNameWithSubtaskAndId());
+            sourceThread.getCompletionFuture().complete(null);

Review comment:
       Hi Dawid~ I think previously the `mailbox.suspend` is still done after 
the future completed since it is register to the future with `whenComplete` ? 
Perhaps we might have some code duplicate if we directly suspend the mailbox 
for the finished case since here we would still need to complete the future, 
which would already trigger the `whenComplete` stage and suspend the mailbox 
with the current implementation~?




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