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

   Generated-by: Claude Code (Opus 5.5)
   
   ### Description of PR
   
   `MiniDFSCluster` hardcodes `127.0.0.1` for the NameNode and DataNode 
addresses, so an HDFS test cannot start a cluster on the IPv6 loopback.
   
   This PR adds `MiniDFSCluster.Builder#bindHost`, defaulting to `127.0.0.1` so 
existing tests are unchanged. Each address is built with 
`NetUtils.getHostPortString(host, port)`, which brackets an IPv6 host. 
`MiniDFSClusterWithNodeGroup` uses the same host for `dfs.datanode.hostname`.
   
   Starting a NameNode with `fs.defaultFS=hdfs://[::1]:0` also failed on trunk, 
independent of the test harness: `NameNodeUtils.getClientNamenodeAddress` 
parsed the port with `split(":")[1]` and threw `NumberFormatException: For 
input string: ""`. It now takes the port after the last colon outside the 
brackets.
   
   Note: the NameNode RPC and HTTP servers bind to 
`InetSocketAddress#getHostName()` of the configured address, so for `::1` they 
listen on whatever `::1` reverse resolves to (usually `localhost`). The 
NameNode therefore ends up on `::1` only when that name resolves to `::1` 
first, for example with `java.net.preferIPv6Addresses=true` as proposed in 
HADOOP-20030. The new test checks for that and skips otherwise.
   
   A file write and read on an IPv6 cluster still fails because of HADOOP-20027 
(`DatanodeID` builds `0:0:0:0:0:0:0:1:port` without brackets), so that end to 
end test belongs with the HADOOP-20027 fix.
   
   Sub-task of HADOOP-11890.
   
   ### How was this patch tested?
   
   Added `TestMiniDFSCluster#testBindHostIPv6Loopback`: starts a cluster with 
`bindHost("::1")`, checks the NameNode RPC and DataNode transfer addresses are 
`::1`, and does a `mkdirs` and `exists` round trip. It is skipped when the JVM 
is pinned to IPv4, which is the default surefire setting. Added 
`TestClientNameNodeAddress#testIPv6` for `[::1]:100`, `[::1]:0` and `[::1]`.
   
   With JDK 17 in `hadoop-hdfs`:
   * Default build: `TestMiniDFSCluster`, `TestClientNameNodeAddress`, 
`TestRemoteNameNodeInfo`, `TestBalancerWithNodeGroup` pass (the new IPv6 test 
is skipped).
   * `-Djava.net.preferIPv4Stack=false -Djava.net.preferIPv6Addresses=true`: 
`testBindHostIPv6Loopback` and `TestClientNameNodeAddress` pass. Without the 
`NameNodeUtils` change the IPv6 test fails with the `NumberFormatException` 
above.
   
   ### For code changes:
   
   - [x] Does the title of this PR start 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? *Note: 
Automated CI
         testing doesn't cover all cases so manual testing with cloud storage 
is still
         required.*
   - [ ] 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?
   
   ### AI Tooling
   
   Contains content generated by Claude Code.
   
   - [x] The PR includes the phrase "Contains content generated by <tool>"
         where <tool> is the name of the AI tool used.
   - [x] My use of AI contributions follows the ASF legal policy
         https://www.apache.org/legal/generative-tooling.html
   
   🤖 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