当前位置: 首页>>代码示例>>Java>>正文


Java NameNodeLayoutVersion.supports方法代码示例

本文整理汇总了Java中org.apache.hadoop.hdfs.server.namenode.NameNodeLayoutVersion.supports方法的典型用法代码示例。如果您正苦于以下问题:Java NameNodeLayoutVersion.supports方法的具体用法?Java NameNodeLayoutVersion.supports怎么用?Java NameNodeLayoutVersion.supports使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hdfs.server.namenode.NameNodeLayoutVersion的用法示例。


在下文中一共展示了NameNodeLayoutVersion.supports方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processINodes

import org.apache.hadoop.hdfs.server.namenode.NameNodeLayoutVersion; //导入方法依赖的package包/类
/**
 * Process the INode records stored in the fsimage.
 *
 * @param in Datastream to process
 * @param v Visitor to walk over INodes
 * @param numInodes Number of INodes stored in file
 * @param skipBlocks Process all the blocks within the INode?
 * @param supportSnapshot Whether or not the imageVersion supports snapshot
 * @throws VisitException
 * @throws IOException
 */
private void processINodes(DataInputStream in, ImageVisitor v,
    long numInodes, boolean skipBlocks, boolean supportSnapshot)
    throws IOException {
  v.visitEnclosingElement(ImageElement.INODES,
      ImageElement.NUM_INODES, numInodes);
  
  if (NameNodeLayoutVersion.supports(Feature.FSIMAGE_NAME_OPTIMIZATION, imageVersion)) {
    if (!supportSnapshot) {
      processLocalNameINodes(in, v, numInodes, skipBlocks);
    } else {
      processLocalNameINodesWithSnapshot(in, v, skipBlocks);
    }
  } else { // full path name
    processFullNameINodes(in, v, numInodes, skipBlocks);
  }

  
  v.leaveEnclosingElement(); // INodes
}
 
开发者ID:naver,项目名称:hadoop,代码行数:31,代码来源:ImageLoaderCurrent.java

示例2: processFileDiff

import org.apache.hadoop.hdfs.server.namenode.NameNodeLayoutVersion; //导入方法依赖的package包/类
private void processFileDiff(DataInputStream in, ImageVisitor v,
    String currentINodeName) throws IOException {
  int snapshotId = in.readInt();
  v.visitEnclosingElement(ImageElement.SNAPSHOT_FILE_DIFF,
      ImageElement.SNAPSHOT_DIFF_SNAPSHOTID, snapshotId);
  v.visit(ImageElement.SNAPSHOT_FILE_SIZE, in.readLong());
  if (in.readBoolean()) {
    v.visitEnclosingElement(ImageElement.SNAPSHOT_INODE_FILE_ATTRIBUTES);
    if (NameNodeLayoutVersion.supports(Feature.OPTIMIZE_SNAPSHOT_INODES, imageVersion)) {
      processINodeFileAttributes(in, v, currentINodeName);
    } else {
      processINode(in, v, true, currentINodeName, true);
    }
    v.leaveEnclosingElement();
  }
  v.leaveEnclosingElement();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:ImageLoaderCurrent.java

示例3: processINodeFileAttributes

import org.apache.hadoop.hdfs.server.namenode.NameNodeLayoutVersion; //导入方法依赖的package包/类
private void processINodeFileAttributes(DataInputStream in, ImageVisitor v,
    String parentName) throws IOException {
  final String pathName = readINodePath(in, parentName);
  v.visit(ImageElement.INODE_PATH, pathName);
  processPermission(in, v);
  v.visit(ImageElement.MODIFICATION_TIME, formatDate(in.readLong()));
  if(NameNodeLayoutVersion.supports(Feature.FILE_ACCESS_TIME, imageVersion)) {
    v.visit(ImageElement.ACCESS_TIME, formatDate(in.readLong()));
  }

  v.visit(ImageElement.REPLICATION, in.readShort());
  v.visit(ImageElement.BLOCK_SIZE, in.readLong());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:ImageLoaderCurrent.java

示例4: testSNAPSHOT

import org.apache.hadoop.hdfs.server.namenode.NameNodeLayoutVersion; //导入方法依赖的package包/类
/**
 * When a LayoutVersion support SNAPSHOT, it must support
 * FSIMAGE_NAME_OPTIMIZATION.
 */
@Test
public void testSNAPSHOT() {
  for(Feature f : Feature.values()) {
    final int version = f.getInfo().getLayoutVersion();
    if (NameNodeLayoutVersion.supports(Feature.SNAPSHOT, version)) {
      assertTrue(NameNodeLayoutVersion.supports(
          Feature.FSIMAGE_NAME_OPTIMIZATION, version));
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:TestLayoutVersion.java

示例5: processINodesUC

import org.apache.hadoop.hdfs.server.namenode.NameNodeLayoutVersion; //导入方法依赖的package包/类
/**
 * Process the INodes under construction section of the fsimage.
 *
 * @param in DataInputStream to process
 * @param v Visitor to walk over inodes
 * @param skipBlocks Walk over each block?
 */
private void processINodesUC(DataInputStream in, ImageVisitor v,
    boolean skipBlocks) throws IOException {
  int numINUC = in.readInt();

  v.visitEnclosingElement(ImageElement.INODES_UNDER_CONSTRUCTION,
                         ImageElement.NUM_INODES_UNDER_CONSTRUCTION, numINUC);

  for(int i = 0; i < numINUC; i++) {
    v.visitEnclosingElement(ImageElement.INODE_UNDER_CONSTRUCTION);
    byte [] name = FSImageSerialization.readBytes(in);
    String n = new String(name, "UTF8");
    v.visit(ImageElement.INODE_PATH, n);
    
    if (NameNodeLayoutVersion.supports(Feature.ADD_INODE_ID, imageVersion)) {
      long inodeId = in.readLong();
      v.visit(ImageElement.INODE_ID, inodeId);
    }
    
    v.visit(ImageElement.REPLICATION, in.readShort());
    v.visit(ImageElement.MODIFICATION_TIME, formatDate(in.readLong()));

    v.visit(ImageElement.PREFERRED_BLOCK_SIZE, in.readLong());
    int numBlocks = in.readInt();
    processBlocks(in, v, numBlocks, skipBlocks);

    processPermission(in, v);
    v.visit(ImageElement.CLIENT_NAME, FSImageSerialization.readString(in));
    v.visit(ImageElement.CLIENT_MACHINE, FSImageSerialization.readString(in));

    // Skip over the datanode descriptors, which are still stored in the
    // file but are not used by the datanode or loaded into memory
    int numLocs = in.readInt();
    for(int j = 0; j < numLocs; j++) {
      in.readShort();
      in.readLong();
      in.readLong();
      in.readLong();
      in.readInt();
      FSImageSerialization.readString(in);
      FSImageSerialization.readString(in);
      WritableUtils.readEnum(in, AdminStates.class);
    }

    v.leaveEnclosingElement(); // INodeUnderConstruction
  }

  v.leaveEnclosingElement(); // INodesUnderConstruction
}
 
开发者ID:naver,项目名称:hadoop,代码行数:56,代码来源:ImageLoaderCurrent.java

示例6: processDirectoryDiff

import org.apache.hadoop.hdfs.server.namenode.NameNodeLayoutVersion; //导入方法依赖的package包/类
private void processDirectoryDiff(DataInputStream in, ImageVisitor v,
    String currentINodeName) throws IOException {
  v.visitEnclosingElement(ImageElement.SNAPSHOT_DIR_DIFF);
  int snapshotId = in.readInt();
  v.visit(ImageElement.SNAPSHOT_DIFF_SNAPSHOTID, snapshotId);
  v.visit(ImageElement.SNAPSHOT_DIR_DIFF_CHILDREN_SIZE, in.readInt());
  
  // process snapshotINode
  boolean useRoot = in.readBoolean();
  if (!useRoot) {
    if (in.readBoolean()) {
      v.visitEnclosingElement(ImageElement.SNAPSHOT_INODE_DIRECTORY_ATTRIBUTES);
      if (NameNodeLayoutVersion.supports(Feature.OPTIMIZE_SNAPSHOT_INODES, imageVersion)) {
        processINodeDirectoryAttributes(in, v, currentINodeName);
      } else {
        processINode(in, v, true, currentINodeName, true);
      }
      v.leaveEnclosingElement();
    }
  }
  
  // process createdList
  int createdSize = in.readInt();
  v.visitEnclosingElement(ImageElement.SNAPSHOT_DIR_DIFF_CREATEDLIST,
      ImageElement.SNAPSHOT_DIR_DIFF_CREATEDLIST_SIZE, createdSize);
  for (int i = 0; i < createdSize; i++) {
    String createdNode = FSImageSerialization.readString(in);
    v.visit(ImageElement.SNAPSHOT_DIR_DIFF_CREATED_INODE, createdNode);
  }
  v.leaveEnclosingElement();
  
  // process deletedList
  int deletedSize = in.readInt();
  v.visitEnclosingElement(ImageElement.SNAPSHOT_DIR_DIFF_DELETEDLIST,
      ImageElement.SNAPSHOT_DIR_DIFF_DELETEDLIST_SIZE, deletedSize);
  for (int i = 0; i < deletedSize; i++) {
    v.visitEnclosingElement(ImageElement.SNAPSHOT_DIR_DIFF_DELETED_INODE);
    processINode(in, v, false, currentINodeName, true);
    v.leaveEnclosingElement();
  }
  v.leaveEnclosingElement();
  v.leaveEnclosingElement();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:44,代码来源:ImageLoaderCurrent.java


注:本文中的org.apache.hadoop.hdfs.server.namenode.NameNodeLayoutVersion.supports方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。