HBASE-3315 Add debug output for when balancer makes bad balance

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1042882 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-12-07 00:58:05 +00:00
parent 971dc6d431
commit d547429a14
2 changed files with 15 additions and 5 deletions

View File

@ -745,6 +745,7 @@ Release 0.90.0 - Unreleased
HBASE-3298 Regionserver can close during a split causing double assignment
HBASE-3309 " Not running balancer because dead regionserver processing" is a lie
HBASE-3314 [shell] 'move' is broken
HBASE-3315 Add debug output for when balancer makes bad balance
IMPROVEMENTS

View File

@ -293,11 +293,20 @@ public class LoadBalancer {
long endTime = System.currentTimeMillis();
assert(regionidx == regionsToMove.size()): "clusterState=" + clusterState +
", regionidx=" + regionidx + ", regionsToMove=" + regionsToMove +
if (regionidx != regionsToMove.size() || neededRegions != 0) {
// Emit data so can diagnose how balancer went astray.
LOG.warn("regionidx=" + regionidx + ", regionsToMove=" + regionsToMove.size() +
", numServers=" + numServers + ", serversOverloaded=" + serversOverloaded +
", serversUnderloaded=" + serversUnderloaded;
assert(neededRegions == 0);
", serversUnderloaded=" + serversUnderloaded);
StringBuilder sb = new StringBuilder();
for (Map.Entry<HServerInfo, List<HRegionInfo>> e: clusterState.entrySet()) {
if (sb.length() > 0) sb.append(", ");
sb.append(e.getKey().getServerName());
sb.append(" ");
sb.append(e.getValue().size());
}
LOG.warn("Input " + sb.toString());
}
// All done!
LOG.info("Calculated a load balance in " + (endTime-startTime) + "ms. " +
@ -636,7 +645,7 @@ public class LoadBalancer {
public String toString() {
return "hri=" + this.hri.getRegionNameAsString() + ", src=" +
(this.source == null? "": this.source.getServerName()) +
", dest=" + this.dest.getServerName();
", dest=" + (this.dest == null? "": this.dest.getServerName());
}
}
}