@InterfaceAudience.Private public class MaintenanceLoadBalancer extends Object implements LoadBalancer
Modifier and Type | Field and Description |
---|---|
private boolean |
stopped |
BOGUS_SERVER_NAME, HBASE_RSGROUP_LOADBALANCER_CLASS
Constructor and Description |
---|
MaintenanceLoadBalancer() |
Modifier and Type | Method and Description |
---|---|
private Map<ServerName,List<RegionInfo>> |
assign(Collection<RegionInfo> regions,
List<ServerName> servers) |
List<RegionPlan> |
balanceCluster(Map<TableName,Map<ServerName,List<RegionInfo>>> loadOfAllTable)
Perform the major balance operation for cluster.
|
void |
initialize()
Initialize the load balancer.
|
boolean |
isStopped()
Returns True if
Stoppable.stop(String) has been closed. |
void |
onConfigurationChange(org.apache.hadoop.conf.Configuration conf)
Notification that config has changed
|
void |
postMasterStartupInitialize()
If balancer needs to do initialization after Master has started up, lets do that here.
|
ServerName |
randomAssignment(RegionInfo regionInfo,
List<ServerName> servers)
Get a random region server from the list
|
void |
regionOffline(RegionInfo regionInfo)
Marks the region as offline at balancer.
|
void |
regionOnline(RegionInfo regionInfo,
ServerName sn)
Marks the region as online at balancer.
|
Map<ServerName,List<RegionInfo>> |
retainAssignment(Map<RegionInfo,ServerName> regions,
List<ServerName> servers)
Assign regions to the previously hosting region server
|
Map<ServerName,List<RegionInfo>> |
roundRobinAssignment(List<RegionInfo> regions,
List<ServerName> servers)
Perform a Round Robin assignment of regions.
|
void |
setClusterInfoProvider(ClusterInfoProvider provider)
Set the cluster info provider.
|
void |
stop(String why)
Stop this service.
|
void |
updateBalancerStatus(boolean status) |
void |
updateClusterMetrics(ClusterMetrics st)
Set the current cluster status.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
updateBalancerLoadInfo
private volatile boolean stopped
public MaintenanceLoadBalancer()
public void stop(String why)
Stoppable
public boolean isStopped()
Stoppable
Stoppable.stop(String)
has been closed.public void updateClusterMetrics(ClusterMetrics st)
LoadBalancer
updateClusterMetrics
in interface LoadBalancer
public void setClusterInfoProvider(ClusterInfoProvider provider)
LoadBalancer
setClusterInfoProvider
in interface LoadBalancer
public List<RegionPlan> balanceCluster(Map<TableName,Map<ServerName,List<RegionInfo>>> loadOfAllTable) throws IOException
LoadBalancer
balanceCluster
in interface LoadBalancer
loadOfAllTable
- region load of servers for all tableIOException
private Map<ServerName,List<RegionInfo>> assign(Collection<RegionInfo> regions, List<ServerName> servers)
public Map<ServerName,List<RegionInfo>> roundRobinAssignment(List<RegionInfo> regions, List<ServerName> servers) throws IOException
LoadBalancer
roundRobinAssignment
in interface LoadBalancer
IOException
public Map<ServerName,List<RegionInfo>> retainAssignment(Map<RegionInfo,ServerName> regions, List<ServerName> servers) throws IOException
LoadBalancer
retainAssignment
in interface LoadBalancer
IOException
public ServerName randomAssignment(RegionInfo regionInfo, List<ServerName> servers) throws IOException
LoadBalancer
randomAssignment
in interface LoadBalancer
regionInfo
- Region for which this selection is being done.IOException
public void initialize()
LoadBalancer
initialize
in interface LoadBalancer
public void regionOnline(RegionInfo regionInfo, ServerName sn)
LoadBalancer
regionOnline
in interface LoadBalancer
public void regionOffline(RegionInfo regionInfo)
LoadBalancer
regionOffline
in interface LoadBalancer
public void onConfigurationChange(org.apache.hadoop.conf.Configuration conf)
LoadBalancer
onConfigurationChange
in interface ConfigurationObserver
onConfigurationChange
in interface LoadBalancer
public void postMasterStartupInitialize()
LoadBalancer
postMasterStartupInitialize
in interface LoadBalancer
public void updateBalancerStatus(boolean status)
updateBalancerStatus
in interface LoadBalancer
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.