[ https://issues.apache.org/jira/browse/HDFS-2167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13068895#comment-13068895 ]
Tsz Wo (Nicholas), SZE commented on HDFS-2167: ---------------------------------------------- Let me revert the my change on getDatanodeListForReport(..) and post the code below for making the change later. {code} /** For generating datanode reports */ public List<DatanodeDescriptor> getDatanodeListForReport( final DatanodeReportType type) { final boolean listLiveNodes = type == DatanodeReportType.ALL || type == DatanodeReportType.LIVE; final boolean listDeadNodes = type == DatanodeReportType.ALL || type == DatanodeReportType.DEAD; Set<String> mustList = null; if (listDeadNodes) { //first load all the nodes listed in include and exclude files. mustList = new HashSet<String>(); mustList.addAll(hostsReader.getHosts()); mustList.addAll(hostsReader.getExcludedHosts()); } final List<DatanodeDescriptor> nodes = new ArrayList<DatanodeDescriptor>( namesystem.datanodeMap.size() + (mustList == null? 0: mustList.size())); synchronized(namesystem.datanodeMap) { for(DatanodeDescriptor dn : namesystem.datanodeMap.values()) { final boolean isDead = namesystem.isDatanodeDead(dn); if ( (isDead && listDeadNodes) || (!isDead && listLiveNodes) ) { nodes.add(dn); } if (listDeadNodes) { //Remove any form of the this datanode in include/exclude lists. try { final InetAddress inet = InetAddress.getByName(dn.getHost()); // compare hostname(:port) mustList.remove(inet.getHostName()); mustList.remove(inet.getHostName() + ":" + dn.getPort()); // compare ipaddress(:port) final String add = inet.getHostAddress().toString(); mustList.remove(add); mustList.remove(add + ":" + dn.getPort()); } catch (UnknownHostException e) { mustList.remove(dn.getName()); mustList.remove(dn.getHost()); LOG.warn(e); } } } } if (listDeadNodes) { for(String host : mustList) { final DatanodeDescriptor dn = new DatanodeDescriptor( new DatanodeID(host)); dn.setLastUpdate(0); nodes.add(dn); } } return nodes; } {code} > Move dnsToSwitchMapping and hostsReader from FSNamesystem to DatanodeManager > ---------------------------------------------------------------------------- > > Key: HDFS-2167 > URL: https://issues.apache.org/jira/browse/HDFS-2167 > Project: Hadoop HDFS > Issue Type: Sub-task > Components: name-node > Reporter: Tsz Wo (Nicholas), SZE > Assignee: Tsz Wo (Nicholas), SZE > Attachments: h2167_20110719.patch, h2167_20110720.patch, > h2167_20110720b.patch, h2167_20110720c.patch > > -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira