Hexiaoqiao commented on code in PR #9027:
URL: https://github.com/apache/hadoop/pull/9027#discussion_r4715566587
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/CombinedHostFileManager.java:
##########
@@ -192,12 +216,27 @@ private void refresh(final String hostsFile, final int
readTimeout) throws IOExc
InetSocketAddress addr = parseEntry(hostsFile,
properties.getHostName(), properties.getPort());
if (addr != null) {
- hostProps.add(addr.getAddress(), properties);
+ hostProps.add(addr.getAddress(), properties,
+ otherAddressesOf(addr.getAddress()));
}
}
refresh(hostProps);
}
+ /**
+ * @return the host's other addresses, e.g. its IPv6 address for an entry
+ * given as an IPv4 literal.
+ */
+ private static Collection<InetAddress> otherAddressesOf(InetAddress addr) {
+ try {
+ return
Arrays.stream(InetAddress.getAllByName(addr.getCanonicalHostName()))
+ .filter(a -> !a.equals(addr)).collect(Collectors.toList());
Review Comment:
Will this involve more performance issues? We need to reverse and forward
DNS which is very time-cost operation and it is inner the global write lock
when #refreshNodes, especially there are many hosts/ips in host config files. I
mean we should be careful to add some time-cost operation here.
Moreover, do we need to consider loopback address here?
Thanks.
--
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]