HBASE-10858 TestRegionRebalancing is failing

git-svn-id: https://svn.apache.org/repos/asf/hbase/branches/hbase-10070@1582554 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Enis Soztutar 2014-03-27 23:58:10 +00:00
parent f09ab44cc6
commit 2ddb142990
1 changed files with 10 additions and 4 deletions

View File

@ -33,10 +33,12 @@ import org.apache.hadoop.hbase.catalog.CatalogTracker;
import org.apache.hadoop.hbase.catalog.MetaReader; import org.apache.hadoop.hbase.catalog.MetaReader;
import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.client.HTable; 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.protobuf.ProtobufUtil;
import org.apache.hadoop.hbase.regionserver.HRegionServer; import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.JVMClusterUtil; import org.apache.hadoop.hbase.util.JVMClusterUtil;
import org.apache.hadoop.hbase.util.Threads;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -118,10 +120,10 @@ public class TestRegionRebalancing {
UTIL.getHBaseCluster().getMaster().balance(); UTIL.getHBaseCluster().getMaster().balance();
assertRegionsAreBalanced(); assertRegionsAreBalanced();
// On a balanced cluster, calling balance() should return false // On a balanced cluster, calling balance() should return true
assert(UTIL.getHBaseCluster().getMaster().balance() == false); 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 // add a region server - total of 3
LOG.info("Started third server=" + LOG.info("Started third server=" +
UTIL.getHBaseCluster().startRegionServer().getRegionServer().getServerName()); UTIL.getHBaseCluster().startRegionServer().getRegionServer().getServerName());
@ -248,6 +250,10 @@ public class TestRegionRebalancing {
Thread.sleep(200); Thread.sleep(200);
} catch (InterruptedException e) {} } catch (InterruptedException e) {}
} }
RegionStates regionStates = UTIL.getHBaseCluster().getMaster().getAssignmentManager().getRegionStates();
while (!regionStates.getRegionsInTransition().isEmpty()) {
Threads.sleep(100);
}
} }
} }