HBASE-3716 Intermittent TestRegionRebalancing failure

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1087401 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-03-31 18:33:37 +00:00
parent a906560ce0
commit 5de1c25b33
3 changed files with 6 additions and 2 deletions

View File

@ -54,6 +54,8 @@ Release 0.91.0 - Unreleased
HBASE-3709 HFile compression not sharing configuration
HBASE-3711 importtsv fails if rowkey length exceeds MAX_ROW_LENGTH
(Kazuki Ohta via todd)
HBASE-3716 Intermittent TestRegionRebalancing failure
(Ted Yu via Stack)
IMPROVEMENTS
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack)

View File

@ -700,6 +700,7 @@ implements HMasterInterface, HMasterRegionInterface, MasterServices, Server {
// Do this call outside of synchronized block.
int maximumBalanceTime = getBalancerCutoffTime();
long cutoffTime = System.currentTimeMillis() + maximumBalanceTime;
boolean balancerRan;
synchronized (this.balancer) {
// Only allow one balance run at at time.
if (this.assignmentManager.isRegionsInTransition()) {
@ -741,6 +742,7 @@ implements HMasterInterface, HMasterRegionInterface, MasterServices, Server {
List<RegionPlan> plans = this.balancer.balanceCluster(assignments);
int rpCount = 0; // number of RegionPlans balanced so far
long totalRegPlanExecTime = 0;
balancerRan = plans != null;
if (plans != null && !plans.isEmpty()) {
for (RegionPlan plan: plans) {
LOG.info("balance " + plan);
@ -766,7 +768,7 @@ implements HMasterInterface, HMasterRegionInterface, MasterServices, Server {
}
}
}
return true;
return balancerRan;
}
@Override

View File

@ -159,7 +159,7 @@ public class TestRegionRebalancing extends HBaseClusterTestCase {
// TODO: Fix this test. Old balancer used to run with 'slop'. New
// balancer does not.
boolean success = false;
float slop = (float)0.1;
float slop = (float)conf.getFloat("hbase.regions.slop", 0.1f);
if (slop <= 0) slop = 1;
for (int i = 0; i < 5; i++) {