Siyao Meng created MAPREDUCE-7549:
-------------------------------------
Summary: 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
[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
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]