GJL commented on a change in pull request #10014: [FLINK-12526] Remove 
STATE_UPDATER in ExecutionGraph
URL: https://github.com/apache/flink/pull/10014#discussion_r339997839
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java
 ##########
 @@ -1362,16 +1356,12 @@ private boolean transitionState(JobStatus current, 
JobStatus newState, Throwable
                }
 
                // now do the actual state transition
-               if (STATE_UPDATER.compareAndSet(this, current, newState)) {
-                       LOG.info("Job {} ({}) switched from state {} to {}.", 
getJobName(), getJobID(), current, newState, error);
+               state = newState;
+               LOG.info("Job {} ({}) switched from state {} to {}.", 
getJobName(), getJobID(), current, newState, error);
 
-                       stateTimestamps[newState.ordinal()] = 
System.currentTimeMillis();
-                       notifyJobStatusChange(newState, error);
-                       return true;
-               }
-               else {
-                       return false;
-               }
+               stateTimestamps[newState.ordinal()] = 
System.currentTimeMillis();
+               notifyJobStatusChange(newState, error);
+               return true;
 
 Review comment:
   We cannot always set `newState` and return `true`. 
   
   `current` is meant to be the expected current state. There are plenty of 
places where we throw `IllegalStateException` if the expected state does not 
match. For example 
https://github.com/apache/flink/blob/b7cd6a984750d7dd98e6408f3703b1978b14355a/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java#L985-L986

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to