Package org.apache.hadoop.hdfs.MiniDFSCluster

Examples of org.apache.hadoop.hdfs.MiniDFSCluster.DataNodeProperties


    // take down one datanode in the pipeline
    DatanodeInfo[] locs = cluster.getNameNode().getBlockLocations(
        file, 0, FILE_LEN).getLocatedBlocks().get(0).getLocations();
    assertEquals(2, locs.length);
    DatanodeInfo loc = locs[0];
    DataNodeProperties dnprop = cluster.stopDataNode(loc.getName());
    cluster.getNameNode().namesystem.removeDatanode(loc);
    out.write(buffer);
    ((DFSOutputStream) out.getWrappedStream()).sync();
    // the pipeline length drops to 1
    assertEquals(1, (((DFSOutputStream) out.getWrappedStream()).getNumCurrentReplicas()));
View Full Code Here


      DFSTestUtil.waitReplication(fs, fileName, (short)3);
     
      // corrupt the block on datanode 0
      Block block = DFSTestUtil.getFirstBlock(fs, fileName);
      TestDatanodeBlockScanner.corruptReplica(block, 0, cluster);
      DataNodeProperties dnProps = cluster.stopDataNode(0);
      // remove block scanner log to trigger block scanning at startup
      // remove curr and prev
      File scanLogCurr = new File(cluster.getBlockDirectory("data1")
          .getParent(), "dncp_block_verification.log.curr");
      scanLogCurr.delete();
View Full Code Here

      DFSOutputStream dfso = (DFSOutputStream)stm.getWrappedStream();
      dfso.abortForTests();

      // close the primary DN
      DataNodeProperties badDN = cluster.stopDataNode(0);

      // Truncate the block on the primary DN
      corruptDataNode(0, corrupt);

      // Start the DN back up
View Full Code Here

      DFSOutputStream dfso = (DFSOutputStream)stm.getWrappedStream();
      dfso.abortForTests();

      // close the DNs
      DataNodeProperties badDN = cluster.stopDataNode(0);
      DataNodeProperties badDN2 = cluster.stopDataNode(0); // what was 1 is now 0
      assertNotNull(badDN);
      assertNotNull(badDN2);

      // Truncate one of them as if its journal got corrupted
      corruptDataNode(0, CorruptionType.TRUNCATE_BLOCK_HALF);
View Full Code Here

  @Test(timeout = 5 * 60 * 1000)
  public void testAndReportDeletionPolicy() throws IOException, InterruptedException {
    int nodeStop = 0;

    DataNodeProperties dataNode = cluster.stopDataNode(nodeStop);
    waitForDataNodeToDie(nodeStop);
    String situation1 = getSituation("DataNode stopped.");

    cluster.restartDataNode(dataNode);
    waitForDataNodeToBack(nodeStop);
View Full Code Here

   
  }
 
  private DataNodeProperties shutdownDataNode(MiniDFSCluster cluster, DatanodeDescriptor datanode) {
    LOG.info("shutdown datanode: " + datanode.getName());
    DataNodeProperties dnprop = cluster.stopDataNode(datanode.getName());
    FSNamesystem namesystem = cluster.getNameNode().namesystem;
    // make sure that NN detects that the datanode is down
    synchronized (namesystem.heartbeats) {
      datanode.setLastUpdate(0); // mark it dead
      namesystem.heartbeatCheck();
View Full Code Here

    try {
      final FSNamesystem namesystem = cluster.getNameNode().namesystem;
      final FileSystem fs = cluster.getFileSystem();
      DatanodeDescriptor[] datanodes = (DatanodeDescriptor[])
          namesystem.heartbeats.toArray(new DatanodeDescriptor[REPLICATION_FACTOR]);
      DataNodeProperties dnprop = shutdownDataNode(cluster, datanodes[4]);
     
      LOG.info("Start the cluster");
      // populate the cluster with a one block file
      final Path FILE_PATH = new Path("/testfile1");
      DFSTestUtil.createFile(fs, FILE_PATH, 1L, REPLICATION_FACTOR, 1L);
View Full Code Here

    try {
      final FSNamesystem namesystem = cluster.getNameNode().namesystem;
      final FileSystem fs = cluster.getFileSystem();
      DatanodeDescriptor[] datanodes = (DatanodeDescriptor[])
          namesystem.heartbeats.toArray(new DatanodeDescriptor[REPLICATION_FACTOR]);
      DataNodeProperties dnprop = shutdownDataNode(cluster, datanodes[4]);
     
      LOG.info("Start the cluster");
      // populate the cluster with a one block file
      final Path FILE_PATH = new Path("/testfile2");
      DFSTestUtil.createFile(fs, FILE_PATH, 1L, REPLICATION_FACTOR, 1L);
View Full Code Here

      DFSTestUtil.createFile(fs, FILE_PATH, 1L, REPLICATION_FACTOR, 1L);
      DFSTestUtil.waitReplication(fs, FILE_PATH, REPLICATION_FACTOR);
      Block block = DFSTestUtil.getFirstBlock(fs, FILE_PATH);

      // shutdown the datanode
      DataNodeProperties dnprop = shutdownDataNode(cluster, datanodes[0]);
      assertEquals(1, namesystem.getMissingBlocksCount()); // one missing block
      assertEquals(0, namesystem.getNonCorruptUnderReplicatedBlocks());

      // Make the only datanode to be decommissioned
      LOG.info("Decommission the datanode " + dnprop);
View Full Code Here

      cluster.waitActive(false);
     
      LOG.info("Bringing down first DN");
      // bring down first datanode
      DatanodeDescriptor datanode = datanodes[0];
      DataNodeProperties dnprop = cluster.stopDataNode(datanode.getName());
      // make sure that NN detects that the datanode is down
      synchronized (namesystem.heartbeats) {
        datanode.setLastUpdate(0); // mark it dead
        namesystem.heartbeatCheck();
      }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hdfs.MiniDFSCluster.DataNodeProperties

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.