Return-Path: X-Original-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2EA33E431 for ; Wed, 30 Jan 2013 04:59:19 +0000 (UTC) Received: (qmail 51719 invoked by uid 500); 30 Jan 2013 04:59:17 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 51441 invoked by uid 500); 30 Jan 2013 04:59:17 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-issues@hadoop.apache.org Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 51351 invoked by uid 99); 30 Jan 2013 04:59:15 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Jan 2013 04:59:15 +0000 Date: Wed, 30 Jan 2013 04:59:14 +0000 (UTC) From: "Suresh Srinivas (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HDFS-4450) Duplicate data node on the name node after formatting data node MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HDFS-4450?page=3Dcom.atlassian.= jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D13566= 164#comment-13566164 ]=20 Suresh Srinivas commented on HDFS-4450: --------------------------------------- bq. I view the other versions of the code will not have this problem, In ad= dition practical use impossible to restart namenode when maintenance datano= de You are right about the behavior. I had forgotten the previous discussion r= elated to this from the comment I had posted: https://issues.apache.org/jira/browse/HDFS-3224?focusedCommentId=3D13472817= &page=3Dcom.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#co= mment-13472817 Looking at the description of this jira, the Host2NodesMap always has {{key= =3D ipAddress}} and {{value =3D DatanodeDescriptor}}. So add() method is d= oing the correct thing. If you look at {{host2DatanodeMap.getDatanodeByXfer= Addr()}}, it does look up the host by the ipAddress. It then compares the x= ferAddress to that of the transfer address of the DatanodeDescriptor stored= as value. Can you post the logs for this issue? =20 > Duplicate data node on the name node after formatting data node > --------------------------------------------------------------- > > Key: HDFS-4450 > URL: https://issues.apache.org/jira/browse/HDFS-4450 > Project: Hadoop HDFS > Issue Type: Bug > Components: namenode > Affects Versions: 2.0.2-alpha > Reporter: WenJin Ma > Original Estimate: 168h > Remaining Estimate: 168h > > Duplicate data node on the name node after formatting data node=E3=80=82 > When we registered data node=EF=BC=8Cuse nodeReg.getXferPort() to find Da= tanodeDescriptor. > {code} > DatanodeDescriptor nodeN =3D host2DatanodeMap.getDatanodeByXferAddr( > nodeReg.getIpAddr(), nodeReg.getXferPort()); > {code} > but add data node use node.getIpAddr(). > {code} > /** add node to the map=20 > * return true if the node is added; false otherwise. > */ > boolean add(DatanodeDescriptor node) { > hostmapLock.writeLock().lock(); > try { > if (node=3D=3Dnull || contains(node)) { > return false; > } > =20 > String ipAddr =3D node.getIpAddr(); > DatanodeDescriptor[] nodes =3D map.get(ipAddr); > DatanodeDescriptor[] newNodes; > if (nodes=3D=3Dnull) { > newNodes =3D new DatanodeDescriptor[1]; > newNodes[0]=3Dnode; > } else { // rare case: more than one datanode on the host > newNodes =3D new DatanodeDescriptor[nodes.length+1]; > System.arraycopy(nodes, 0, newNodes, 0, nodes.length); > newNodes[nodes.length] =3D node; > } > map.put(ipAddr, newNodes); > return true; > } finally { > hostmapLock.writeLock().unlock(); > } > } > {code} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrato= rs For more information on JIRA, see: http://www.atlassian.com/software/jira