public Integer findNode(DatanodeDescriptor node) { Integer retVal = rackNodesMap.get(node.getHostName()); if (retVal == null) { retVal = rackNodesMap.get(node.getName()); if (retVal == null) { retVal = rackNodesMap.get(node.getHost()); if (retVal == null) { LOG.info("Didn't find " + node.getHostName() + " - " + node.getName() + " - " + node.getHost()); } } } return retVal; } }
private void resolveNetworkLocation (DatanodeDescriptor node) { List<String> names = new ArrayList<String>(1); if (dnsToSwitchMapping instanceof CachedDNSToSwitchMapping) { // get the node's IP address names.add(node.getHost()); } else { // get the node's host name String hostName = node.getHostName(); int colon = hostName.indexOf(":"); hostName = (colon==-1)?hostName:hostName.substring(0,colon); names.add(hostName); } // resolve its network location List<String> rName = dnsToSwitchMapping.resolve(names); String networkLocation; if (rName == null) { LOG.error("The resolve call returned null! Using " + NetworkTopology.DEFAULT_RACK + " for host " + names); networkLocation = NetworkTopology.DEFAULT_RACK; } else { networkLocation = rName.get(0); } node.setNetworkLocation(networkLocation); }
/** * Returned information is a JSON representation of map with host name as the * key and value is a map of dead node attribute keys to its values */ @Override // NameNodeMXBean public String getDeadNodes() { final Map<String, Map<String, Object>> info = new HashMap<String, Map<String, Object>>(); final ArrayList<DatanodeDescriptor> liveNodeList = new ArrayList<DatanodeDescriptor>(); final ArrayList<DatanodeDescriptor> deadNodeList = new ArrayList<DatanodeDescriptor>(); // we need to call DFSNodeStatus to filter out the dead data nodes DFSNodesStatus(liveNodeList, deadNodeList); removeDecommissionedNodeFromList(deadNodeList); for (DatanodeDescriptor node : deadNodeList) { final Map<String, Object> innerinfo = new HashMap<String, Object>(); innerinfo.put("lastContact", getLastContact(node)); innerinfo.put("decommissioned", node.isDecommissioned()); innerinfo.put("excluded", this.inExcludedHostsList(node, null)); info.put(node.getHostName() + ":" + node.getPort(), innerinfo); } return JSON.toString(info); }
/** * Returned information is a JSON representation of map with host name as the * key and value is a map of decomisioning node attribute keys to its values */ @Override // NameNodeMXBean public String getDecomNodes() { final Map<String, Map<String, Object>> info = new HashMap<String, Map<String, Object>>(); final ArrayList<DatanodeDescriptor> decomNodeList = this.getDecommissioningNodes(); for (DatanodeDescriptor node : decomNodeList) { final Map<String, Object> innerinfo = new HashMap<String, Object>(); innerinfo.put("underReplicatedBlocks", node.decommissioningStatus .getUnderReplicatedBlocks()); innerinfo.put("decommissionOnlyReplicas", node.decommissioningStatus .getDecommissionOnlyReplicas()); innerinfo.put("underReplicateInOpenFiles", node.decommissioningStatus .getUnderReplicatedInOpenFiles()); info.put(node.getHostName() + ":" + node.getPort(), innerinfo); } return JSON.toString(info); }
mustList.remove(dn.getHostName());
/** * Returned information is a JSON representation of map with host name as the * key and value is a map of live node attribute keys to its values */ @Override // NameNodeMXBean public String getLiveNodes() { final Map<String, Map<String,Object>> info = new HashMap<String, Map<String,Object>>(); final ArrayList<DatanodeDescriptor> liveNodeList = new ArrayList<DatanodeDescriptor>(); final ArrayList<DatanodeDescriptor> deadNodeList = new ArrayList<DatanodeDescriptor>(); DFSNodesStatus(liveNodeList, deadNodeList); removeDecommissionedNodeFromList(liveNodeList); for (DatanodeDescriptor node : liveNodeList) { final Map<String, Object> innerinfo = new HashMap<String, Object>(); innerinfo.put("lastContact", getLastContact(node)); innerinfo.put("usedSpace", getDfsUsed(node)); innerinfo.put("adminState", node.getAdminState().toString()); innerinfo.put("excluded", this.inExcludedHostsList(node, null)); info.put(node.getHostName() + ":" + node.getPort(), innerinfo); } return JSON.toString(info); }
mustList.remove(dn.getHostName()); mustList.remove(dn.getHostName() + ":" + dn.getPort()); if (!isDead && listLiveNodes && this.inHostsList(dn, null)) { nodes.add(dn);