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_r338176523
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/DefaultSchedulerTest.java
 ##########
 @@ -335,15 +336,51 @@ public void scheduleOnlyIfVertexIsCreated() throws 
Exception {
                }
        }
 
+       @Test
+       public void vertexIsNotAffectedByOutdatedDeployment() {
+               final JobGraph jobGraph = singleNonParallelJobVertexJobGraph(2);
+
+               testExecutionSlotAllocator.disableAutoCompletePendingRequests();
+               final DefaultScheduler scheduler = 
createSchedulerAndStartScheduling(jobGraph);
+
+               final Iterator<ArchivedExecutionVertex> vertexIterator = 
scheduler.requestJob().getAllExecutionVertices().iterator();
+               final ArchivedExecutionVertex v1 = vertexIterator.next();
+               final ArchivedExecutionVertex v2 = vertexIterator.next();
+
+               final SchedulingExecutionVertex sv1 = 
scheduler.getSchedulingTopology().getVertices().iterator().next();
+
+               // fail v1 and let it recover to SCHEDULED
+               scheduler.updateTaskExecutionState(new TaskExecutionState(
+                       jobGraph.getJobID(),
+                       v1.getCurrentExecutionAttempt().getAttemptId(),
+                       ExecutionState.FAILED));
+               taskRestartExecutor.triggerScheduledTasks();
+
+               // fail v2 to finish all pending slot requests of the last round
+               // in order to trigger the outdated deployment of v1
+               scheduler.updateTaskExecutionState(new TaskExecutionState(
+                       jobGraph.getJobID(),
+                       v2.getCurrentExecutionAttempt().getAttemptId(),
+                       ExecutionState.FAILED));
+
+               // v1 should not be affected
+               assertThat(sv1.getState(), 
is(equalTo(ExecutionState.SCHEDULED)));
+       }
+
        private void waitForTermination(final DefaultScheduler scheduler) 
throws Exception {
                scheduler.getTerminationFuture().get(TIMEOUT_MS, 
TimeUnit.MILLISECONDS);
        }
 
        private static JobGraph singleNonParallelJobVertexJobGraph() {
+               return singleNonParallelJobVertexJobGraph(1);
+       }
+
+       private static JobGraph singleNonParallelJobVertexJobGraph(final int 
parallelism) {
 
 Review comment:
   done.

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