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


Java RegionPlan.getDestination方法代码示例

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


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

示例1: reconcile

import org.apache.hadoop.hbase.master.RegionPlan; //导入方法依赖的package包/类
/**
 * This assumes the RegionPlan HSI instances are the same ones in the map, so
 * actually no need to even pass in the map, but I think it's clearer.
 *
 * @param list
 * @param plans
 * @return
 */
protected List<ServerAndLoad> reconcile(List<ServerAndLoad> list,
                                        List<RegionPlan> plans,
                                        Map<ServerName, List<HRegionInfo>> servers) {
  List<ServerAndLoad> result = new ArrayList<ServerAndLoad>(list.size());

  Map<ServerName, ServerAndLoad> map = new HashMap<ServerName, ServerAndLoad>(list.size());
  for (ServerAndLoad sl : list) {
    map.put(sl.getServerName(), sl);
  }
  if (plans != null) {
    for (RegionPlan plan : plans) {
      ServerName source = plan.getSource();

      updateLoad(map, source, -1);
      ServerName destination = plan.getDestination();
      updateLoad(map, destination, +1);

      servers.get(source).remove(plan.getRegionInfo());
      servers.get(destination).add(plan.getRegionInfo());
    }
  }
  result.clear();
  result.addAll(map.values());
  return result;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:34,代码来源:BalancerTestBase.java

示例2: reconcile

import org.apache.hadoop.hbase.master.RegionPlan; //导入方法依赖的package包/类
/**
 * This assumes the RegionPlan HSI instances are the same ones in the map, so
 * actually no need to even pass in the map, but I think it's clearer.
 *
 * @param list
 * @param plans
 * @return
 */
protected List<ServerAndLoad> reconcile(List<ServerAndLoad> list,
                                        List<RegionPlan> plans,
                                        Map<ServerName, List<HRegionInfo>> servers) {
  List<ServerAndLoad> result = new ArrayList<ServerAndLoad>(list.size());
  if (plans == null) return result;
  Map<ServerName, ServerAndLoad> map = new HashMap<ServerName, ServerAndLoad>(list.size());
  for (ServerAndLoad sl : list) {
    map.put(sl.getServerName(), sl);
  }
  for (RegionPlan plan : plans) {
    ServerName source = plan.getSource();

    updateLoad(map, source, -1);
    ServerName destination = plan.getDestination();
    updateLoad(map, destination, +1);

    servers.get(source).remove(plan.getRegionInfo());
    servers.get(destination).add(plan.getRegionInfo());
  }
  result.clear();
  result.addAll(map.values());
  return result;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:32,代码来源:BalancerTestBase.java

示例3: createMoveRegionProcedure

import org.apache.hadoop.hbase.master.RegionPlan; //导入方法依赖的package包/类
public MoveRegionProcedure createMoveRegionProcedure(final RegionPlan plan) {
  if (plan.getRegionInfo().getTable().isSystemTable()) {
    List<ServerName> exclude = getExcludedServersForSystemTable();
    if (plan.getDestination() != null && exclude.contains(plan.getDestination())) {
      try {
        LOG.info("Can not move " + plan.getRegionInfo() + " to " + plan.getDestination()
            + " because the server is not with highest version");
        plan.setDestination(getBalancer().randomAssignment(plan.getRegionInfo(),
            this.master.getServerManager().createDestinationServersList(exclude)));
      } catch (HBaseIOException e) {
        LOG.warn(e.toString(), e);
      }
    }
  }
  return new MoveRegionProcedure(getProcedureEnvironment(), plan);
}
 
开发者ID:apache,项目名称:hbase,代码行数:17,代码来源:AssignmentManager.java

示例4: reconcile

import org.apache.hadoop.hbase.master.RegionPlan; //导入方法依赖的package包/类
/**
 * This assumes the RegionPlan HSI instances are the same ones in the map, so
 * actually no need to even pass in the map, but I think it's clearer.
 *
 * @param list
 * @param plans
 * @return
 */
protected List<ServerAndLoad> reconcile(List<ServerAndLoad> list,
                                        List<RegionPlan> plans,
                                        Map<ServerName, List<RegionInfo>> servers) {
  List<ServerAndLoad> result = new ArrayList<>(list.size());

  Map<ServerName, ServerAndLoad> map = new HashMap<>(list.size());
  for (ServerAndLoad sl : list) {
    map.put(sl.getServerName(), sl);
  }
  if (plans != null) {
    for (RegionPlan plan : plans) {
      ServerName source = plan.getSource();

      updateLoad(map, source, -1);
      ServerName destination = plan.getDestination();
      updateLoad(map, destination, +1);

      servers.get(source).remove(plan.getRegionInfo());
      servers.get(destination).add(plan.getRegionInfo());
    }
  }
  result.clear();
  result.addAll(map.values());
  return result;
}
 
开发者ID:apache,项目名称:hbase,代码行数:34,代码来源:BalancerTestBase.java

示例5: reconcile

import org.apache.hadoop.hbase.master.RegionPlan; //导入方法依赖的package包/类
private ArrayListMultimap<String, ServerAndLoad> reconcile(
    ArrayListMultimap<String, ServerAndLoad> previousLoad,
    List<RegionPlan> plans) {
  ArrayListMultimap<String, ServerAndLoad> result = ArrayListMultimap
      .create();
  result.putAll(previousLoad);
  if (plans != null) {
    for (RegionPlan plan : plans) {
      ServerName source = plan.getSource();
      updateLoad(result, source, -1);
      ServerName destination = plan.getDestination();
      updateLoad(result, destination, +1);
    }
  }
  return result;
}
 
开发者ID:apache,项目名称:hbase,代码行数:17,代码来源:TestRSGroupBasedLoadBalancer.java

示例6: reconcile

import org.apache.hadoop.hbase.master.RegionPlan; //导入方法依赖的package包/类
/**
 * This assumes the RegionPlan HSI instances are the same ones in the map, so
 * actually no need to even pass in the map, but I think it's clearer.
 *
 * @param list
 * @param plans
 * @return
 */
protected List<ServerAndLoad> reconcile(List<ServerAndLoad> list, List<RegionPlan> plans) {
  List<ServerAndLoad> result = new ArrayList<ServerAndLoad>(list.size());
  if (plans == null) return result;
  Map<ServerName, ServerAndLoad> map = new HashMap<ServerName, ServerAndLoad>(list.size());
  for (ServerAndLoad sl : list) {
    map.put(sl.getServerName(), sl);
  }
  for (RegionPlan plan : plans) {
    ServerName source = plan.getSource();
    updateLoad(map, source, -1);
    ServerName destination = plan.getDestination();
    updateLoad(map, destination, +1);
  }
  result.clear();
  result.addAll(map.values());
  return result;
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:26,代码来源:BalancerTestBase.java

示例7: prepareIndexPlan

import org.apache.hadoop.hbase.master.RegionPlan; //导入方法依赖的package包/类
private List<RegionPlan> prepareIndexPlan(Map<ServerName, List<HRegionInfo>> indexClusterState,
    List<RegionPlan> regionPlanList, List<RegionPlan> regionPlanListCopy) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Entered prepareIndexPlan");
  }
  OUTER_LOOP: for (RegionPlan regionPlan : regionPlanListCopy) {
    HRegionInfo hri = regionPlan.getRegionInfo();

    MIDDLE_LOOP: for (Entry<ServerName, List<HRegionInfo>> serverVsRegionList : indexClusterState
        .entrySet()) {
      List<HRegionInfo> indexRegions = serverVsRegionList.getValue();
      ServerName server = serverVsRegionList.getKey();
      if (regionPlan.getDestination().equals(server)) {
        // desination server in the region plan is new and should not be same with this
        // server in index cluster state.thats why skipping regions check in this server
        continue MIDDLE_LOOP;
      }
      String actualTableName = null;

      for (HRegionInfo indexRegionInfo : indexRegions) {
        String indexTableName = indexRegionInfo.getTable().getNameAsString();
        actualTableName = extractActualTableName(indexTableName);
        if (false == hri.getTable().getNameAsString().equals(actualTableName)) {
          continue;
        }
        if (0 != Bytes.compareTo(hri.getStartKey(), indexRegionInfo.getStartKey())) {
          continue;
        }
        RegionPlan rp = new RegionPlan(indexRegionInfo, server, regionPlan.getDestination());
        if (LOG.isDebugEnabled()) {
          LOG.debug("Selected server " + regionPlan.getDestination()
              + " as destination for region " + indexRegionInfo.getRegionNameAsString()
              + "from user region plan.");
        }

        regionOnline(indexRegionInfo, regionPlan.getDestination());
        regionPlanList.add(rp);
        continue OUTER_LOOP;
      }
    }
  }
  regionPlanListCopy.clear();
  // if no user regions to balance then return newly formed index region plan.
  if (LOG.isDebugEnabled()) {
    LOG.debug("Exited prepareIndexPlan");
  }
  return regionPlanList;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:49,代码来源:SecIndexLoadBalancer.java

示例8: getRegionPlan

import org.apache.hadoop.hbase.master.RegionPlan; //导入方法依赖的package包/类
/**
 * @param state
 * @param serverToExclude Server to exclude (we know its bad). Pass null if
 * all servers are thought to be assignable.
 * @param forceNewPlan If true, then if an existing plan exists, a new plan
 * will be generated.
 * @return Plan for passed <code>state</code> (If none currently, it creates one or
 * if no servers to assign, it returns null).
 */
RegionPlan getRegionPlan(final RegionState state,
    final ServerName serverToExclude, final boolean forceNewPlan) {
  // Pickup existing plan or make a new one
  final String encodedName = state.getRegion().getEncodedName();
  final List<ServerName> servers = this.serverManager.getOnlineServersList();
  final List<ServerName> drainingServers = this.serverManager.getDrainingServersList();

  if (serverToExclude != null) servers.remove(serverToExclude);

  // Loop through the draining server list and remove them from the server
  // list.
  if (!drainingServers.isEmpty()) {
    for (final ServerName server: drainingServers) {
      LOG.debug("Removing draining server: " + server +
          " from eligible server pool.");
      servers.remove(server);
    }
  }

  if (servers.isEmpty()) return null;

  RegionPlan randomPlan = new RegionPlan(state.getRegion(), null,
    balancer.randomAssignment(servers));
  boolean newPlan = false;
  RegionPlan existingPlan = null;

  synchronized (this.regionPlans) {
    existingPlan = this.regionPlans.get(encodedName);

    if (existingPlan != null && existingPlan.getDestination() != null) {
      LOG.debug("Found an existing plan for " +
          state.getRegion().getRegionNameAsString() +
     " destination server is " + existingPlan.getDestination().toString());
    }

    if (forceNewPlan
        || existingPlan == null
        || existingPlan.getDestination() == null
        || drainingServers.contains(existingPlan.getDestination())) {
      newPlan = true;
      this.regionPlans.put(encodedName, randomPlan);
    }
  }

  if (newPlan) {
    LOG.debug("No previous transition plan was found (or we are ignoring " +
      "an existing plan) for " + state.getRegion().getRegionNameAsString() +
      " so generated a random one; " + randomPlan + "; " +
      serverManager.countOfRegionServers() +
             " (online=" + serverManager.getOnlineServers().size() +
             ", exclude=" + drainingServers.size() + ") available servers");
      return randomPlan;
    }
  LOG.debug("Using pre-existing plan for region " +
             state.getRegion().getRegionNameAsString() + "; plan=" + existingPlan);
    return existingPlan;
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:67,代码来源:AssignmentManager.java

示例9: prepareIndexPlan

import org.apache.hadoop.hbase.master.RegionPlan; //导入方法依赖的package包/类
private List<RegionPlan> prepareIndexPlan(Map<ServerName, List<HRegionInfo>> indexClusterState,
    List<RegionPlan> regionPlanList, List<RegionPlan> regionPlanListCopy) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Entered prepareIndexPlan");
  }
  OUTER_LOOP: for (RegionPlan regionPlan : regionPlanListCopy) {
    HRegionInfo hri = regionPlan.getRegionInfo();

    MIDDLE_LOOP: for (Entry<ServerName, List<HRegionInfo>> serverVsRegionList : indexClusterState
        .entrySet()) {
      List<HRegionInfo> indexRegions = serverVsRegionList.getValue();
      ServerName server = serverVsRegionList.getKey();
      if (regionPlan.getDestination().equals(server)) {
        // desination server in the region plan is new and should not be same with this
        // server in index cluster state.thats why skipping regions check in this server
        continue MIDDLE_LOOP;
      }
      String actualTableName = null;

      for (HRegionInfo indexRegionInfo : indexRegions) {
        String indexTableName = indexRegionInfo.getTableNameAsString();
        actualTableName = extractActualTableName(indexTableName);
        if (false == hri.getTableNameAsString().equals(actualTableName)) {
          continue;
        }
        if (0 != Bytes.compareTo(hri.getStartKey(), indexRegionInfo.getStartKey())) {
          continue;
        }
        RegionPlan rp = new RegionPlan(indexRegionInfo, server, regionPlan.getDestination());
        if (LOG.isDebugEnabled()) {
          LOG.debug("Selected server " + regionPlan.getDestination()
              + " as destination for region " + indexRegionInfo.getRegionNameAsString()
              + "from user region plan.");
        }

        putRegionPlan(indexRegionInfo, regionPlan.getDestination());
        regionPlanList.add(rp);
        continue OUTER_LOOP;
      }
    }
  }
  regionPlanListCopy.clear();
  // if no user regions to balance then return newly formed index region plan.
  if (LOG.isDebugEnabled()) {
    LOG.debug("Exited prepareIndexPlan");
  }
  return regionPlanList;
}
 
开发者ID:Huawei-Hadoop,项目名称:hindex,代码行数:49,代码来源:SecIndexLoadBalancer.java


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