Package org.apache.hadoop.hdfs.protocol

Examples of org.apache.hadoop.hdfs.protocol.LocatedBlockWithMetaInfo


    case VERSION_AND_NAMESPACEID_AND_OLD_GS:
      return new LocatedBlockWithOldGS(block, targets, fileLen,
          transferProtocolVersion, this.getFSImage().storage.namespaceID,
          this.nameNode.getClientProtocolMethodsFingerprint(), oldGenerationStamp);
    case VERSION_AND_NAMESPACEID:
      return new LocatedBlockWithMetaInfo(block, targets, fileLen,
          transferProtocolVersion, this.getFSImage().storage.namespaceID, this.nameNode
              .getClientProtocolMethodsFingerprint());
    case VERSION:
      return new VersionedLocatedBlock(block, targets, fileLen,
          transferProtocolVersion);
View Full Code Here


    List<LocatedBlock> blocks = locations.getLocatedBlocks();
    DataNode.LOG.info("blocks.size()=" + blocks.size());
    assertTrue(blocks.size() > 0);

    LocatedBlock blk = blocks.get(blocks.size() - 1);
    return new LocatedBlockWithMetaInfo(blk.getBlock(), blk.getLocations(),
        blk.getStartOffset(),
        locations.getDataProtocolVersion(), locations.getNamespaceID(),
        locations.getMethodFingerPrint());
  }
View Full Code Here

      Path filepath = new Path(filestr);
      DFSTestUtil.createFile(dfs, filepath, 1024L, (short)3, 0L);
      assertTrue(dfs.getClient().exists(filestr));

      //get block info
      LocatedBlockWithMetaInfo locatedblock = getLastLocatedBlock(dfs.getClient().namenode, filestr);
      int namespaceId = locatedblock.getNamespaceID();
      DatanodeInfo[] datanodeinfo = locatedblock.getLocations();
      assertTrue(datanodeinfo.length > 0);

      //connect to a data node
      DataNode datanode = cluster.getDataNode(datanodeinfo[0].getIpcPort());
      InterDatanodeProtocol idp = DataNode.createInterDataNodeProtocolProxy(
          datanodeinfo[0], conf, datanode.socketTimeout);
      assertTrue(datanode != null);
     
      //stop block scanner, so we could compare lastScanTime
      datanode.blockScanner.shutdown();

      //verify BlockMetaDataInfo
      Block b = locatedblock.getBlock();
      InterDatanodeProtocol.LOG.info("b=" + b + ", " + b.getClass());
      checkMetaInfo(namespaceId, b, idp, datanode.blockScanner);

      //verify updateBlock
      Block newblock = new Block(
View Full Code Here

    String clientName = newFile;
    fs.create(new Path(filename + "new"));
    cluster.getNameNode().create(newFile, srcFileStatus.getPermission(),
        clientName, true, true, srcFileStatus.getReplication(),
        srcFileStatus.getBlockSize());
    LocatedBlockWithMetaInfo lbkDstMetaInfo =
      cluster.getNameNode().addBlockAndFetchMetaInfo(newFile, clientName, null, srcLocs);
    int dstNamespaceId = lbkDstMetaInfo.getNamespaceID();
    LocatedBlock lbkDst = lbkDstMetaInfo;

    // Verify locations of src and destination block.
    DatanodeInfo[] dstLocs = lbkDst.getLocations();
    Arrays.sort(srcLocs);
View Full Code Here

      DFSTestUtil.createFile(dfs, filepath, ORG_FILE_SIZE, REPLICATION_NUM, 0L);
      assertTrue(dfs.dfs.exists(filestr));
      DFSTestUtil.waitReplication(dfs, filepath, REPLICATION_NUM);

      //get block info for the last block
      LocatedBlockWithMetaInfo locatedblock = TestInterDatanodeProtocol.getLastLocatedBlock(
          dfs.dfs.namenode, filestr);
      int namespaceId = locatedblock.getNamespaceID();
      DatanodeInfo[] datanodeinfos = locatedblock.getLocations();
      assertEquals(REPLICATION_NUM, datanodeinfos.length);

      //connect to data nodes
      InterDatanodeProtocol[] idps = new InterDatanodeProtocol[REPLICATION_NUM];
      DataNode[] datanodes = new DataNode[REPLICATION_NUM];
      for(int i = 0; i < REPLICATION_NUM; i++) {
      idps[i] = DataNode.createInterDataNodeProtocolProxy(
    datanodeinfos[i], conf, 0);
        datanodes[i] = cluster.getDataNode(datanodeinfos[i].getIpcPort());
        assertTrue(datanodes[i] != null);
      }
     
      //verify BlockMetaDataInfo
      Block lastblock = locatedblock.getBlock();
      DataNode.LOG.info("newblocks=" + lastblock);
      for(int i = 0; i < REPLICATION_NUM; i++) {
        checkMetaInfo(namespaceId, lastblock, idps[i]);
      }
View Full Code Here

            return dfsClient.namenode.addBlock(src, dfsClient.clientName);
          }
          dfsClient.updateDataTransferProtocolVersionIfNeeded(
              loc.getDataProtocolVersion());
          if (loc instanceof LocatedBlockWithMetaInfo) {
            LocatedBlockWithMetaInfo metaLoc = (LocatedBlockWithMetaInfo)loc;
            dfsClient.updateNamespaceIdIfNeeded(metaLoc.getNamespaceID());
            dfsClient.getNewNameNodeIfNeeded(metaLoc.getMethodFingerPrint());
          }
          return loc;
        } catch (RemoteException e) {
          IOException ue =
            e.unwrapRemoteException(FileNotFoundException.class,
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hdfs.protocol.LocatedBlockWithMetaInfo

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.