yunfengzhou-hub commented on code in PR #20454:
URL: https://github.com/apache/flink/pull/20454#discussion_r1003186637


##########
flink-runtime/src/main/java/org/apache/flink/runtime/operators/coordination/OperatorCoordinatorHolder.java:
##########
@@ -207,25 +241,43 @@ public void close() throws Exception {
     public void handleEventFromOperator(int subtask, int attemptNumber, 
OperatorEvent event)
             throws Exception {
         mainThreadExecutor.assertRunningInMainThread();
-        if (event instanceof AcknowledgeCheckpointEvent) {
+
+        if (event instanceof AcknowledgeCloseGatewayEvent) {
+            Preconditions.checkArgument(
+                    subtask == ((AcknowledgeCloseGatewayEvent) 
event).getSubtaskIndex());
+            completeAcknowledgeCloseGatewayFuture(
+                    ((AcknowledgeCloseGatewayEvent) event).getCheckpointID(), 
subtask);
+            return;
+        } else if (event instanceof OpenGatewayEvent) {
+            Preconditions.checkArgument(subtask == ((OpenGatewayEvent) 
event).getSubtaskIndex());
             subtaskGatewayMap
                     .get(subtask)
-                    .openGatewayAndUnmarkCheckpoint(
-                            ((AcknowledgeCheckpointEvent) 
event).getCheckpointID());
+                    .openGatewayAndUnmarkCheckpoint(((OpenGatewayEvent) 
event).getCheckpointID());
             return;
         }
+
         coordinator.handleEventFromOperator(subtask, attemptNumber, event);
     }
 
     public void executionAttemptFailed(int subtask, int attemptNumber, 
@Nullable Throwable reason) {
         mainThreadExecutor.assertRunningInMainThread();
+
+        if (!context.isConcurrentExecutionAttemptsSupported()) {
+            abortAcknowledgeCloseGatewayFutures(
+                    x -> x.f1 == subtask, String.format("Subtask %d has 
failed.", subtask), reason);
+        }
+
         coordinator.executionAttemptFailed(subtask, attemptNumber, reason);
     }
 
     @Override
     public void subtaskReset(int subtask, long checkpointId) {
         mainThreadExecutor.assertRunningInMainThread();
 
+        if (!context.isConcurrentExecutionAttemptsSupported()) {
+            checkNoSuchAcknowledgeCloseGatewayFutures(x -> x.f1 == subtask);

Review Comment:
   You are right. I had assumed that `sutaskReset` would always be invoked 
after `executionAttemptFailed`, while this is not guaranteed by JavaDoc. I'll 
change it to `abortAcknowledgeCloseGatewayFutures`.



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