Package org.apache.hadoop.hdfs.server.protocol

Examples of org.apache.hadoop.hdfs.server.protocol.StorageBlockReport


    }
    // all blocks belong to the same file, hence same BP
    DataNode dn = cluster.getDataNodes().get(DN_N1);
    String poolId = cluster.getNamesystem().getBlockPoolId();
    DatanodeRegistration dnR = dn.getDNRegistrationForBP(poolId);
    StorageBlockReport[] report = { new StorageBlockReport(
        new DatanodeStorage(dnR.getStorageID()),
        new BlockListAsLongs(blocks, null).getBlockListAsLongs()) };
    cluster.getNameNodeRpc().blockReport(dnR, poolId, report);
    printStats();
    assertEquals("Wrong number of Corrupted blocks",
      1, cluster.getNamesystem().getCorruptReplicaBlocks() +
// the following might have to be added into the equation if
// the same block could be in two different states at the same time
// and then the expected number of has to be changed to '2'       
//        cluster.getNamesystem().getPendingReplicationBlocks() +
        cluster.getNamesystem().getPendingDeletionBlocks());

    // Get another block and screw its length to be less than original
    if (randIndex == 0)
      randIndex++;
    else
      randIndex--;
    corruptedBlock = blocks.get(randIndex);
    corruptBlockLen(corruptedBlock);
    if(LOG.isDebugEnabled()) {
      LOG.debug("Done corrupting length of " + corruptedBlock.getBlockName());
    }
   
    report[0] = new StorageBlockReport(
        new DatanodeStorage(dnR.getStorageID()),
        new BlockListAsLongs(blocks, null).getBlockListAsLongs());
    cluster.getNameNodeRpc().blockReport(dnR, poolId, report);
    printStats();
View Full Code Here


     
      // all blocks belong to the same file, hence same BP
      DataNode dn = cluster.getDataNodes().get(DN_N1);
      String poolId = cluster.getNamesystem().getBlockPoolId();
      DatanodeRegistration dnR = dn.getDNRegistrationForBP(poolId);
      StorageBlockReport[] report = { new StorageBlockReport(
          new DatanodeStorage(dnR.getStorageID()),
          new BlockListAsLongs(blocks, null).getBlockListAsLongs()) };
      cluster.getNameNodeRpc().blockReport(dnR, poolId, report);
      printStats();
      assertEquals("Wrong number of PendingReplication blocks",
View Full Code Here

                                               
      // all blocks belong to the same file, hence same BP
      DataNode dn = cluster.getDataNodes().get(DN_N1);
      String poolId = cluster.getNamesystem().getBlockPoolId();
      DatanodeRegistration dnR = dn.getDNRegistrationForBP(poolId);
      StorageBlockReport[] report = { new StorageBlockReport(
          new DatanodeStorage(dnR.getStorageID()),
          new BlockListAsLongs(blocks, null).getBlockListAsLongs()) };
      cluster.getNameNodeRpc().blockReport(dnR, poolId, report);
      printStats();
      assertEquals("Wrong number of PendingReplication blocks",
View Full Code Here

        dn.getFSDataset().getBlockReports(bpos.getBlockPoolId());

    // Convert the reports to the format expected by the NN.
    int i = 0;
    int totalBlockCount = 0;
    StorageBlockReport reports[] =
        new StorageBlockReport[perVolumeBlockLists.size()];

    for(Map.Entry<DatanodeStorage, BlockListAsLongs> kvPair : perVolumeBlockLists.entrySet()) {
      BlockListAsLongs blockList = kvPair.getValue();
      reports[i++] = new StorageBlockReport(
          kvPair.getKey(), blockList.getBlockListAsLongs());
      totalBlockCount += blockList.getNumberOfBlocks();
    }

    // Send the reports to the NN.
    int numReportsSent;
    long brSendStartTime = now();
    if (totalBlockCount < dnConf.blockReportSplitThreshold) {
      // Below split threshold, send all reports in a single message.
      numReportsSent = 1;
      DatanodeCommand cmd =
          bpNamenode.blockReport(bpRegistration, bpos.getBlockPoolId(), reports);
      if (cmd != null) {
        cmds.add(cmd);
      }
    } else {
      // Send one block report per message.
      numReportsSent = i;
      for (StorageBlockReport report : reports) {
        StorageBlockReport singleReport[] = { report };
        DatanodeCommand cmd = bpNamenode.blockReport(
            bpRegistration, bpos.getBlockPoolId(), singleReport);
        if (cmd != null) {
          cmds.add(cmd);
        }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hdfs.server.protocol.StorageBlockReport

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.