Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-4450

Duplicate data node on the name node after formatting data node

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.0.2-alpha
    • None
    • namenode
    • None

    Description

      Duplicate data node on the name node after formatting data node。
      When we registered data node,use nodeReg.getXferPort() to find DatanodeDescriptor.

       DatanodeDescriptor nodeN = host2DatanodeMap.getDatanodeByXferAddr(
              nodeReg.getIpAddr(), nodeReg.getXferPort());
      

      but add data node use node.getIpAddr().

          /** add node to the map 
         * return true if the node is added; false otherwise.
         */
        boolean add(DatanodeDescriptor node) {
          hostmapLock.writeLock().lock();
          try {
            if (node==null || contains(node)) {
              return false;
            }
            
            String ipAddr = node.getIpAddr();
            DatanodeDescriptor[] nodes = map.get(ipAddr);
            DatanodeDescriptor[] newNodes;
            if (nodes==null) {
              newNodes = new DatanodeDescriptor[1];
              newNodes[0]=node;
            } else { // rare case: more than one datanode on the host
              newNodes = new DatanodeDescriptor[nodes.length+1];
              System.arraycopy(nodes, 0, newNodes, 0, nodes.length);
              newNodes[nodes.length] = node;
            }
            map.put(ipAddr, newNodes);
            return true;
          } finally {
            hostmapLock.writeLock().unlock();
          }
        }
      

      Attachments

        1. normal.bmp
          3.00 MB
          WenJin Ma
        2. exception.bmp
          3.00 MB
          WenJin Ma

        Activity

          People

            Unassigned Unassigned
            mawenjin WenJin Ma
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 168h
                168h
                Remaining:
                Remaining Estimate - 168h
                168h
                Logged:
                Time Spent - Not Specified
                Not Specified