HBASE-14010 TestRegionRebalancing.testRebalanceOnRegionServerNumberChange fails; cluster not balanced
This commit is contained in:
parent
7b4febbc2b
commit
bfaf837049
|
@ -1948,7 +1948,7 @@ public class AssignmentManager extends ZooKeeperListener {
|
|||
final HRegionInfo region, final boolean forceNewPlan) {
|
||||
RegionState state = regionStates.getRegionState(region);
|
||||
if (state == null) {
|
||||
LOG.warn("Assigning a region not in region states: " + region);
|
||||
LOG.warn("Assigning but not in region states: " + region);
|
||||
state = regionStates.createRegionState(region);
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,6 @@ public class TestRegionRebalancing {
|
|||
* @throws InterruptedException
|
||||
*/
|
||||
@Test (timeout=300000)
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testRebalanceOnRegionServerNumberChange()
|
||||
throws IOException, InterruptedException {
|
||||
try(Connection connection = ConnectionFactory.createConnection(UTIL.getConfiguration());
|
||||
|
@ -132,6 +131,7 @@ public class TestRegionRebalancing {
|
|||
// kill a region server - total of 2
|
||||
LOG.info("Stopped third server=" + UTIL.getHBaseCluster().stopRegionServer(2, false));
|
||||
UTIL.getHBaseCluster().waitOnRegionServer(2);
|
||||
waitOnCrashProcessing();
|
||||
UTIL.getHBaseCluster().getMaster().balance();
|
||||
assertRegionsAreBalanced();
|
||||
|
||||
|
@ -140,9 +140,9 @@ public class TestRegionRebalancing {
|
|||
UTIL.getHBaseCluster().startRegionServer().getRegionServer().getServerName());
|
||||
LOG.info("Added fourth server=" +
|
||||
UTIL.getHBaseCluster().startRegionServer().getRegionServer().getServerName());
|
||||
waitOnCrashProcessing();
|
||||
assert(UTIL.getHBaseCluster().getMaster().balance() == true);
|
||||
assertRegionsAreBalanced();
|
||||
|
||||
for (int i = 0; i < 6; i++){
|
||||
LOG.info("Adding " + (i + 5) + "th region server");
|
||||
UTIL.getHBaseCluster().startRegionServer();
|
||||
|
@ -153,6 +153,16 @@ public class TestRegionRebalancing {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait on crash processing. Balancer won't run if processing a crashed server.
|
||||
*/
|
||||
private void waitOnCrashProcessing() {
|
||||
while (UTIL.getHBaseCluster().getMaster().getServerManager().areDeadServersInProgress()) {
|
||||
LOG.info("Waiting on processing of crashed server before proceeding...");
|
||||
Threads.sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if regions are balanced. Figure out the total, divide by the
|
||||
* number of online servers, then test if each server is +/- 1 of average
|
||||
|
|
Loading…
Reference in New Issue