You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/01/28 08:57:06 UTC

[GitHub] [flink] zentol commented on a change in pull request #18542: [FLINK-25855] Allow JobMaster to accept excess slots when restarting the job

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



##########
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:
       Need to retry this operation because there's no guarantee the jobmaster has processed the disconnect yet.




-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org