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


Java INodeId.ROOT_INODE_ID属性代码示例

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


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

示例1: getParentPath

@Override
public String getParentPath(long inode) throws IOException {
  if (inode == INodeId.ROOT_INODE_ID) {
    return "/";
  }
  byte[] bytes = dirChildMap.get(toBytes(inode));
  Preconditions.checkState(bytes != null && bytes.length == 8,
      "Can not find parent directory for inode %s, "
          + "fsimage might be corrupted", inode);
  long parent = toLong(bytes);
  if (!dirPathCache.containsKey(parent)) {
    bytes = dirMap.get(toBytes(parent));
    if (parent != INodeId.ROOT_INODE_ID) {
      Preconditions.checkState(bytes != null,
          "Can not find parent directory for inode %s, "
              + ", the fsimage might be corrupted.", parent);
    }
    String parentName = toString(bytes);
    String parentPath =
        new Path(getParentPath(parent),
            parentName.isEmpty()? "/" : parentName).toString();
    dirPathCache.put(parent, parentPath);
  }
  return dirPathCache.get(parent);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:25,代码来源:PBImageTextWriter.java

示例2: setupMockCluster

@Before
public void setupMockCluster() throws IOException {
  Configuration conf = new HdfsConfiguration();
  conf.set(DFSConfigKeys.NET_TOPOLOGY_SCRIPT_FILE_NAME_KEY,
           "need to set a dummy value here so it assumes a multi-rack cluster");
  fsn = Mockito.mock(FSNamesystem.class);
  Mockito.doReturn(true).when(fsn).hasWriteLock();
  Mockito.doReturn(true).when(fsn).hasReadLock();
  Mockito.doReturn(true).when(fsn).isRunning();
  bm = new BlockManager(fsn, conf);
  final String[] racks = {
      "/rackA",
      "/rackA",
      "/rackA",
      "/rackB",
      "/rackB",
      "/rackB"};
  storages = DFSTestUtil.createDatanodeStorageInfos(racks);
  nodes = Arrays.asList(DFSTestUtil.toDatanodeDescriptor(storages));
  rackA = nodes.subList(0, 3);
  rackB = nodes.subList(3, 6);
  mockINodeId = INodeId.ROOT_INODE_ID + 1;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:23,代码来源:TestBlockManager.java

示例3: getParentPath

@Override
public String getParentPath(long inode) throws IOException {
  if (inode == INodeId.ROOT_INODE_ID) {
    return "/";
  }
  byte[] bytes = dirChildMap.get(toBytes(inode));
  Preconditions.checkState(bytes != null && bytes.length == 8,
      "Can not find parent directory for inode %s, "
          + "fsimage might be corrupted", inode);
  long parent = toLong(bytes);
  if (!dirPathCache.containsKey(parent)) {
    bytes = dirMap.get(toBytes(parent));
    if (parent != INodeId.ROOT_INODE_ID) {
      Preconditions.checkState(bytes != null,
          "Can not find parent directory for inode %s, "
              + ", the fsimage might be corrupted.", parent);
    }
    String parentName = toString(bytes);
    String parentPath =
        new File(getParentPath(parent), parentName).toString();
    dirPathCache.put(parent, parentPath);
  }
  return dirPathCache.get(parent);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:24,代码来源:PBImageTextWriter.java

示例4: getParentPath

@Override
public String getParentPath(long inode) throws IOException {
  if (inode == INodeId.ROOT_INODE_ID) {
    return "";
  }
  Dir parent = dirChildMap.get(inode);
  if (parent == null) {
    // The inode is an INodeReference, which is generated from snapshot.
    // For delimited oiv tool, no need to print out metadata in snapshots.
    PBImageTextWriter.ignoreSnapshotName(inode);
  }
  return parent.getPath();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:PBImageTextWriter.java

示例5: lookup

/**
 * Return the INodeId of the specified path.
 */
private long lookup(String path) throws IOException {
  Preconditions.checkArgument(path.startsWith("/"));
  long id = INodeId.ROOT_INODE_ID;
  for (int offset = 0, next; offset < path.length(); offset = next) {
    next = path.indexOf('/', offset + 1);
    if (next == -1) {
      next = path.length();
    }
    if (offset + 1 > next) {
      break;
    }

    final String component = path.substring(offset + 1, next);

    if (component.isEmpty()) {
      continue;
    }

    final long[] children = dirmap.get(id);
    if (children == null) {
      throw new FileNotFoundException(path);
    }

    boolean found = false;
    for (long cid : children) {
      FsImageProto.INodeSection.INode child = fromINodeId(cid);
      if (component.equals(child.getName().toStringUtf8())) {
        found = true;
        id = child.getId();
        break;
      }
    }
    if (!found) {
      throw new FileNotFoundException(path);
    }
  }
  return id;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:41,代码来源:FSImageLoader.java

示例6: run

void run() throws Exception {
  String reservedRoot = "/.reserved/.inodes/" + INodeId.ROOT_INODE_ID;
  Assert.assertEquals(reservedRoot,
    TestPath.mergeStatuses(wrap.
        globStatus(new Path(reservedRoot), new AcceptAllPathFilter())));
  // These inodes don't show up via listStatus.
  Assert.assertEquals("",
    TestPath.mergeStatuses(wrap.
        globStatus(new Path("/.reserved/*"), new AcceptAllPathFilter())));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:TestGlobPaths.java

示例7: testInodeIdWithCheckPoint

@Test
public void testInodeIdWithCheckPoint() throws Exception {
	TestAvatarCheckpointingHandler h = new TestAvatarCheckpointingHandler(null, null, false);
	InjectionHandler.set(h);
	setUp("testInodeIdWithCheckPoint", false);
	long expectedLastINodeId = INodeId.ROOT_INODE_ID;

	DFSTestUtil.createFile(fs, new Path("/testtwo/fileone"), 1024, (short) 1, 0);
	AvatarNode primaryAvatar = cluster.getPrimaryAvatar(0).avatar;
	AvatarNode standbyAvatar = cluster.getStandbyAvatar(0).avatar;
	FSNamesystem primaryNS = primaryAvatar.namesystem;
	FSNamesystem standbyNS = standbyAvatar.namesystem;
	expectedLastINodeId += 2;

	DFSAvatarTestUtil.assertTxnIdSync(primaryAvatar, standbyAvatar);
	DFSTestUtil.assertInodemapEquals(primaryNS.dir.getInodeMap(), standbyNS.dir.getInodeMap());
	assertEquals(expectedLastINodeId, standbyNS.dir.getLastInodeId());

	h.doCheckpoint();
	cluster.restartAvatarNodes();
	primaryAvatar = cluster.getPrimaryAvatar(0).avatar;
	standbyAvatar = cluster.getStandbyAvatar(0).avatar;
	primaryNS = primaryAvatar.namesystem;
	standbyNS = standbyAvatar.namesystem;

	DFSTestUtil.assertInodemapEquals(primaryNS.dir.getInodeMap(), standbyNS.dir.getInodeMap());
	assertEquals(expectedLastINodeId, standbyNS.dir.getLastInodeId());
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:28,代码来源:TestAvatarCheckpointing.java

示例8: run

public void run(FSTestWrapper wrap, FSTestWrapper unprivilegedWrap,
    FileSystem fs, FileContext fc) throws Exception {
  String reservedRoot = "/.reserved/.inodes/" + INodeId.ROOT_INODE_ID;
  Assert.assertEquals(reservedRoot,
    TestPath.mergeStatuses(unprivilegedWrap.
        globStatus(new Path(reservedRoot), new AcceptAllPathFilter())));
  // These inodes don't show up via listStatus.
  Assert.assertEquals("",
    TestPath.mergeStatuses(unprivilegedWrap.
        globStatus(new Path("/.reserved/*"), new AcceptAllPathFilter())));
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:11,代码来源:TestGlobPaths.java

示例9: run

void run() throws Exception {
  String reservedRoot = "/.reserved/.inodes/" + INodeId.ROOT_INODE_ID;
  Assert.assertEquals(reservedRoot,
    TestPath.mergeStatuses(wrap.
        globStatus(new Path(reservedRoot), new AcceptAllPathFilter())));
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:6,代码来源:TestGlobPaths.java


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