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


Java INode.computeQuotaUsage方法代码示例

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


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

示例1: destroyCreatedList

import org.apache.hadoop.hdfs.server.namenode.INode; //导入方法依赖的package包/类
/** clear the created list */
private QuotaCounts destroyCreatedList(
    final BlockStoragePolicySuite bsps,
    final INodeDirectory currentINode,
    final BlocksMapUpdateInfo collectedBlocks,
    final List<INode> removedINodes) {
  QuotaCounts counts = new QuotaCounts.Builder().build();
  final List<INode> createdList = getList(ListType.CREATED);
  for (INode c : createdList) {
    c.computeQuotaUsage(bsps, counts, true);
    c.destroyAndCollectBlocks(bsps, collectedBlocks, removedINodes);
    // c should be contained in the children list, remove it
    currentINode.removeChild(c);
  }
  createdList.clear();
  return counts;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:DirectoryWithSnapshotFeature.java

示例2: destroyDeletedList

import org.apache.hadoop.hdfs.server.namenode.INode; //导入方法依赖的package包/类
/** clear the deleted list */
private QuotaCounts destroyDeletedList(
    final BlockStoragePolicySuite bsps,
    final BlocksMapUpdateInfo collectedBlocks,
    final List<INode> removedINodes) {
  QuotaCounts counts = new QuotaCounts.Builder().build();
  final List<INode> deletedList = getList(ListType.DELETED);
  for (INode d : deletedList) {
    d.computeQuotaUsage(bsps, counts, false);
    d.destroyAndCollectBlocks(bsps, collectedBlocks, removedINodes);
  }
  deletedList.clear();
  return counts;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:DirectoryWithSnapshotFeature.java

示例3: computeQuotaUsage4CurrentDirectory

import org.apache.hadoop.hdfs.server.namenode.INode; //导入方法依赖的package包/类
public QuotaCounts computeQuotaUsage4CurrentDirectory(
    BlockStoragePolicySuite bsps, byte storagePolicyId,
    QuotaCounts counts) {
  for(DirectoryDiff d : diffs) {
    for(INode deleted : d.getChildrenDiff().getList(ListType.DELETED)) {
      final byte childPolicyId = deleted.getStoragePolicyIDForQuota(storagePolicyId);
      deleted.computeQuotaUsage(bsps, childPolicyId, counts, false,
          Snapshot.CURRENT_STATE_ID);
    }
  }
  return counts;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:DirectoryWithSnapshotFeature.java

示例4: testRenameExceedQuota

import org.apache.hadoop.hdfs.server.namenode.INode; //导入方法依赖的package包/类
/**
 * Test the rename undo when quota of dst tree is exceeded after rename.
 */
@Test
public void testRenameExceedQuota() throws Exception {
  final Path test = new Path("/test");
  final Path dir1 = new Path(test, "dir1");
  final Path dir2 = new Path(test, "dir2");
  final Path sub_dir2 = new Path(dir2, "subdir");
  final Path subfile_dir2 = new Path(sub_dir2, "subfile");
  hdfs.mkdirs(dir1);
  DFSTestUtil.createFile(hdfs, subfile_dir2, BLOCKSIZE, REPL, SEED);
  
  final Path foo = new Path(dir1, "foo");
  DFSTestUtil.createFile(hdfs, foo, BLOCKSIZE, REPL, SEED);
  
  SnapshotTestHelper.createSnapshot(hdfs, dir1, "s1");
  SnapshotTestHelper.createSnapshot(hdfs, dir2, "s2");
  
  // set ns quota of dir2 to 4, so the current remaining is 1 (already has
  // dir2, sub_dir2, subfile_dir2, and s2)
  hdfs.setQuota(dir2, 5, Long.MAX_VALUE - 1);
  
  // rename /test/dir1/foo to /test/dir2/sub_dir2/subfile_dir2. 
  // FSDirectory#verifyQuota4Rename will pass since foo only be counted 
  // as 1 in NS quota. The rename operation will succeed while the real quota 
  // of dir2 will become 7 (dir2, s2 in dir2, sub_dir2, s2 in sub_dir2,
  // subfile_dir2 in deleted list, new subfile, s1 in new subfile).
  hdfs.rename(foo, subfile_dir2, Rename.OVERWRITE);
  
  // check dir2
  INode dir2Node = fsdir.getINode4Write(dir2.toString());
  assertTrue(dir2Node.asDirectory().isSnapshottable());
  QuotaCounts counts = dir2Node.computeQuotaUsage(
      fsdir.getBlockStoragePolicySuite());
  assertEquals(4, counts.getNameSpace());
  assertEquals(BLOCKSIZE * REPL * 2, counts.getStorageSpace());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:39,代码来源:TestRenameWithSnapshots.java


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