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


Java FSUtils.computeHDFSBlocksDistribution方法代码示例

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


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

示例1: getStoreDirHosts

import org.apache.hadoop.hbase.util.FSUtils; //导入方法依赖的package包/类
/**
 * return the top hosts of the store files, used by the Split
 */
private static String[] getStoreDirHosts(final FileSystem fs, final Path path)
    throws IOException {
  FileStatus[] files = FSUtils.listStatus(fs, path);
  if (files == null) {
    return new String[] {};
  }

  HDFSBlocksDistribution hdfsBlocksDistribution = new HDFSBlocksDistribution();
  for (FileStatus hfileStatus: files) {
    HDFSBlocksDistribution storeFileBlocksDistribution =
      FSUtils.computeHDFSBlocksDistribution(fs, hfileStatus, 0, hfileStatus.getLen());
    hdfsBlocksDistribution.add(storeFileBlocksDistribution);
  }

  List<String> hosts = hdfsBlocksDistribution.getTopHosts();
  return hosts.toArray(new String[hosts.size()]);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:21,代码来源:CompactionTool.java

示例2: computeRefFileHDFSBlockDistribution

import org.apache.hadoop.hbase.util.FSUtils; //导入方法依赖的package包/类
/**
 * helper function to compute HDFS blocks distribution of a given reference file.For reference
 * file, we don't compute the exact value. We use some estimate instead given it might be good
 * enough. we assume bottom part takes the first half of reference file, top part takes the second
 * half of the reference file. This is just estimate, given midkey ofregion != midkey of HFile,
 * also the number and size of keys vary. If this estimate isn't good enough, we can improve it
 * later.
 *
 * @param fs        The FileSystem
 * @param reference The reference
 * @param status    The reference FileStatus
 * @return HDFS blocks distribution
 */
private static HDFSBlocksDistribution computeRefFileHDFSBlockDistribution(final FileSystem fs,
    final Reference reference, final FileStatus status) throws IOException {
  if (status == null) {
    return null;
  }

  long start = 0;
  long length = 0;

  if (Reference.isTopFileRegion(reference.getFileRegion())) {
    start = status.getLen() / 2;
    length = status.getLen() - status.getLen() / 2;
  } else {
    start = 0;
    length = status.getLen() / 2;
  }
  return FSUtils.computeHDFSBlocksDistribution(fs, status, start, length);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:32,代码来源:StoreFileInfo.java

示例3: computeHDFSBlocksDistributionInternal

import org.apache.hadoop.hbase.util.FSUtils; //导入方法依赖的package包/类
private HDFSBlocksDistribution computeHDFSBlocksDistributionInternal(final FileSystem fs)
    throws IOException {
  FileStatus status = getReferencedFileStatus(fs);
  if (this.reference != null) {
    return computeRefFileHDFSBlockDistribution(fs, reference, status);
  } else {
    return FSUtils.computeHDFSBlocksDistribution(fs, status, 0, status.getLen());
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:10,代码来源:StoreFileInfo.java


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