HBASE-21102 ServerCrashProcedure should select target server where no other replicas exist for the current region - addendum fixes NPE
This commit is contained in:
parent
cebb725a9f
commit
69431c75c1
|
@ -51,6 +51,7 @@ import org.apache.hadoop.hbase.master.LoadBalancer;
|
||||||
import org.apache.hadoop.hbase.master.MasterServices;
|
import org.apache.hadoop.hbase.master.MasterServices;
|
||||||
import org.apache.hadoop.hbase.master.RackManager;
|
import org.apache.hadoop.hbase.master.RackManager;
|
||||||
import org.apache.hadoop.hbase.master.RegionPlan;
|
import org.apache.hadoop.hbase.master.RegionPlan;
|
||||||
|
import org.apache.hadoop.hbase.master.assignment.RegionStates;
|
||||||
import org.apache.hadoop.hbase.master.balancer.BaseLoadBalancer.Cluster.Action.Type;
|
import org.apache.hadoop.hbase.master.balancer.BaseLoadBalancer.Cluster.Action.Type;
|
||||||
import org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
|
import org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
|
||||||
import org.apache.hbase.thirdparty.com.google.common.base.Joiner;
|
import org.apache.hbase.thirdparty.com.google.common.base.Joiner;
|
||||||
|
@ -1457,8 +1458,9 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
|
||||||
// In the current set of regions even if one has region replica let us go with
|
// In the current set of regions even if one has region replica let us go with
|
||||||
// getting the entire snapshot
|
// getting the entire snapshot
|
||||||
if (this.services != null && this.services.getAssignmentManager() != null) { // for tests
|
if (this.services != null && this.services.getAssignmentManager() != null) { // for tests
|
||||||
if (!hasRegionReplica && this.services.getAssignmentManager().getRegionStates()
|
RegionStates states = this.services.getAssignmentManager().getRegionStates();
|
||||||
.isReplicaAvailableForRegion(region)) {
|
if (!hasRegionReplica && states != null &&
|
||||||
|
states.isReplicaAvailableForRegion(region)) {
|
||||||
hasRegionReplica = true;
|
hasRegionReplica = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue