HBASE-10858 TestRegionRebalancing is failing git-svn-id: https://svn.apache.org/repos/asf/hbase/branches/hbase-10070@1582554 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/2ddb1429 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/2ddb1429 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/2ddb1429 Branch: refs/heads/master Commit: 2ddb14299054f9d1b26155cc6e4cdd2fc4f53e01 Parents: f09ab44 Author: Enis Soztutar <e...@apache.org> Authored: Thu Mar 27 23:58:10 2014 +0000 Committer: Enis Soztutar <e...@apache.org> Committed: Fri Jun 27 16:39:39 2014 -0700 ---------------------------------------------------------------------- .../apache/hadoop/hbase/TestRegionRebalancing.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/2ddb1429/hbase-server/src/test/java/org/apache/hadoop/hbase/TestRegionRebalancing.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestRegionRebalancing.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestRegionRebalancing.java index 7197342..a647f1f 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestRegionRebalancing.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestRegionRebalancing.java @@ -33,10 +33,12 @@ import org.apache.hadoop.hbase.catalog.CatalogTracker; import org.apache.hadoop.hbase.catalog.MetaReader; import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.client.HTable; +import org.apache.hadoop.hbase.master.RegionStates; import org.apache.hadoop.hbase.protobuf.ProtobufUtil; import org.apache.hadoop.hbase.regionserver.HRegionServer; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.JVMClusterUtil; +import org.apache.hadoop.hbase.util.Threads; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -118,10 +120,10 @@ public class TestRegionRebalancing { UTIL.getHBaseCluster().getMaster().balance(); assertRegionsAreBalanced(); - // On a balanced cluster, calling balance() should return false - assert(UTIL.getHBaseCluster().getMaster().balance() == false); + // On a balanced cluster, calling balance() should return true + assert(UTIL.getHBaseCluster().getMaster().balance() == true); - // However if we add a server, then the balance() call should return true + // if we add a server, then the balance() call should return true // add a region server - total of 3 LOG.info("Started third server=" + UTIL.getHBaseCluster().startRegionServer().getRegionServer().getServerName()); @@ -200,7 +202,7 @@ public class TestRegionRebalancing { if (!(serverLoad <= avgLoadPlusSlop && serverLoad >= avgLoadMinusSlop)) { LOG.debug(server.getServerName() + " Isn't balanced!!! Avg: " + avg + " actual: " + serverLoad + " slop: " + slop); - success = false; + success = false; break; } } @@ -248,6 +250,10 @@ public class TestRegionRebalancing { Thread.sleep(200); } catch (InterruptedException e) {} } + RegionStates regionStates = UTIL.getHBaseCluster().getMaster().getAssignmentManager().getRegionStates(); + while (!regionStates.getRegionsInTransition().isEmpty()) { + Threads.sleep(100); + } } }