HBASE-18602 rsgroup cleanup unassign code

Signed-off-by: Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
Wang, Xinglong 2017-10-31 03:02:57 +08:00 committed by Chia-Ping Tsai
parent 3de44f918b
commit 06ae2869e2
1 changed files with 2 additions and 15 deletions

View File

@ -29,7 +29,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
@ -45,15 +44,14 @@ import org.apache.hadoop.hbase.master.MasterServices;
import org.apache.hadoop.hbase.master.RegionPlan;
import org.apache.hadoop.hbase.master.balancer.StochasticLoadBalancer;
import org.apache.hadoop.hbase.net.Address;
import org.apache.hadoop.util.ReflectionUtils;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.hbase.shaded.com.google.common.annotations.VisibleForTesting;
import org.apache.hadoop.hbase.shaded.com.google.common.collect.ArrayListMultimap;
import org.apache.hadoop.hbase.shaded.com.google.common.collect.LinkedListMultimap;
import org.apache.hadoop.hbase.shaded.com.google.common.collect.ListMultimap;
import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
import org.apache.hadoop.hbase.shaded.com.google.common.collect.Maps;
import org.apache.hadoop.util.ReflectionUtils;
import org.apache.yetus.audience.InterfaceAudience;
/**
* GroupBasedLoadBalancer, used when Region Server Grouping is configured (HBase-6721)
@ -341,7 +339,6 @@ public class RSGroupBasedLoadBalancer implements RSGroupableBalancer {
Map<ServerName, List<RegionInfo>> existingAssignments)
throws HBaseIOException{
Map<ServerName, List<RegionInfo>> correctAssignments = new TreeMap<>();
List<RegionInfo> misplacedRegions = new LinkedList<>();
correctAssignments.put(LoadBalancer.BOGUS_SERVER_NAME, new LinkedList<>());
for (Map.Entry<ServerName, List<RegionInfo>> assignments : existingAssignments.entrySet()){
ServerName sName = assignments.getKey();
@ -363,16 +360,6 @@ public class RSGroupBasedLoadBalancer implements RSGroupableBalancer {
}
}
}
//TODO bulk unassign?
//unassign misplaced regions, so that they are assigned to correct groups.
for(RegionInfo info: misplacedRegions) {
try {
this.masterServices.getAssignmentManager().unassign(info);
} catch (IOException e) {
throw new HBaseIOException(e);
}
}
return correctAssignments;
}