hevinhsu commented on code in PR #10598:
URL: https://github.com/apache/ozone/pull/10598#discussion_r3643135588
##########
hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java:
##########
@@ -698,14 +771,32 @@ protected List<HddsDatanodeService> createHddsDatanodes()
for (int i = 0; i < numOfDatanodes; i++) {
OzoneConfiguration dnConf = dnFactory.apply(conf);
+ if (hosts != null) {
+ dnConf.set(HddsConfigKeys.HDDS_DATANODE_HOST_NAME_KEY, hosts[i]);
+ }
+ // Bypass InetAddress.getName() resolution for custom hostnames by
starting DN via YAML.
+ confDatanodeViaYaml(dnConf);
Review Comment:
This looks like the same problem as `StaticMapping#resolve`.
During Datanode startup, `DatanodeDetails` attempts to set its `ipAddress`
via
[`validateDatanodeIpAddress()`](https://github.com/apache/ozone/blob/master/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/HddsDatanodeService.java#L252).
If there is no existing `DatanodeDetails` (i.e., not imported from a yaml
file), the `ipAddress` may initially be null. When a custom hostname is set in
the configuration, resolving it via
[`InetAddress.getByName()`](https://github.com/apache/ozone/blob/master/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/protocol/DatanodeDetails.java#L181)
may throw an `UnknownHostException`. Although the exception is caught and
logged, the `ipAddress` remains null (since it was never successfully set).
This can prevent the Datanode from successfully connecting to and registering
with SCM, which in turn causes `MiniOzoneCluster.waitForClusterToBeReady` to
time out.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]