zhuzhurk commented on a change in pull request #9902: [FLINK-14363][runtime] 
Prevent vertex from being affected by outdated deployment
URL: https://github.com/apache/flink/pull/9902#discussion_r338394397
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/DefaultScheduler.java
 ##########
 @@ -412,13 +412,17 @@ private static Throwable 
maybeWrapWithNoResourceAvailableException(final Throwab
                };
        }
 
-       private void stopDeployment(final DeploymentHandle deploymentHandle) {
-               cancelExecutionVertex(deploymentHandle.getExecutionVertexId());
+       private void releaseUnassignedSlotIfPresent(final DeploymentHandle 
deploymentHandle) {
                // Canceling the vertex normally releases the slot. However, we 
might not have assigned
                // the slot to the vertex yet.
+               // Only release unassigned slot to guarantee no vertex state 
change happens here.
                deploymentHandle
                        .getLogicalSlot()
-                       .ifPresent(logicalSlot -> 
logicalSlot.releaseSlot(null));
+                       .ifPresent(logicalSlot -> {
+                               if (logicalSlot.getPayload() != null) {
 
 Review comment:
   In simple, if a slot completes the slot request normally, it is always 
assigned to an execution in `DefaultScheduler#assignResourceOrHandleError`, 
unless there is an unexpected error(including assigning failure) which will 
shut down the JM JVM.

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