[
https://issues.apache.org/jira/browse/MAPREDUCE-7549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18137757#comment-18137757
]
ASF GitHub Bot commented on MAPREDUCE-7549:
-------------------------------------------
smengcl opened a new pull request, #8920:
URL: https://github.com/apache/hadoop/pull/8920
Generated-by: Claude Code (Opus 5.5)
JIRA: https://issues.apache.org/jira/browse/MAPREDUCE-7549
### Description of PR
`TaskAttemptImpl.resolveHosts` resolves split hosts that are IP literals to
host names, so they match the host the NodeManager registers. `isIP` only
matched IPv4, so an IPv6 literal split host such as `2001:db8::21` was kept as
is, while the NodeManager registers `2001:db8:0:0:0:0:0:21` or its PTR name.
The strings never match, so the request is never node local and the locality
counters are wrong.
This patch makes `isIP` also accept IPv6 literals through
`InetAddresses.isInetAddress`. The existing IPv4 regex stays, so IPv4 behavior
does not change (Guava alone would reject leading zero octets such as
`010.1.1.1`, which the regex accepts).
### How was this patch tested?
Added `TestTaskAttempt#testResolveHostsIPv6Literal`: an IPv4 literal and an
IPv6 literal split host are both passed to `resolveHost`, and a host name is
not. Without the fix the IPv6 literal is returned unresolved and the test
fails. `TestTaskAttempt` passes locally.
### 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?
- [ ] 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
- [x] The PR includes the phrase "Contains content generated by Claude Code
(Opus 5.5)".
- [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 (Opus 5.5).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
> TaskAttemptImpl.isIP ignores IPv6 literals, so IPv6 split hosts lose data
> locality
> ----------------------------------------------------------------------------------
>
> Key: MAPREDUCE-7549
> URL: https://issues.apache.org/jira/browse/MAPREDUCE-7549
> Project: Hadoop Map/Reduce
> Issue Type: Bug
> Components: mr-am
> Reporter: Siyao Meng
> Assignee: Siyao Meng
> Priority: Minor
> Labels: ipv6
>
> [TaskAttemptImpl.java:1876|https://github.com/apache/hadoop/blob/1097744bc490b65cad5ab2fbeafff35687971357/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java#L1876]:
> {code:java}
> private static final Pattern ipPattern = // Pattern for matching ip
> Pattern.compile("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}");
> {code}
> {{resolveHosts}} resolves IPv4 split hosts to host names through
> {{resolveHost}}, but passes IPv6 literals through unchanged. The NodeManager
> registers its host as {{getCanonicalHostName()}}: either the PTR name, or the
> full form {{2001:db8:0:0:0:0:0:21}}. A split host given as {{2001:db8::21}}
> matches neither. The RM scheduler and {{RMContainerAllocator}} match hosts as
> strings, so the request is never node-local, and the locality counters are
> wrong.
> This needs split hosts that are IPv6 literals, for example with
> {{dfs.datanode.hostname}} set to a literal or a non-HDFS {{InputFormat}}. The
> default DataNode host name uses the same {{getCanonicalHostName()}} form as
> the NodeManager. Nothing fails; only locality is lost.
> Verified by running the pattern and
> {{InetAddress.getByName(..).getHostName()}} on JDK 21; with no PTR record the
> result is the full form, which equals the NodeManager's host. Locality was
> not measured on a cluster.
> *Proposed fix:* use {{InetAddresses.isInetAddress(src)}} in {{isIP}}, so IPv6
> literals go through {{resolveHost}} like IPv4.
> Related to YARN-1226 (short name compared with FQDN), which has a different
> cause.
> POC:
> https://github.com/smengcl/hadoop/commit/f149887a2d7fc2ef9949d3daba413e9a1962fe55
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]