bharathv commented on a change in pull request #3219:
URL: https://github.com/apache/hbase/pull/3219#discussion_r625261529



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java
##########
@@ -571,23 +571,37 @@ public ServerName getRegionServerOfRegion(RegionInfo 
regionInfo) {
    * wants to iterate this exported list.  We need to synchronize on regions
    * since all access to this.servers is under a lock on this.regions.
    *
-   * @return A clone of current assignments.
+   * @return A clone of current open or opening assignments.
    */
   public Map<TableName, Map<ServerName, List<RegionInfo>>> 
getAssignmentsForBalancer(
       TableStateManager tableStateManager, List<ServerName> onlineServers) {
     final Map<TableName, Map<ServerName, List<RegionInfo>>> result = new 
HashMap<>();
     for (RegionStateNode node : regionsMap.values()) {
+      // DisableTableProcedure first sets the table state to DISABLED and then 
force unassigns
+      // the regions in a loop. The balancer should ignore all regions for 
tables in DISABLED
+      // state because even if still currently open we expect them to be 
offlined very soon.
       if (isTableDisabled(tableStateManager, node.getTable())) {
+        if (LOG.isTraceEnabled()) {
+          LOG.trace("Ignoring {} because table is disabled", node);
+        }
         continue;
       }
-      if (node.getRegionInfo().isSplitParent()) {
+      // When balancing, we are only interested in OPEN or OPENING regions. 
These can be
+      // expected to remain online until the next balancer iteration or unless 
the balancer
+      // decides to move it. Regions in other states are not eligible for 
balancing, because
+      // they are closing, splitting, merging, or otherwise already in 
transition.
+      if (!node.isInState(State.OPEN, State.OPENING)) {
+        if (LOG.isTraceEnabled()) {

Review comment:
       Doing both isTraceEnabled() check and parameterized logging seems 
wasteful, its usually either one or the other.. I think the recommendation from 
log4j is to do the latter for concise code and avoid unnecessary temporary 
string objects... 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to