HBASE-10498 Add new APIs to load balancer interface(Rajesh)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1568188 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
rajeshbabu 2014-02-14 02:21:16 +00:00
parent f1ad5cb938
commit d727e505be
3 changed files with 24 additions and 0 deletions

View File

@ -1279,6 +1279,7 @@ public class AssignmentManager extends ZooKeeperListener {
clearRegionPlan(regionInfo);
// Add the server to serversInUpdatingTimer
addToServersInUpdatingTimer(sn);
balancer.regionOnline(regionInfo, sn);
}
/**
@ -2667,6 +2668,7 @@ public class AssignmentManager extends ZooKeeperListener {
if (!disabledOrEnablingTables.contains(tableName)) {
regionStates.updateRegionState(regionInfo, State.OPEN, regionLocation);
regionStates.regionOnline(regionInfo, regionLocation);
balancer.regionOnline(regionInfo, regionLocation);
}
// need to enable the table if not disabled or disabling or enabling
// this will be used in rolling restarts
@ -3514,6 +3516,7 @@ public class AssignmentManager extends ZooKeeperListener {
removeClosedRegion(regionInfo);
// remove the region plan as well just in case.
clearRegionPlan(regionInfo);
balancer.regionOffline(regionInfo);
}
/**

View File

@ -117,4 +117,17 @@ public interface LoadBalancer extends Configurable, Stoppable {
* @throws HBaseIOException
*/
void initialize() throws HBaseIOException;
/**
* Marks the region as online at balancer.
* @param regionInfo
* @param sn
*/
void regionOnline(HRegionInfo regionInfo, ServerName sn);
/**
* Marks the region as offline at balancer.
* @param regionInfo
*/
void regionOffline(HRegionInfo regionInfo);
}

View File

@ -585,6 +585,14 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
public void initialize() throws HBaseIOException{
}
@Override
public void regionOnline(HRegionInfo regionInfo, ServerName sn) {
}
@Override
public void regionOffline(HRegionInfo regionInfo) {
}
@Override
public boolean isStopped() {
return stopped;