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

   Generated-by: Claude Code (Opus 5.5)
   
   ### Description of PR
   
   When no bind host is set, `NameNodeRpcServer` bound the client, service and 
lifeline RPC servers to `getHostName()` of the configured address. For an IP 
literal this is the reverse DNS name, and `Server.Listener` then binds the 
first address of that name, which can be the other address family. With 
`[::1]:0` on a host whose `/etc/hosts` maps `localhost` to both `127.0.0.1` and 
`::1`, the NameNode listened on `127.0.0.1` only. The advertised address 
(written into the NameNode's own `fs.defaultFS` and used by `MiniDFSCluster` 
and `startTrashEmptier`) was rebuilt from the same name.
   
   This change:
   
   - Binds to `getHostString()`, which is the configured literal or host name 
and never a reverse lookup.
   - Advertises the reverse name of a literal only if it resolves back to the 
configured address. Otherwise the advertised `InetSocketAddress` is created 
with the literal as its host name, so later `getHostName()` calls (for example 
`DFSUtilClient.getNNUri`, which brackets it since HDFS-18000) do not do the 
reverse lookup again.
   
   Host name configurations are unchanged, since `getHostString()` and 
`getHostName()` both return the configured name. `127.0.0.1` still binds 
`127.0.0.1` and is still advertised as `localhost`, which the existing tests 
rely on.
   
   ### How was this patch tested?
   
   - `TestMiniDFSCluster#testBindHostIPv6Loopback`: removed the assumption that 
`::1` round trips through its reverse name, which was there only because of 
this bug. With `java.net.preferIPv4Stack=false` (set locally in the surefire 
config, macOS, JDK 17), it fails without the fix with `expected: 
</0:0:0:0:0:0:0:1> but was: <localhost/127.0.0.1>` and passes with it. CI pins 
`preferIPv4Stack=true`, so it is skipped there as before.
   - `TestMiniDFSCluster`, `TestNameNodeRpcServer`, 
`TestNameNodeRespectsBindHostKeys`, `TestClientNameNodeAddress`, `TestDFSUtil`, 
`TestGetConf` and `TestNameNodeReconfigure` pass with the default settings.
   - The dual stack case with a real PTR record (IPv4 first) was not run on a 
NameNode.
   
   ### 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]

Reply via email to