Package org.apache.hadoop.hdfs.protocol

Examples of org.apache.hadoop.hdfs.protocol.DatanodeID


          //Datnodes are not persistent any more.
          break;
        }
        case OP_DATANODE_REMOVE: {
          numOpOther++;
          DatanodeID nodeID = new DatanodeID();
          nodeID.readFields(in);
          //Datanodes are not persistent any more.
          break;
        }
        case OP_SET_PERMISSIONS: {
          numOpSetPerm++;
View Full Code Here


    /**
     * Public method that serializes the information about a
     * Datanode to be stored in the fsImage.
     */
    public void write(DataOutput out) throws IOException {
      new DatanodeID(node).write(out);
      out.writeLong(node.getCapacity());
      out.writeLong(node.getRemaining());
      out.writeLong(node.getLastUpdate());
      out.writeInt(node.getXceiverCount());
    }
View Full Code Here

    /**
     * Public method that reads a serialized Datanode
     * from the fsImage.
     */
    public void readFields(DataInput in) throws IOException {
      DatanodeID id = new DatanodeID();
      id.readFields(in);
      long capacity = in.readLong();
      long remaining = in.readLong();
      long lastUpdate = in.readLong();
      int xceiverCount = in.readInt();

      // update the DatanodeDescriptor with the data we read in
      node.updateRegInfo(id);
      node.setStorageID(id.getStorageID());
      node.setCapacity(capacity);
      node.setRemaining(remaining);
      node.setLastUpdate(lastUpdate);
      node.setXceiverCount(xceiverCount);
    }
View Full Code Here

  /** Create a redirection URI */
  protected URI createUri(String parent, HdfsFileStatus i, UserGroupInformation ugi,
      ClientProtocol nnproxy, HttpServletRequest request, String dt)
      throws IOException, URISyntaxException {
    String scheme = request.getScheme();
    final DatanodeID host = pickSrcDatanode(parent, i, nnproxy);
    final String hostname;
    if (host instanceof DatanodeInfo) {
      hostname = ((DatanodeInfo)host).getHostName();
    } else {
      hostname = host.getHost();
    }
   
    String dtParam="";
    if (dt != null) {
      StringBuilder sb = new StringBuilder(JspHelper.SET_DELEGATION).append(dt);
      dtParam=sb.toString();
    }
   
    return new URI(scheme, null, hostname,
        "https".equals(scheme)
          ? (Integer)getServletContext().getAttribute("datanode.https.port")
          : host.getInfoPort(),
        "/streamFile", "filename=" + i.getFullName(parent) +
        "&ugi=" + ugi.getShortUserName() + dtParam, null);
  }
View Full Code Here

        System.out.println("buildRackRequests()");
        HerdJsv instance = new HerdJsv();
        List<LocatedBlock> blocks = new ArrayList<LocatedBlock>(5);
        Map<String,String> expectedResult = new HashMap<String, String>();
        Map result = null;
        DatanodeInfo node1 = new DatanodeInfo(new DatanodeID("node1"));
        DatanodeInfo node2 = new DatanodeInfo(new DatanodeID("node2a"));
        DatanodeInfo node3 = new DatanodeInfo(new DatanodeID("node2b"));
        DatanodeInfo node4 = new DatanodeInfo(new DatanodeID("node4"));
        DatanodeInfo node5 = new DatanodeInfo(new DatanodeID("node5"));

        node1.setNetworkLocation("/rack1");
        node2.setNetworkLocation("/rack2a");
        node3.setNetworkLocation("/rack2b");
        node4.setNetworkLocation("/rack4");
View Full Code Here

        System.out.println("collateRacks()");
        HerdJsv instance = new HerdJsv();
        List<LocatedBlock> blocks = new ArrayList<LocatedBlock>(5);
        Map<String,Integer> expectedResult = new HashMap<String, Integer>();
        Map result = null;
        DatanodeInfo node1 = new DatanodeInfo(new DatanodeID("node1"));
        DatanodeInfo node2 = new DatanodeInfo(new DatanodeID("node2"));
        DatanodeInfo node3 = new DatanodeInfo(new DatanodeID("node3"));
        DatanodeInfo node4 = new DatanodeInfo(new DatanodeID("node4"));
        DatanodeInfo node5 = new DatanodeInfo(new DatanodeID("node5"));

        node1.setNetworkLocation("/rack1");
        node2.setNetworkLocation("/rack2");
        node3.setNetworkLocation("/rack3");
        node4.setNetworkLocation("/rack4");
View Full Code Here

      throws IOException {
    INodeFile file = mockFileUnderConstruction();
    Block block = new Block(blockId, length, genStamp);
    FSNamesystem namesystemSpy = makeNameSystemSpy(block, file);
    DatanodeID[] newTargets = new DatanodeID[]{
        new DatanodeID("0.0.0.0", "nonexistantHost", "1", 0, 0, 0, 0)};

    ExtendedBlock lastBlock = new ExtendedBlock();
    namesystemSpy.commitBlockSynchronization(
        lastBlock, genStamp, length, true,
        false, newTargets, null);
View Full Code Here

    // nodes declared as dead.
    Assert.assertEquals(2, dm.getDatanodeListForReport(HdfsConstants
            .DatanodeReportType.ALL).size());
    Assert.assertEquals(2, dm.getDatanodeListForReport(HdfsConstants
            .DatanodeReportType.DEAD).size());
    dnMap.put("uuid-foo", new DatanodeDescriptor(new DatanodeID("127.0.0.1",
            "localhost", "uuid-foo", 12345, 1020, 1021, 1022)));
    Assert.assertEquals(1, dm.getDatanodeListForReport(HdfsConstants
            .DatanodeReportType.DEAD).size());
    dnMap.put("uuid-bar", new DatanodeDescriptor(new DatanodeID("127.0.0.2",
            "127.0.0.2", "uuid-bar", 12345, 1020, 1021, 1022)));
    Assert.assertEquals(0, dm.getDatanodeListForReport(HdfsConstants
            .DatanodeReportType.DEAD).size());
    DatanodeDescriptor spam = new DatanodeDescriptor(new DatanodeID("127.0.0" +
            ".3", "127.0.0.3", "uuid-spam", 12345, 1020, 1021, 1022));
    spam.setLastUpdate(0);
    includedNodes.add(entry("127.0.0.3:12345"));
    dnMap.put("uuid-spam", spam);
    Assert.assertEquals(1, dm.getDatanodeListForReport(HdfsConstants
View Full Code Here

    }
  }
 
  @Test
  public void testSortNodeByFields() throws Exception {
    DatanodeID dnId1 = new DatanodeID("127.0.0.1", "localhost1", "datanode1",
        1234, 2345, 3456, 4567);
    DatanodeID dnId2 = new DatanodeID("127.0.0.2", "localhost2", "datanode2",
        1235, 2346, 3457, 4568);

    // Setup DatanodeDescriptors with one storage each.
    DatanodeDescriptor dnDesc1 = new DatanodeDescriptor(dnId1, "rack1");
    DatanodeDescriptor dnDesc2 = new DatanodeDescriptor(dnId2, "rack2");
View Full Code Here

    }
  }

  @Test
  public void testAuthority(){
    DatanodeID dnWithIp = new DatanodeID("127.0.0.1", "hostName", null,
        50020, 50075, 50076, 50010);
    assertNotNull(JspHelper.Url.authority("http", dnWithIp));

    DatanodeID dnWithNullIp = new DatanodeID(null, "hostName", null,
        50020, 50075, 50076, 50010);
    assertNotNull(JspHelper.Url.authority("http", dnWithNullIp));

    DatanodeID dnWithEmptyIp = new DatanodeID("", "hostName", null,
        50020, 50075, 50076, 50010);
    assertNotNull(JspHelper.Url.authority("http", dnWithEmptyIp));
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hdfs.protocol.DatanodeID

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.