Package org.apache.hadoop.hdfs.protocol

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


                                TreeSet<DatanodeInfo> deadNodes) throws IOException {
    if ((nodes == null) ||
        (nodes.length - deadNodes.size() < 1)) {
      throw new IOException("No live nodes contain current block");
    }
    DatanodeInfo chosenNode;
    do {
      chosenNode = nodes[r.nextInt(nodes.length)];
    } while (deadNodes.contains(chosenNode));
    return chosenNode;
  }
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");
        node5.setNetworkLocation("/rack5");

        blocks.add(new LocatedBlock(null, new DatanodeInfo[] {node1, node2, node5}));
        blocks.add(new LocatedBlock(null, new DatanodeInfo[] {node1, node2, node3}));
        blocks.add(new LocatedBlock(null, new DatanodeInfo[] {node2, node3, node4}));
        blocks.add(new LocatedBlock(null, new DatanodeInfo[] {node1, node4, node5}));
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");
        node5.setNetworkLocation("/rack5");

        blocks.add(new LocatedBlock(null, new DatanodeInfo[] {node1, node2, node5}));
        blocks.add(new LocatedBlock(null, new DatanodeInfo[] {node1, node2, node3}));
        blocks.add(new LocatedBlock(null, new DatanodeInfo[] {node2, node3, node4}));
        blocks.add(new LocatedBlock(null, new DatanodeInfo[] {node1, node4, node5}));
View Full Code Here

    cluster.waitActive();
   
    DFSClient dfsClient =  new DFSClient(new InetSocketAddress("localhost",
                                         cluster.getNameNodePort()), conf);
    fs = cluster.getFileSystem();
    DatanodeInfo dn = dfsClient.datanodeReport(DatanodeReportType.LIVE)[0];
   
    /*
     * The cluster restarted. The block should be verified by now.
     */
    assertTrue(waitForVerification(dn, fs, file1) > startTime);
View Full Code Here

  private void handleScanFailure(Block block) {
   
    LOG.info("Reporting bad block " + block + " to namenode.");
   
    try {
      DatanodeInfo[] dnArr = { new DatanodeInfo(datanode.dnRegistration) };
      LocatedBlock[] blocks = { new LocatedBlock(block, dnArr) };
      datanode.namenode.reportBadBlocks(blocks);
    } catch (IOException e){
      /* One common reason is that NameNode could be in safe mode.
       * Should we keep on retrying in that case?
View Full Code Here

  }

  @Override // ClientProtocol
  public DatanodeInfo[] getDatanodeReport(DatanodeReportType type)
  throws IOException {
    DatanodeInfo results[] = namesystem.datanodeReport(type);
    if (results == null ) {
      throw new IOException("Cannot find datanode report");
    }
    return results;
  }
View Full Code Here

      }

      //get the RBW
      final ReplicaBeingWritten oldrbw;
      final DataNode newnode;
      final DatanodeInfo newnodeinfo;
      final String bpid = cluster.getNamesystem().getBlockPoolId();
      {
        final DataNode oldnode = cluster.getDataNodes().get(0);
        oldrbw = getRbw(oldnode, bpid);
        LOG.info("oldrbw = " + oldrbw);
       
        //add a datanode
        cluster.startDataNodes(conf, 1, true, null, null);
        newnode = cluster.getDataNodes().get(REPLICATION);
       
        final DatanodeInfo oldnodeinfo;
        {
          final DatanodeInfo[] datatnodeinfos = cluster.getNameNodeRpc(
              ).getDatanodeReport(DatanodeReportType.LIVE);
          Assert.assertEquals(2, datatnodeinfos.length);
          int i = 0;
View Full Code Here

    TreeSet<DatanodeInfo> deadNodes = new TreeSet<DatanodeInfo>();
    BlockReader blockReader = null;
    ExtendedBlock block = lblock.getBlock();

    while (blockReader == null) {
      DatanodeInfo chosenNode;
     
      try {
        chosenNode = bestNode(dfs, lblock.getLocations(), deadNodes);
        targetAddr = NetUtils.createSocketAddr(chosenNode.getXferAddr());
      catch (IOException ie) {
        if (failures >= DFSConfigKeys.DFS_CLIENT_MAX_BLOCK_ACQUIRE_FAILURES_DEFAULT) {
          throw new IOException("Could not obtain block " + lblock, ie);
        }
        LOG.info("Could not obtain block from any node:  " + ie);
View Full Code Here

                                TreeSet<DatanodeInfo> deadNodes) throws IOException {
    if ((nodes == null) ||
        (nodes.length - deadNodes.size() < 1)) {
      throw new IOException("No live nodes contain current block");
    }
    DatanodeInfo chosenNode;
    do {
      chosenNode = nodes[DFSUtil.getRandom().nextInt(nodes.length)];
    } while (deadNodes.contains(chosenNode));
    return chosenNode;
  }
View Full Code Here

  void reportBadBlocks(ExtendedBlock block,
      String storageUuid, StorageType storageType) {
    if (bpRegistration == null) {
      return;
    }
    DatanodeInfo[] dnArr = { new DatanodeInfo(bpRegistration) };
    String[] uuids = { storageUuid };
    StorageType[] types = { storageType };
    LocatedBlock[] blocks = { new LocatedBlock(block, dnArr, uuids, types) };
   
    try {
View Full Code Here

TOP

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

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.