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

Examples of org.apache.hadoop.hdfs.server.namenode.FSNamesystem.NumberReplicas


      } while (num.excessReplicas() != newReplicas);
    }
 
  private void waitForExcessReplicasToBeDeleted(FSNamesystem namesystem,
      Block block, DataNode dn) throws Exception {
    NumberReplicas num;
    long startChecking = System.currentTimeMillis();
    do {
      LOG.info("Waiting for the excess replica to be deleted");
      dn.scheduleNSBlockReceivedAndDeleted(0);
      namesystem.readLock();
      try {
        num = namesystem.countNodes(block);
      } finally {
        namesystem.readUnlock();
      }
      Thread.sleep(100);
      if (System.currentTimeMillis() - startChecking > 30000) {
        fail("Timed out waiting for excess replicas to be deleted");
      }

    } while (num.excessReplicas() != 0);
  }
View Full Code Here


        namesystem.heartbeatCheck();
      }
     
      LOG.info("Waiting for live replicas to hit repl factor");
      // The block should be replicated
      NumberReplicas num;
      do {
       namesystem.readLock();
       try {
         num = namesystem.countNodes(block);
       } finally {
         namesystem.readUnlock();
       }
      } while (num.liveReplicas() != REPLICATION_FACTOR);
     
      LOG.info("Restarting first DN");
      // restart the first datanode
      cluster.restartDataNode(dnprop);
      cluster.waitActive(false);
View Full Code Here

  private void waitForExcessReplicasToChange(
    FSNamesystem namesystem,
    Block block,
    int newReplicas) throws Exception
  {
    NumberReplicas num;
    long startChecking = System.currentTimeMillis();
    do {
      namesystem.readLock();
      try {
        num = namesystem.countNodes(block);
        LOG.info("We have " + num.excessReplicas() + " excess replica");
      } finally {
        namesystem.readUnlock();
      }
      Thread.sleep(100);
      if (System.currentTimeMillis() - startChecking > 30000) {
        namesystem.metaSave("TestNodeCount.meta");
        LOG.warn("Dumping meta into log directory");
        fail("Timed out waiting for excess replicas to change");
      }

    } while (num.excessReplicas() != newReplicas);
  }
View Full Code Here

      nn.reportBadBlocks(new LocatedBlock[] {badLBlock});

      nn.getNamesystem().restartReplicationWork();

      DFSTestUtil.waitReplication(fs, path, (short)3);
      NumberReplicas num = nn.getNamesystem().countNodes(
          firstBlock.getBlock());
      assertEquals(0, num.corruptReplicas());

    } finally {
      cluster.shutdown();
    }
  }
View Full Code Here

      // bring up the datanode
      cluster.restartDataNode(dnprop);
     
      // Wait for block report
      LOG.info("wait for its block report to come in");
      NumberReplicas num;
      FileStatus stat = dfs.getFileStatus(new Path(filePath));
      LocatedBlocks blocks = dfs.getClient().
          getLocatedBlocks(filePath, 0, stat.getLen());
      long startTime = System.currentTimeMillis();
      do {
        Thread.sleep(1000);
        int totalCount = 0;
        namesystem.readLock();
        try {
          for (LocatedBlock block : blocks.getLocatedBlocks()) {
            num = namesystem.countNodes(block.getBlock());
            totalCount += num.liveReplicas();
          }
          if (totalCount == rsCodec.numDataBlocks) {
            break;
          } else {
            LOG.info("wait for block report, received total replicas: " + totalCount);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hdfs.server.namenode.FSNamesystem.NumberReplicas

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.