Skip to content

Add hadoop-topology module with SwitchableDNSToSwitchMapping and Topo… - #81

Draft
SaadASTheDev wants to merge 1 commit into
hubspot-3.3.6from
TopologyJavaClient
Draft

SaadASTheDev wants to merge 1 commit into
hubspot-3.3.6from
TopologyJavaClient

Conversation

@SaadASTheDev

@SaadASTheDev SaadASTheDev commented Sep 16, 2026 •

Copy link
Copy Markdown

In order to work with the topology server (the sidecar), the NameNode needs a way to resolve rack topology by calling it over HTTP rather than forking the topology script. This is done with two classes: SwitchableDNSToSwitchMapping, which the NameNode is pointed at via net.topology.node.switch.mapping.impl and which dispatches to either the stock forked topology script (ScriptBasedMapping) or the topology server so the NameNode resolves agnostically, and TopologyServerDNSToSwitchMapping, the class it delegates to for the server path that actually makes the HTTP GET call to the sidecar. The choice between the two is driven by the net.topology.server.enabled flag: false, the default, keeps the stock script behavior, and true routes lookups to the server so enabling it or rolling back is just a flag flip rather than a config-class change. Caching and default-rack fallback are unchanged from the script path: they stay in the NameNode via Hadoop's CachedDNSToSwitchMapping, and the server itself holds no cache. The topology server is then enabled via net.topology.server.enabled=true, set in hdfs-site.xml

NOTICE

Please create an issue in ASF JIRA before opening a pull request,
and you need to set the title of the pull request which starts with
the corresponding JIRA issue number. (e.g. HADOOP-XXXXX. Fix a typo in YYY.)
For more details, please see https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute

…logyServerDNSToSwitchMapping implementations
* to {@link TopologyServerDNSToSwitchMapping} when {@code net.topology.server.enabled}
* is true, otherwise the stock {@link ScriptBasedMapping}.
*/
public class SwitchableDNSToSwitchMapping extends AbstractDNSToSwitchMapping {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SwitchableDNS uses the mentioned config overide to point to this class for script vs server delegation, or else the class would default to script only

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gonna change this as per the convo

super.setConf(conf);
boolean useServer = conf != null
&& conf.getBoolean(SERVER_ENABLED_KEY, SERVER_ENABLED_DEFAULT);
if (useServer) {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the crux of how we switch, read the respective config ans set delegate to the valid class "TopologyServer..." here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant