Siyao Meng created HADOOP-20072:
-----------------------------------

             Summary: TableMapping never matches IPv6 entries written in 
compressed form
                 Key: HADOOP-20072
                 URL: https://issues.apache.org/jira/browse/HADOOP-20072
             Project: Hadoop Common
          Issue Type: Sub-task
          Components: net
            Reporter: Siyao Meng


{{CachedDNSToSwitchMapping#resolve}} normalizes every name with 
{{NetUtils.normalizeHostName}}, which returns {{InetAddress#getHostAddress}}. 
For IPv6 that is the full form without zero compression, for example 
{{2001:db8:0:0:0:0:0:10}}. {{TableMapping}} then looks the name up with an 
exact string match ({{RawTableMapping#resolve}}), and its keys are kept exactly 
as written in the table file.

So an entry in the usual compressed form ([RFC 
5952|https://datatracker.ietf.org/doc/html/rfc5952]), such as {{2001:db8::10}}, 
never matches, whichever form the caller passes. The node quietly falls back to 
{{/default-rack}}. Only the full form works.

h3. Reproduction (3.4.3)

Table file:
{noformat}
2001:db8::10 /rack1
10.0.0.5 /rack2
{noformat}

{code:java}
tableMapping.resolve(Arrays.asList("2001:db8::10", "2001:db8:0:0:0:0:0:10", 
"10.0.0.5"));
// [/default-rack, /default-rack, /rack2]
{code}

With {{2001:db8:0:0:0:0:0:10 /rack1}} in the file instead, the first two 
resolve to {{/rack1}}.

h3. Impact

Rack awareness for nodes registered by IPv6 address: HDFS datanodes, and Ozone 
datanodes and clients (SCM and OM resolve through the same mapping). 
{{ScriptBasedMapping}} passes the same full form to the topology script, so 
scripts have to expect it too.

h3. Proposal

When loading the table in {{RawTableMapping#load}}, normalize keys that are IP 
literals to the same form the lookup uses (for example 
{{InetAddresses.forString(key).getHostAddress()}}), without DNS lookups. Leave 
other keys as they are. Add a test with compressed and full-form IPv6 entries.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to