smengcl opened a new pull request, #9027:
URL: https://github.com/apache/hadoop/pull/9027

   Generated-by: Claude Code (Opus 5.5)
   
   JIRA: https://issues.apache.org/jira/browse/HDFS-18046
   
   ### Description of PR
   
   `CombinedHostFileManager` keys each hosts file entry by the single address 
it resolves to, and looks a DataNode up by the address it registered from. On a 
dual-stack cluster these can be different addresses of the same host. With a 
hosts file that lists IPv4 literals and JVMs that prefer IPv6, every DataNode 
registers over IPv6 and the NameNode rejects it as "not in the include-list". 
Upgrade domain and maintenance lookups miss the same way, and 
`getDatanodeListForReport` also reports the listed address as a separate dead 
node.
   
   This patch:
   
   - records each entry's other host addresses 
(`InetAddress.getAllByName(addr.getCanonicalHostName())`) as aliases of the 
entry, and uses them for the include, exclude, upgrade domain and maintenance 
lookups. An explicit entry for an address always wins over an alias.
   - adds `HostConfigManager#getHostsFileAddress(DatanodeID)` (default: the 
resolved address, so `HostFileManager` is unchanged) and uses it in 
`DatanodeManager#getDatanodeListForReport` to match a registered node to its 
entry.
   
   A host that resolves to a single address gets no aliases, so it behaves as 
before. Loading the hosts file now does one extra lookup per entry (reverse, 
then forward); a failed lookup just leaves the entry without aliases.
   
   ### How was this patch tested?
   
   - New unit tests in `TestHostFileManager`: an entry matched by another 
address of its host, and an explicit entry winning over an alias.
   - `TestHostFileManager`, `TestHostsFiles`, `TestDatanodeReport`, 
`TestCombinedHostsFileReader`, `TestUpgradeDomainBlockPlacementPolicy`, 
`TestMaintenanceState` pass locally.
   - Tested on a 16 node Kerberos/TLS dual-stack cluster with HA NameNodes 
where the combined hosts file lists IPv4 literals and every JVM prefers IPv6: 
all DataNodes register and the datanode report is correct.
   
   ### For code changes:
   
   - [x] Does the title of this PR start with the corresponding JIRA issue id 
(e.g. 'HADOOP-17799. Your PR title ...')?
   
   ### AI Tooling
   
   - [x] The PR includes the phrase "Contains content generated by Claude Code".
   - [x] My use of AI contributions follows the ASF legal policy 
https://www.apache.org/legal/generative-tooling.html
   
   Contains content generated by Claude Code.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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]

Reply via email to