HDFS-11682. TestBalancer.testBalancerWithStripedFile is flaky. (lei)
This commit is contained in:
parent
5e7cfdca7b
commit
3f5108723c
@ -938,19 +938,37 @@ private void runBalancer(Configuration conf, long totalUsedSpace,
|
|||||||
throws Exception {
|
throws Exception {
|
||||||
waitForHeartBeat(totalUsedSpace, totalCapacity, client, cluster);
|
waitForHeartBeat(totalUsedSpace, totalCapacity, client, cluster);
|
||||||
|
|
||||||
// start rebalancing
|
int retry = 5;
|
||||||
Collection<URI> namenodes = DFSUtil.getInternalNsRpcUris(conf);
|
while (retry > 0) {
|
||||||
final int r = runBalancer(namenodes, p, conf);
|
// start rebalancing
|
||||||
if (conf.getInt(DFSConfigKeys.DFS_DATANODE_BALANCE_MAX_NUM_CONCURRENT_MOVES_KEY,
|
Collection<URI> namenodes = DFSUtil.getInternalNsRpcUris(conf);
|
||||||
DFSConfigKeys.DFS_DATANODE_BALANCE_MAX_NUM_CONCURRENT_MOVES_DEFAULT) ==0) {
|
final int run = runBalancer(namenodes, p, conf);
|
||||||
assertEquals(ExitStatus.NO_MOVE_PROGRESS.getExitCode(), r);
|
if (conf.getInt(
|
||||||
return;
|
DFSConfigKeys.DFS_DATANODE_BALANCE_MAX_NUM_CONCURRENT_MOVES_KEY,
|
||||||
} else {
|
DFSConfigKeys.DFS_DATANODE_BALANCE_MAX_NUM_CONCURRENT_MOVES_DEFAULT)
|
||||||
assertEquals(ExitStatus.SUCCESS.getExitCode(), r);
|
== 0) {
|
||||||
|
assertEquals(ExitStatus.NO_MOVE_PROGRESS.getExitCode(), run);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
assertEquals(ExitStatus.SUCCESS.getExitCode(), run);
|
||||||
|
}
|
||||||
|
waitForHeartBeat(totalUsedSpace, totalCapacity, client, cluster);
|
||||||
|
LOG.info(" .");
|
||||||
|
try {
|
||||||
|
waitForBalancer(totalUsedSpace, totalCapacity, client, cluster, p,
|
||||||
|
excludedNodes);
|
||||||
|
} catch (TimeoutException e) {
|
||||||
|
// See HDFS-11682. NN may not get heartbeat to reflect the newest
|
||||||
|
// block changes.
|
||||||
|
retry--;
|
||||||
|
if (retry == 0) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
LOG.warn("The cluster has not balanced yet, retry...");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
waitForHeartBeat(totalUsedSpace, totalCapacity, client, cluster);
|
|
||||||
LOG.info(" .");
|
|
||||||
waitForBalancer(totalUsedSpace, totalCapacity, client, cluster, p, excludedNodes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int runBalancer(Collection<URI> namenodes,
|
private static int runBalancer(Collection<URI> namenodes,
|
||||||
@ -1942,7 +1960,7 @@ public void integrationTestWithStripedFile(Configuration conf) throws Exception
|
|||||||
doTestBalancerWithStripedFile(conf);
|
doTestBalancerWithStripedFile(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(timeout = 100000)
|
@Test(timeout = 200000)
|
||||||
public void testBalancerWithStripedFile() throws Exception {
|
public void testBalancerWithStripedFile() throws Exception {
|
||||||
Configuration conf = new Configuration();
|
Configuration conf = new Configuration();
|
||||||
initConfWithStripe(conf);
|
initConfWithStripe(conf);
|
||||||
|
Loading…
Reference in New Issue
Block a user