本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}