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



##########
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:
       > in this specific case there is no race condition
   
   Why is that? I thought that since the JM runs in an actual actor system 
without a DirectExecutor the processing of the disconnect can happen at some 
point in the future.




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