[ 
https://issues.apache.org/jira/browse/HDDS-14385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18051193#comment-18051193
 ] 

Sammi Chen edited comment on HDDS-14385 at 1/12/26 10:05 AM:
-------------------------------------------------------------

[~weichiu],  below is the code logic involved. The order is 
-  first use NET_TOPOLOGY_NODE_SWITCH_MAPPING_IMPL_KEY to get the class name
-  if  NET_TOPOLOGY_NODE_SWITCH_MAPPING_IMPL_KEY is not defined, use 
TableMapping.class
{code:java}
    Class<? extends DNSToSwitchMapping> dnsToSwitchMappingClass =
        conf.getClass(
            ScmConfigKeys.NET_TOPOLOGY_NODE_SWITCH_MAPPING_IMPL_KEY,
            TableMapping.class, DNSToSwitchMapping.class);
{code}

Since NET_TOPOLOGY_NODE_SWITCH_MAPPING_IMPL_KEY has a default null empty value 
"org.apache.hadoop.net.ScriptBasedMapping", so the fall back to 
TableMapping.class never happens. 
The ScriptBasedMapping is used by default for node network location resolve. 

We can consider use ScriptBasedMapping.class to replace TableMapping.class if 
this will make the code more straightforward for understand.
cc @Attila Doroszlai for a double confirm, 
https://issues.apache.org/jira/browse/HDDS-9674. 




was (Author: sammi):
[~weichiu],  below is the code logic involved. The order is 
-  first use NET_TOPOLOGY_NODE_SWITCH_MAPPING_IMPL_KEY to get the class name
-  if  NET_TOPOLOGY_NODE_SWITCH_MAPPING_IMPL_KEY is not defined, use 
TableMapping.class
{code:java}
    Class<? extends DNSToSwitchMapping> dnsToSwitchMappingClass =
        conf.getClass(
            ScmConfigKeys.NET_TOPOLOGY_NODE_SWITCH_MAPPING_IMPL_KEY,
            TableMapping.class, DNSToSwitchMapping.class);
{code}

Since NET_TOPOLOGY_NODE_SWITCH_MAPPING_IMPL_KEY has a default null empty value 
"org.apache.hadoop.net.ScriptBasedMapping", so the fall back to 
TableMapping.class never happens. 
The ScriptBasedMapping is used by default for node network location resolve. 

cc @Attila Doroszlai for a double confirm, 
https://issues.apache.org/jira/browse/HDDS-9674. 



> Incorrect net.topology.node.switch.mapping.impl default value
> -------------------------------------------------------------
>
>                 Key: HDDS-14385
>                 URL: https://issues.apache.org/jira/browse/HDDS-14385
>             Project: Apache Ozone
>          Issue Type: Bug
>            Reporter: Wei-Chiu Chuang
>            Assignee: Chen-Jheng Sing
>            Priority: Minor
>              Labels: pull-request-available
>
> The default value in the ozone-default.xml for the configuration property 
> net.topology.node.switch.mapping.impl is incorrect.
> {noformat}
>   <property>
>     <name>net.topology.node.switch.mapping.impl</name>
>     <value>org.apache.hadoop.net.ScriptBasedMapping</value>
>     <tag>OZONE, SCM</tag>
>     <description>
>       The default implementation of the DNSToSwitchMapping. It
>       invokes a script specified in net.topology.script.file.name to resolve
>       node names. If the value for net.topology.script.file.name is not set, 
> the
>       default value of DEFAULT_RACK is returned for all node names.
>     </description>
>   </property>
> {noformat}
> Both OM and SCM 's default value is org.apache.hadoop.net.TableMapping:
> https://github.com/apache/ozone/blob/fd8948134efa1e96505d4446d4657f2ad5003396/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManager.java#L729
> https://github.com/apache/ozone/blob/1dda9abfa979f3282d3355e154ce025f76d48665/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java#L365
> cc: [~sammichen] [~sarvekshayr]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to