HBASE-14010 TestRegionRebalancing.testRebalanceOnRegionServerNumberChange fails; cluster not balanced
This commit is contained in:
parent
34dfd6c9b4
commit
90b51e85c4
|
@ -944,7 +944,7 @@ public class AssignmentManager {
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,6 @@ public class TestRegionRebalancing {
|
|||
* @throws InterruptedException
|
||||
*/
|
||||
@Test (timeout=300000)
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testRebalanceOnRegionServerNumberChange()
|
||||
throws IOException, InterruptedException {
|
||||
try(Connection connection = ConnectionFactory.createConnection(UTIL.getConfiguration());
|
||||
|
@ -133,6 +132,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();
|
||||
|
||||
|
@ -141,9 +141,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();
|
||||
|
@ -154,6 +154,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