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


Java FSUtils.getRegionDegreeLocalityMappingFromFS方法代码示例

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


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

示例1: verifyRegionPlacement

import org.apache.hadoop.hbase.util.FSUtils; //导入方法依赖的package包/类
/**
 * Verify the region placement is consistent with the assignment plan
 * @param isDetailMode
 * @return reports
 * @throws IOException
 */
public List<AssignmentVerificationReport> verifyRegionPlacement(boolean isDetailMode)
    throws IOException {
  System.out.println("Start to verify the region assignment and " +
      "generate the verification report");
  // Get the region assignment snapshot
  SnapshotOfRegionAssignmentFromMeta snapshot = this.getRegionAssignmentSnapshot();

  // Get all the tables
  Set<TableName> tables = snapshot.getTableSet();

  // Get the region locality map
  Map<String, Map<String, Float>> regionLocalityMap = null;
  if (this.enforceLocality == true) {
    regionLocalityMap = FSUtils.getRegionDegreeLocalityMappingFromFS(conf);
  }
  List<AssignmentVerificationReport> reports = new ArrayList<AssignmentVerificationReport>();
  // Iterate all the tables to fill up the verification report
  for (TableName table : tables) {
    if (!this.targetTableSet.isEmpty() &&
        !this.targetTableSet.contains(table)) {
      continue;
    }
    AssignmentVerificationReport report = new AssignmentVerificationReport();
    report.fillUp(table, snapshot, regionLocalityMap);
    report.print(isDetailMode);
    reports.add(report);
  }
  return reports;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:36,代码来源:RegionPlacementMaintainer.java

示例2: getNewAssignmentPlan

import org.apache.hadoop.hbase.util.FSUtils; //导入方法依赖的package包/类
public FavoredNodesPlan getNewAssignmentPlan() throws IOException {
  // Get the current region assignment snapshot by scanning from the META
  SnapshotOfRegionAssignmentFromMeta assignmentSnapshot =
    this.getRegionAssignmentSnapshot();

  // Get the region locality map
  Map<String, Map<String, Float>> regionLocalityMap = null;
  if (this.enforceLocality) {
    regionLocalityMap = FSUtils.getRegionDegreeLocalityMappingFromFS(conf);
  }
  // Initialize the assignment plan
  FavoredNodesPlan plan = new FavoredNodesPlan();

  // Get the table to region mapping
  Map<TableName, List<HRegionInfo>> tableToRegionMap =
    assignmentSnapshot.getTableToRegionMap();
  LOG.info("Start to generate the new assignment plan for the " +
       + tableToRegionMap.keySet().size() + " tables" );
  for (TableName table : tableToRegionMap.keySet()) {
    try {
      if (!this.targetTableSet.isEmpty() &&
          !this.targetTableSet.contains(table)) {
        continue;
      }
      // TODO: maybe run the placement in parallel for each table
      genAssignmentPlan(table, assignmentSnapshot, regionLocalityMap, plan,
          USE_MUNKRES_FOR_PLACING_SECONDARY_AND_TERTIARY);
    } catch (Exception e) {
      LOG.error("Get some exceptions for placing primary region server" +
          "for table " + table + " because " + e);
    }
  }
  LOG.info("Finish to generate the new assignment plan for the " +
      + tableToRegionMap.keySet().size() + " tables" );
  return plan;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:37,代码来源:RegionPlacementMaintainer.java


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