tillrohrmann commented on a change in pull request #18542:
URL: https://github.com/apache/flink/pull/18542#discussion_r795687450



##########
File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/jobmaster/JobMasterTest.java
##########
@@ -1816,6 +1819,60 @@ public void 
testJobMasterOnlyTerminatesAfterTheSchedulerHasClosed() throws Excep
         jobMasterTerminationFuture.get();
     }
 
+    @Test
+    public void testJobMasterAcceptsExcessSlotsWhenJobIsRestarting() throws 
Exception {
+        configuration.set(RestartStrategyOptions.RESTART_STRATEGY, 
"fixed-delay");
+        configuration.set(
+                RestartStrategyOptions.RESTART_STRATEGY_FIXED_DELAY_DELAY, 
Duration.ofDays(1));
+        final JobMaster jobMaster =
+                new JobMasterBuilder(jobGraph, rpcService)
+                        .withConfiguration(configuration)
+                        .createJobMaster();
+
+        try {
+            jobMaster.start();
+
+            final JobMasterGateway jobMasterGateway =
+                    jobMaster.getSelfGateway(JobMasterGateway.class);
+
+            assertThat(
+                    jobMasterGateway.requestJobStatus(testingTimeout).get(), 
is(JobStatus.RUNNING));
+
+            final LocalUnresolvedTaskManagerLocation 
unresolvedTaskManagerLocation =
+                    new LocalUnresolvedTaskManagerLocation();
+            registerSlotsAtJobMaster(
+                    1,
+                    jobMasterGateway,
+                    jobGraph.getJobID(),
+                    new TestingTaskExecutorGatewayBuilder()
+                            .setAddress("firstTaskManager")
+                            .createTestingTaskExecutorGateway(),
+                    unresolvedTaskManagerLocation);
+
+            jobMasterGateway.disconnectTaskManager(
+                    unresolvedTaskManagerLocation.getResourceID(),
+                    new FlinkException("Test exception."));
+
+            assertThat(
+                    jobMasterGateway.requestJobStatus(testingTimeout).get(),
+                    is(JobStatus.RESTARTING));

Review comment:
       The `jobMasterGateway` will serialize the messages that are sent over 
it. Hence, the JM will first receive the `disconnectTaskManager` message and 
then the `requestJobStatus`. Since the former message is implemented 
synchronously, the job will be in `RESTARTING` state when `requestJobStatus` is 
being processed.




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to