Package org.apache.hadoop.hdfs.server.namenode

Examples of org.apache.hadoop.hdfs.server.namenode.DatanodeDescriptor$BlockQueue


  private long[] createRandomFileDispersed(Path file, int numBlocks,
               DatanodeDescriptor primaryNode, DatanodeDescriptor altNode)
      throws IOException, InterruptedException {
   
    BlockPlacementPolicyFakeData bp = BlockPlacementPolicyFakeData.lastInstance;
    DatanodeDescriptor tmp = bp.overridingDatanode;
   
    final int repl = 1;
    long[] crcs = new long[numBlocks];
    CRC32 crc = new CRC32();
    Random rand = new Random();
View Full Code Here


    // flush to make sure a block is allocated.
    ((DFSOutputStream)(out.getWrappedStream())).sync();
   
    ArrayList<DatanodeDescriptor> dnList = new ArrayList<DatanodeDescriptor>();
    cluster.getNameNode().getNamesystem().DFSNodesStatus(dnList, dnList);
    DatanodeDescriptor dn = dnList.get(0);
   
    assertEquals(1, dn.getBlocksScheduled());
  
    // close the file and the counter should go to zero.
    out.close();  
    assertEquals(0, dn.getBlocksScheduled());
  }
View Full Code Here

      DatanodeInfo[] nodes = blocks.get(0).getLocations();
      assertEquals(nodes.length, 3);
      for (DataNode dn : cluster.getDataNodes()) {
        if (dn.getHostName().equals(nodes[0].getHostName())) {
          // set the first node as stale
          DatanodeDescriptor staleNodeInfo = cluster.getNameNode()
              .getNamesystem().getDatanode(dn.dnRegistration);
          staleNodeInfo.setLastUpdate(System.currentTimeMillis()
              - staleInterval - 1);
        }
      }

      LocatedBlocks blocksAfterStale = cluster.getNameNode().getBlockLocations(
View Full Code Here

    return result;
 
 
  public static DatanodeDescriptor getDatanodeDescriptor(String ipAddr,
      String rackLocation) {
    return new DatanodeDescriptor(new DatanodeID(ipAddr), rackLocation);
  }
View Full Code Here

      Thread.sleep(5000);
      ArrayList<DatanodeDescriptor> decommissioningNodes = fsn
          .getDecommissioningNodes();
      if (iteration == 0) {
        assertEquals(decommissioningNodes.size(), 1);
        DatanodeDescriptor decommNode = decommissioningNodes.get(0);
        checkDecommissionStatus(decommNode, 4, 0, 2);
      } else {
        assertEquals(decommissioningNodes.size(), 2);
        DatanodeDescriptor decommNode1 = decommissioningNodes.get(0);
        DatanodeDescriptor decommNode2 = decommissioningNodes.get(1);
        checkDecommissionStatus(decommNode1, 4, 4, 2);
        checkDecommissionStatus(decommNode2, 4, 4, 2);
      }
    }
    // Call refreshNodes on FSNamesystem with empty exclude file.
View Full Code Here

    // flush to make sure a block is allocated.
    ((DFSOutputStream)(out.getWrappedStream())).hflush();
   
    ArrayList<DatanodeDescriptor> dnList = new ArrayList<DatanodeDescriptor>();
    cluster.getNamesystem().DFSNodesStatus(dnList, dnList);
    DatanodeDescriptor dn = dnList.get(0);
   
    assertEquals(1, dn.getBlocksScheduled());
  
    // close the file and the counter should go to zero.
    out.close();  
    assertEquals(0, dn.getBlocksScheduled());
  }
View Full Code Here

      Thread.sleep(5000);
      ArrayList<DatanodeDescriptor> decommissioningNodes = fsn
          .getDecommissioningNodes();
      if (iteration == 0) {
        assertEquals(decommissioningNodes.size(), 1);
        DatanodeDescriptor decommNode = decommissioningNodes.get(0);
        checkDecommissionStatus(decommNode, 4, 0, 2);
      } else {
        assertEquals(decommissioningNodes.size(), 2);
        DatanodeDescriptor decommNode1 = decommissioningNodes.get(0);
        DatanodeDescriptor decommNode2 = decommissioningNodes.get(1);
        checkDecommissionStatus(decommNode1, 4, 4, 2);
        checkDecommissionStatus(decommNode2, 4, 4, 2);
      }
    }
    // Call refreshNodes on FSNamesystem with empty exclude file.
View Full Code Here

    // flush to make sure a block is allocated.
    ((DFSOutputStream)(out.getWrappedStream())).sync();
   
    ArrayList<DatanodeDescriptor> dnList = new ArrayList<DatanodeDescriptor>();
    cluster.getNameNode().namesystem.DFSNodesStatus(dnList, dnList);
    DatanodeDescriptor dn = dnList.get(0);
   
    assertEquals(1, dn.getBlocksScheduled());
  
    // close the file and the counter should go to zero.
    out.close();  
    assertEquals(0, dn.getBlocksScheduled());
  }
View Full Code Here

    assertEquals(cluster.getNumOfLeaves(), dataNodes.length);
  }

  public void testCreateInvalidTopology() throws Exception {
    NetworkTopology invalCluster = new NetworkTopology();
    DatanodeDescriptor invalDataNodes[] = new DatanodeDescriptor[] {
      new DatanodeDescriptor(new DatanodeID("h1:5020"), "/d1/r1"),
      new DatanodeDescriptor(new DatanodeID("h2:5020"), "/d1/r1"),
      new DatanodeDescriptor(new DatanodeID("h3:5020"), "/d1")
    };
    invalCluster.add(invalDataNodes[0]);
    invalCluster.add(invalDataNodes[1]);
    try {
      invalCluster.add(invalDataNodes[2]);
View Full Code Here

      DatanodeInfo[] nodes = blocks.get(0).getLocations();
      assertEquals(nodes.length, 3);
      for (DataNode dn : cluster.getDataNodes()) {
        if (dn.getHostName().equals(nodes[0].getHostName())) {
          // set the first node as stale
          DatanodeDescriptor staleNodeInfo = cluster.getNameNode()
              .getNamesystem().getDatanode(dn.dnRegistration);
          staleNodeInfo.setLastUpdate(System.currentTimeMillis()
              - staleInterval - 1);
        }
      }

      LocatedBlocks blocksAfterStale = cluster.getNameNode().getBlockLocations(
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hdfs.server.namenode.DatanodeDescriptor$BlockQueue

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.