HBASE-2978 LoadBalancer IndexOutOfBoundsException
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@995679 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
94b78b4997
commit
32800d3be6
|
@ -517,6 +517,7 @@ Release 0.21.0 - Unreleased
|
||||||
HBASE-2973 NPE in LogCleaner
|
HBASE-2973 NPE in LogCleaner
|
||||||
HBASE-2974 LoadBalancer ArithmeticException: / by zero
|
HBASE-2974 LoadBalancer ArithmeticException: / by zero
|
||||||
HBASE-2975 DFSClient names in master and RS should be unique
|
HBASE-2975 DFSClient names in master and RS should be unique
|
||||||
|
HBASE-2978 LoadBalancer IndexOutOfBoundsException
|
||||||
|
|
||||||
IMPROVEMENTS
|
IMPROVEMENTS
|
||||||
HBASE-1760 Cleanup TODOs in HTable
|
HBASE-1760 Cleanup TODOs in HTable
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.hbase.master;
|
package org.apache.hadoop.hbase.master;
|
||||||
|
|
||||||
import java.io.DataInput;
|
|
||||||
import java.io.DataOutput;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
@ -39,7 +37,6 @@ import org.apache.hadoop.fs.FileSystem;
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
import org.apache.hadoop.hbase.HRegionInfo;
|
import org.apache.hadoop.hbase.HRegionInfo;
|
||||||
import org.apache.hadoop.hbase.HServerInfo;
|
import org.apache.hadoop.hbase.HServerInfo;
|
||||||
import org.apache.hadoop.io.Writable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes decisions about the placement and movement of Regions across
|
* Makes decisions about the placement and movement of Regions across
|
||||||
|
@ -131,8 +128,6 @@ public class LoadBalancer {
|
||||||
*/
|
*/
|
||||||
public List<RegionPlan> balanceCluster(
|
public List<RegionPlan> balanceCluster(
|
||||||
Map<HServerInfo,List<HRegionInfo>> clusterState) {
|
Map<HServerInfo,List<HRegionInfo>> clusterState) {
|
||||||
LOG.debug("Running load balancer");
|
|
||||||
|
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
// Make a map sorted by load and count regions
|
// Make a map sorted by load and count regions
|
||||||
|
@ -141,7 +136,7 @@ public class LoadBalancer {
|
||||||
new HServerInfo.LoadComparator());
|
new HServerInfo.LoadComparator());
|
||||||
int numServers = clusterState.size();
|
int numServers = clusterState.size();
|
||||||
if (numServers == 0) {
|
if (numServers == 0) {
|
||||||
LOG.debug("numServers=0 so nothing to balance");
|
LOG.debug("numServers=0 so skipping load balancing");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
int numRegions = 0;
|
int numRegions = 0;
|
||||||
|
@ -240,13 +235,14 @@ public class LoadBalancer {
|
||||||
// Either more regions to assign out or servers that are still underloaded
|
// Either more regions to assign out or servers that are still underloaded
|
||||||
|
|
||||||
// If we need more to fill min, grab one from each most loaded until enough
|
// If we need more to fill min, grab one from each most loaded until enough
|
||||||
if(neededRegions != 0) {
|
if (neededRegions != 0) {
|
||||||
// Walk down most loaded, grabbing one from each until we get enough
|
// Walk down most loaded, grabbing one from each until we get enough
|
||||||
for(Map.Entry<HServerInfo, List<HRegionInfo>> server :
|
for(Map.Entry<HServerInfo, List<HRegionInfo>> server :
|
||||||
serversByLoad.descendingMap().entrySet()) {
|
serversByLoad.descendingMap().entrySet()) {
|
||||||
BalanceInfo balanceInfo = serverBalanceInfo.get(server.getKey());
|
BalanceInfo balanceInfo = serverBalanceInfo.get(server.getKey());
|
||||||
int idx =
|
int idx =
|
||||||
balanceInfo == null ? 0 : balanceInfo.getNextRegionForUnload();
|
balanceInfo == null ? 0 : balanceInfo.getNextRegionForUnload();
|
||||||
|
if (idx >= server.getValue().size()) break;
|
||||||
HRegionInfo region = server.getValue().get(idx);
|
HRegionInfo region = server.getValue().get(idx);
|
||||||
if (region.isMetaRegion()) continue; // Don't move meta regions.
|
if (region.isMetaRegion()) continue; // Don't move meta regions.
|
||||||
regionsToMove.add(new RegionPlan(region, server.getKey(), null));
|
regionsToMove.add(new RegionPlan(region, server.getKey(), null));
|
||||||
|
|
Loading…
Reference in New Issue