kylemeow commented on a change in pull request #13706:
URL: https://github.com/apache/flink/pull/13706#discussion_r510138597
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/jobmaster/JobMasterTest.java
##########
@@ -916,6 +918,56 @@ public void testCheckpointPrecedesSavepointRecovery()
throws Exception {
}
}
+ /**
+ * Tests that the JobMaster does not retrieve TaskManager host name
during registration,
+ * so that no reverse DNS lookups would be performed.
+ */
+ @Test
+ public void testDoNotRetrieveTaskManagerHostName() throws Exception {
+ final JobGraph restartingJobGraph =
createSingleVertexJobWithRestartStrategy();
+
+
configuration.setBoolean(JobManagerOptions.RETRIEVE_TASK_MANAGER_HOSTNAME,
false);
+
+ final JobMaster jobMaster = createJobMaster(
+ configuration,
+ restartingJobGraph,
+ haServices,
+ new
TestingJobManagerSharedServicesBuilder().build(),
+ heartbeatServices);
+
+ final JobMasterGateway jobMasterGateway =
jobMaster.getSelfGateway(JobMasterGateway.class);
+ final TestingTaskExecutorGateway taskExecutorGateway = new
TestingTaskExecutorGatewayBuilder()
+ .setSubmitTaskConsumer((tdd, ignored) ->
CompletableFuture.completedFuture(Acknowledge.get()))
+ .setAddress("127.0.0.1:42")
+ .createTestingTaskExecutorGateway();
+
+ rpcService.registerGateway(taskExecutorGateway.getAddress(),
taskExecutorGateway);
+
+ try {
+ jobMaster.start(JobMasterId.generate()).get();
+
+ final LocalUnresolvedTaskManagerLocation
taskManagerUnresolvedLocation = new LocalUnresolvedTaskManagerLocation();
+
+ RegistrationResponse registrationResult =
jobMasterGateway.registerTaskManager(taskExecutorGateway.getAddress(),
taskManagerUnresolvedLocation, testingTimeout).get();
+ Map<ResourceID, Tuple2<TaskManagerLocation,
TaskExecutorGateway>> registeredTaskManagers =
jobMaster.getRegisteredTaskManagers();
+
+ assertTrue(registrationResult instanceof
JMTMRegistrationSuccess);
+ assertEquals(1, registeredTaskManagers.size());
+
+ TaskManagerLocation taskManagerLocation =
registeredTaskManagers.values().iterator().next().f0;
+
+ assertNotNull(taskManagerLocation.getHostname());
+ assertNotNull(taskManagerLocation.getFQDNHostname());
+ assertNotNull(taskManagerLocation.toString());
+
+
assertTrue(taskManagerLocation.getHostname().contains("127.0.0.1"));
+
assertTrue(taskManagerLocation.getFQDNHostname().contains("127.0.0.1"));
+
assertTrue(taskManagerLocation.toString().contains("127.0.0.1"));
+ } finally {
+ RpcUtils.terminateRpcEndpoint(jobMaster,
testingTimeout);
+ }
+ }
Review comment:
Hi~ I have removed this test case along with the newly-added public
method in JobMaster class.
----------------------------------------------------------------
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]