diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java index a576942b77f..810f5ecfdf3 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java @@ -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); } /** diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java index 379babef94b..5538ac0c299 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java @@ -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); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java index 710796be75a..98d8eebf48b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java @@ -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;