Package org.apache.hadoop.hdfs.protocol

Examples of org.apache.hadoop.hdfs.protocol.LocatedBlocks.locatedBlockCount()


    // Verify we have RBWs after restart.
    AvatarNode avatarAfter = cluster.getPrimaryAvatar(0).avatar;
    LocatedBlocks lbks = avatarAfter.namesystem
        .getBlockLocations(fileName, 0,
        Long.MAX_VALUE);
    long blocksAfter = lbks.locatedBlockCount();

    System.out.println("blocksBefore : " + blocksBefore + " blocksAfter : "
        + blocksAfter);

    assertEquals(blocksBefore, blocksAfter);
View Full Code Here


  private boolean blocksReceived(int nBlocks, String fileName) throws IOException {
    AvatarNode avatar = cluster.getPrimaryAvatar(0).avatar;
    LocatedBlocks lbks = avatar.namesystem.getBlockLocations(fileName, 0,
        Long.MAX_VALUE);
    int blocks = lbks.locatedBlockCount();
    if (blocks != nBlocks)
      return false;
    for (LocatedBlock lbk : lbks.getLocatedBlocks()) {
      DatanodeInfo[] locs = lbk.getLocations();
      if (locs == null || locs.length == 0) {
View Full Code Here

  private BlockPathInfo getBlockPathInfo(String filename,
      MiniDFSCluster miniCluster, DFSClient dfsclient) throws IOException {
    LocatedBlocks locations = dfsclient.namenode.getBlockLocations(filename, 0,
        Long.MAX_VALUE);
    assertEquals(1, locations.locatedBlockCount());
    LocatedBlock locatedblock = locations.getLocatedBlocks().get(0);
    DataNode datanode = miniCluster.getDataNode(locatedblock.getLocations()[0]
        .getIpcPort());
    assertTrue(datanode != null);
View Full Code Here

          if (retries > 0) {
            FileStatus info = namenode.getFileInfo(src);
            if (info != null) {
              LocatedBlocks blocks = namenode.getBlockLocations(src, 0, info
                .getLen());
              if (blocks.locatedBlockCount() > 0 ) {
                LocatedBlock last = blocks.get(blocks.locatedBlockCount() - 1);
                if (last.getBlockSize() == 0) {
                  // This one has not been written to
                  namenode.abandonBlock(last.getBlock(), src, clientName);
                }
View Full Code Here

            FileStatus info = namenode.getFileInfo(src);
            if (info != null) {
              LocatedBlocks blocks = namenode.getBlockLocations(src, 0, info
                .getLen());
              if (blocks.locatedBlockCount() > 0 ) {
                LocatedBlock last = blocks.get(blocks.locatedBlockCount() - 1);
                if (last.getBlockSize() == 0) {
                  // This one has not been written to
                  namenode.abandonBlock(last.getBlock(), src, clientName);
                }
              }
View Full Code Here

            FileStatus info = namenode.getFileInfo(src);
            if (info != null) {
              LocatedBlocks blocks = namenode.getBlockLocations(src, 0, info
                  .getLen());
              // If atleast one block exists.
              if (blocks.locatedBlockCount() > 0) {
                LocatedBlock last = blocks.get(blocks.locatedBlockCount() - 1);
                if (last.getBlockSize() == 0) {
                  // This one has not been written to
                  namenode.abandonBlock(last.getBlock(), src, clientName);
                }
View Full Code Here

            if (info != null) {
              LocatedBlocks blocks = namenode.getBlockLocations(src, 0, info
                  .getLen());
              // If atleast one block exists.
              if (blocks.locatedBlockCount() > 0) {
                LocatedBlock last = blocks.get(blocks.locatedBlockCount() - 1);
                if (last.getBlockSize() == 0) {
                  // This one has not been written to
                  namenode.abandonBlock(last.getBlock(), src, clientName);
                }
              }
View Full Code Here

            FileStatus info = namenode.getFileInfo(src);
            if (info != null) {
              LocatedBlocks blocks = namenode.getBlockLocations(src, 0, info
                  .getLen());
              // If atleast one block exists.
              if (blocks.locatedBlockCount() > 0) {
                LocatedBlock last = blocks.get(blocks.locatedBlockCount() - 1);
                if (last.getBlockSize() == 0) {
                  // This one has not been written to
                  namenode.abandonBlock(last.getBlock(), src, clientName);
                }
View Full Code Here

            if (info != null) {
              LocatedBlocks blocks = namenode.getBlockLocations(src, 0, info
                  .getLen());
              // If atleast one block exists.
              if (blocks.locatedBlockCount() > 0) {
                LocatedBlock last = blocks.get(blocks.locatedBlockCount() - 1);
                if (last.getBlockSize() == 0) {
                  // This one has not been written to
                  namenode.abandonBlock(last.getBlock(), src, clientName);
                }
              }
View Full Code Here

          if (retries > 0) {
            FileStatus info = namenode.getFileInfo(src);
            if (info != null) {
              LocatedBlocks blocks = namenode.getBlockLocations(src, 0, info
                  .getLen());
              if (blocks.locatedBlockCount() > 0 ) {
                LocatedBlock last = blocks.get(blocks.locatedBlockCount() - 1);
                if (last.getBlockSize() == 0) {
                  // This one has not been written to
                  namenode.abandonBlock(last.getBlock(), src, clientName);
                }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.