smengcl opened a new pull request, #8853: URL: https://github.com/apache/hadoop/pull/8853
Generated-by: Claude Code (Opus 5.5) ### Description of PR The NameNode split client supplied DataNode addresses at the first `:` in two places, so IPv6 addresses failed with `NumberFormatException`: - WebHDFS `excludedatanodes` (`NamenodeWebHdfsMethods#chooseDatanode`): the WebHDFS client retries with entries such as `[2001:db8::1]:9864`, and the request failed with 400. - Favored nodes (`DatanodeManager#parseDNFromHostsEntry`, reached from `addBlock`): `DFSClient` sends `2001:db8:0:0:0:0:0:1:9866`, and `addBlock` failed. This adds `DatanodeManager#parseIpv6Address`, used by both. It handles only addresses with more than one `:`: `[addr]:port`, `[addr]`, `addr:port` (split at the last `:` when the prefix is an IP literal) and `addr`, and normalizes the address to the expanded form DataNodes register with. IPv4 addresses and host names take the existing code path unchanged. ### How was this patch tested? - `TestWebHdfsDataLocality#testExcludeIpv6DataNodes`: passes bracketed, plain and portless IPv6 entries plus an IPv4 entry to `chooseDatanode` and checks that all four DataNodes end up in the exclude set. Fails without the fix with `NumberFormatException: For input string: "db8::1]:9866"`. - `TestDatanodeManager#testGetDatanodeDescriptorForIpv4AndIpv6`: checks that `getDatanodeDescriptor` resolves IPv4 with and without a port, and IPv6 as `addr:port`, `[addr]:port`, `[addr]`, `addr` and compressed `[addr]:port`. Fails without the fix with `NumberFormatException`. - `TestDatanodeManager` and `TestWebHdfsDataLocality` pass. Not run on an IPv6 MiniDFSCluster. ### For code changes: - [x] Does the title or this PR starts with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')? - [ ] Object storage: have the integration tests been executed and the endpoint declared according to the connector-specific documentation? - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, `NOTICE-binary` files? 🤖 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]
