/** * Resolve a node's network location. If the DNS to switch mapping fails * then this method guarantees default rack location. * @param node to resolve to network location * @return network location path */ private String resolveNetworkLocationWithFallBackToDefaultLocation ( DatanodeID node) { String networkLocation; try { networkLocation = resolveNetworkLocation(node); } catch (UnresolvedTopologyException e) { LOG.error("Unresolved topology mapping. Using " + NetworkTopology.DEFAULT_RACK + " for host " + node.getHostName()); networkLocation = NetworkTopology.DEFAULT_RACK; } return networkLocation; }
nodeS.setNetworkLocation(resolveNetworkLocation(nodeS)); nodeS.setDependentHostNames(getNetworkDependencies(nodeS)); } else { nodeDescr.setNetworkLocation(resolveNetworkLocation(nodeDescr)); nodeDescr.setDependentHostNames(getNetworkDependencies(nodeDescr)); } else {
nodeS.setNetworkLocation(resolveNetworkLocation(nodeS)); nodeS.setDependentHostNames(getNetworkDependencies(nodeS)); } else { nodeDescr.setNetworkLocation(resolveNetworkLocation(nodeDescr)); nodeDescr.setDependentHostNames(getNetworkDependencies(nodeDescr)); } else {
/** * Resolve clientmachine address to get a network location path */ static Node getClientNode(BlockManager bm, String clientMachine) { List<String> hosts = new ArrayList<>(1); hosts.add(clientMachine); List<String> rName = bm.getDatanodeManager() .resolveNetworkLocation(hosts); Node clientNode = null; if (rName != null) { // Able to resolve clientMachine mapping. // Create a temp node to findout the rack local nodes clientNode = new NodeBase(rName.get(0) + NodeBase.PATH_SEPARATOR_STR + clientMachine); } return clientNode; }
nodeS.setNetworkLocation(resolveNetworkLocation(nodeS)); nodeS.setDependentHostNames(getNetworkDependencies(nodeS)); } else { nodeDescr.setNetworkLocation(resolveNetworkLocation(nodeDescr)); nodeDescr.setDependentHostNames(getNetworkDependencies(nodeDescr)); } else {
/** * Resolve a node's network location. If the DNS to switch mapping fails, * then this method throws UnresolvedTopologyException. * @param node to resolve to network location * @return network location path. * @throws UnresolvedTopologyException if the DNS to switch mapping fails * to resolve network location. */ private String resolveNetworkLocation (DatanodeID node) throws UnresolvedTopologyException { List<String> names = new ArrayList<>(1); if (dnsToSwitchMapping instanceof CachedDNSToSwitchMapping) { names.add(node.getIpAddr()); } else { names.add(node.getHostName()); } List<String> rName = resolveNetworkLocation(names); String networkLocation; if (rName == null) { LOG.error("The resolve call returned null!"); throw new UnresolvedTopologyException( "Unresolved topology mapping for host " + node.getHostName()); } else { networkLocation = rName.get(0); } return networkLocation; }
/** * Resolve a node's network location. If the DNS to switch mapping fails * then this method guarantees default rack location. * @param node to resolve to network location * @return network location path */ private String resolveNetworkLocationWithFallBackToDefaultLocation ( DatanodeID node) { String networkLocation; try { networkLocation = resolveNetworkLocation(node); } catch (UnresolvedTopologyException e) { LOG.error("Unresolved topology mapping. Using " + NetworkTopology.DEFAULT_RACK + " for host " + node.getHostName()); networkLocation = NetworkTopology.DEFAULT_RACK; } return networkLocation; }
private Node getClientNode(String clientMachine) { List<String> hosts = new ArrayList<String>(1); hosts.add(clientMachine); List<String> rName = getBlockManager().getDatanodeManager() .resolveNetworkLocation(hosts); Node clientNode = null; if (rName != null) { // Able to resolve clientMachine mapping. // Create a temp node to findout the rack local nodes clientNode = new NodeBase(rName.get(0) + NodeBase.PATH_SEPARATOR_STR + clientMachine); } return clientNode; }
private Node getClientNode(String clientMachine) { List<String> hosts = new ArrayList<String>(1); hosts.add(clientMachine); List<String> rName = getBlockManager().getDatanodeManager() .resolveNetworkLocation(hosts); Node clientNode = null; if (rName != null) { // Able to resolve clientMachine mapping. // Create a temp node to findout the rack local nodes clientNode = new NodeBase(rName.get(0) + NodeBase.PATH_SEPARATOR_STR + clientMachine); } return clientNode; }
/** * Resolve a node's network location. If the DNS to switch mapping fails * then this method guarantees default rack location. * @param node to resolve to network location * @return network location path */ private String resolveNetworkLocationWithFallBackToDefaultLocation ( DatanodeID node) { String networkLocation; try { networkLocation = resolveNetworkLocation(node); } catch (UnresolvedTopologyException e) { LOG.error("Unresolved topology mapping. Using " + NetworkTopology.DEFAULT_RACK + " for host " + node.getHostName()); networkLocation = NetworkTopology.DEFAULT_RACK; } return networkLocation; }
/** * Resolve a node's network location. If the DNS to switch mapping fails, * then this method throws UnresolvedTopologyException. * @param node to resolve to network location * @return network location path. * @throws UnresolvedTopologyException if the DNS to switch mapping fails * to resolve network location. */ private String resolveNetworkLocation (DatanodeID node) throws UnresolvedTopologyException { List<String> names = new ArrayList<String>(1); if (dnsToSwitchMapping instanceof CachedDNSToSwitchMapping) { names.add(node.getIpAddr()); } else { names.add(node.getHostName()); } List<String> rName = resolveNetworkLocation(names); String networkLocation; if (rName == null) { LOG.error("The resolve call returned null!"); throw new UnresolvedTopologyException( "Unresolved topology mapping for host " + node.getHostName()); } else { networkLocation = rName.get(0); } return networkLocation; }
/** * Resolve a node's network location. If the DNS to switch mapping fails, * then this method throws UnresolvedTopologyException. * @param node to resolve to network location * @return network location path. * @throws UnresolvedTopologyException if the DNS to switch mapping fails * to resolve network location. */ private String resolveNetworkLocation (DatanodeID node) throws UnresolvedTopologyException { List<String> names = new ArrayList<String>(1); if (dnsToSwitchMapping instanceof CachedDNSToSwitchMapping) { names.add(node.getIpAddr()); } else { names.add(node.getHostName()); } List<String> rName = resolveNetworkLocation(names); String networkLocation; if (rName == null) { LOG.error("The resolve call returned null!"); throw new UnresolvedTopologyException( "Unresolved topology mapping for host " + node.getHostName()); } else { networkLocation = rName.get(0); } return networkLocation; }