Add hadoop-topology module with SwitchableDNSToSwitchMapping and Topo… - #81
Draft
SaadASTheDev wants to merge 1 commit into
Draft
SaadASTheDev wants to merge 1 commit into
SaadASTheDev wants to merge 1 commit into
Conversation
…logyServerDNSToSwitchMapping implementations
SaadASTheDev
commented
Sep 16, 2026
| * to {@link TopologyServerDNSToSwitchMapping} when {@code net.topology.server.enabled} | ||
| * is true, otherwise the stock {@link ScriptBasedMapping}. | ||
| */ | ||
| public class SwitchableDNSToSwitchMapping extends AbstractDNSToSwitchMapping { |
Author
There was a problem hiding this comment.
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
Author
There was a problem hiding this comment.
gonna change this as per the convo
SaadASTheDev
commented
Sep 16, 2026
| super.setConf(conf); | ||
| boolean useServer = conf != null | ||
| && conf.getBoolean(SERVER_ENABLED_KEY, SERVER_ENABLED_DEFAULT); | ||
| if (useServer) { |
Author
There was a problem hiding this comment.
this is the crux of how we switch, read the respective config ans set delegate to the valid class "TopologyServer..." here
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.impland 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 thenet.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.xmlNOTICE
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