ifndef-SleePy commented on a change in pull request #11648: 
[FLINK-16945][checkpointing] Execute CheckpointFailureManager.FailJob…
URL: https://github.com/apache/flink/pull/11648#discussion_r405210938
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/ExecutionGraphCheckpointCoordinatorTest.java
 ##########
 @@ -131,9 +142,82 @@ public void testShutdownCheckpointCoordinatorOnFinished() 
throws Exception {
                assertThat(storeShutdownFuture.get(), is(JobStatus.FINISHED));
        }
 
+       /**
+        * The case is designed to check the race condition between {@link 
ExecutionGraph} and
+        * {@link CheckpointCoordinator}. There should be no checkpoint 
accepted after
+        * {@link CheckpointFailureManager} decides to fail the {@link 
ExecutionGraph}.
+        */
+       @Test
+       public void testNoCheckpointAcceptedWhileFailingExecutionGraph() throws 
Exception {
+               CheckpointIDCounter counter = new 
TestingCheckpointIDCounter(new CompletableFuture<>());
+
+               TestingCompletedCheckpointStore store = new 
TestingCompletedCheckpointStore(new CompletableFuture<>());
+
+               final ManuallyTriggeredScheduledExecutor mainThreadExecutor = 
new ManuallyTriggeredScheduledExecutor();
+               ExecutionGraph graph = 
createExecutionGraphAndEnableCheckpointing(
+                       counter,
+                       store,
+                       new 
ComponentMainThreadExecutorServiceAdapter(mainThreadExecutor, 
Thread.currentThread()));
+
+               final CheckpointCoordinator checkpointCoordinator = 
graph.getCheckpointCoordinator();
+
+               assertThat(checkpointCoordinator, Matchers.notNullValue());
+               assertThat(checkpointCoordinator.isShutdown(), is(false));
+
+               graph.scheduleForExecution();
+               ExecutionGraphTestUtils.switchToRunning(graph);
+
+               // trigger a normal checkpoint which would be declined then
+               
checkpointCoordinator.triggerCheckpoint(System.currentTimeMillis(), true);
+               mainThreadExecutor.triggerAll();
+               final long checkpointId = 
checkpointCoordinator.getPendingCheckpoints().keySet().iterator().next();
 
 Review comment:
   sure

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