rkhachatryan commented on a change in pull request #14798:
URL: https://github.com/apache/flink/pull/14798#discussion_r570428422



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
##########
@@ -1022,18 +1021,38 @@ private boolean transitionState(ExecutionState 
currentState, ExecutionState newS
         return transitionState(currentState, newState, null);
     }
 
+    /**
+     * Try to transition to FAILED state from a given state and sets the 
{@code failureCause}.
+     *
+     * @param currentState of the execution
+     * @param cause the {@link Throwable} causing the failure
+     * @return true if the transition was successful, otherwise false
+     * @throws NullPointerException if no {@code cause} is provided
+     */
+    private boolean transitionToFailedStateAndSetFailureCause(
+            ExecutionState currentState, Throwable cause) {
+        Preconditions.checkNotNull(cause, "No cause is given when 
transitioning to FAILED state.");
+        failureCause = cause;
+        return transitionState(currentState, ExecutionState.FAILED, cause);

Review comment:
       I think we can't update `failureCause` until we successfully 
transitioned to FAILED state.




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to