HBASE-18765 The value of balancerRan is true even though no plans are executed

This commit is contained in:
Chia-Ping Tsai 2017-09-07 02:11:49 +08:00
parent baecf33ea6
commit 7b2ce38b4b
1 changed files with 3 additions and 4 deletions

View File

@ -492,7 +492,6 @@ public class RSGroupAdminServer implements RSGroupAdmin {
AssignmentManager assignmentManager = master.getAssignmentManager(); AssignmentManager assignmentManager = master.getAssignmentManager();
LoadBalancer balancer = master.getLoadBalancer(); LoadBalancer balancer = master.getLoadBalancer();
boolean balancerRan;
synchronized (balancer) { synchronized (balancer) {
// If balance not true, don't run balancer. // If balance not true, don't run balancer.
if (!((HMaster) master).isBalancerOn()) return false; if (!((HMaster) master).isBalancerOn()) return false;
@ -530,8 +529,8 @@ public class RSGroupAdminServer implements RSGroupAdmin {
} }
} }
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
balancerRan = plans != null; boolean balancerRan = !plans.isEmpty();
if (plans != null && !plans.isEmpty()) { if (balancerRan) {
LOG.info("RSGroup balance " + groupName + " starting with plan count: " + plans.size()); LOG.info("RSGroup balance " + groupName + " starting with plan count: " + plans.size());
for (RegionPlan plan: plans) { for (RegionPlan plan: plans) {
LOG.info("balance " + plan); LOG.info("balance " + plan);
@ -543,9 +542,9 @@ public class RSGroupAdminServer implements RSGroupAdmin {
if (master.getMasterCoprocessorHost() != null) { if (master.getMasterCoprocessorHost() != null) {
master.getMasterCoprocessorHost().postBalanceRSGroup(groupName, balancerRan); master.getMasterCoprocessorHost().postBalanceRSGroup(groupName, balancerRan);
} }
}
return balancerRan; return balancerRan;
} }
}
@Override @Override
public List<RSGroupInfo> listRSGroups() throws IOException { public List<RSGroupInfo> listRSGroups() throws IOException {