GeorgeJahad commented on code in PR #3186:
URL: https://github.com/apache/ozone/pull/3186#discussion_r902935042
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java:
##########
@@ -362,33 +362,33 @@ public RegisteredCommand register(
.build();
}
+ InetAddress dnAddress = Server.getRemoteIp();
+ if (dnAddress != null) {
+ // Mostly called inside an RPC, update ip
+ datanodeDetails.setIpAddress(dnAddress.getHostAddress());
+ }
+
+ String dnsName;
+ String networkLocation;
+ datanodeDetails.setNetworkName(datanodeDetails.getUuidString());
+ if (useHostname) {
+ dnsName = datanodeDetails.getHostName();
+ } else {
+ dnsName = datanodeDetails.getIpAddress();
+ }
+ networkLocation = nodeResolve(dnsName);
+ if (networkLocation != null) {
+ datanodeDetails.setNetworkLocation(networkLocation);
+ }
+
if (!isNodeRegistered(datanodeDetails)) {
- InetAddress dnAddress = Server.getRemoteIp();
- if (dnAddress != null) {
- // Mostly called inside an RPC, update ip and peer hostname
- datanodeDetails.setHostName(dnAddress.getHostName());
Review Comment:
> When datanode fist register with scm, the datanodeDetails already
contains hostName. Here the code we are talking about is just to reset the
datanodeDetails.hostName.
If you are sure this is true, then I'm fine with the change.
> To not change the old code path, I added the if condition: when
useHostname is true, we will not setHostname, but when it is false (old code),
I'm confused about this statement. The old code path is when
"(!isNodeRegistered(datanodeDetails))" is true, isn't it? not when
(!useHostname) is true? what am I missing?
--
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]