HDFS-15672. TestBalancerWithMultipleNameNodes#testBalancingBlockpoolsWithBlockPoolPolicy fails on trunk. (#2475)

Signed-off-by: Akira Ajisaka <aajisaka@apache.org>
(cherry picked from commit 630f8ddd2c)
This commit is contained in:
Masatake Iwasaki 2021-01-14 16:19:35 +09:00 committed by Akira Ajisaka
parent 7fc624aabc
commit 89452682a5
No known key found for this signature in database
GPG Key ID: C1EDBB9CA400FD50
1 changed files with 8 additions and 7 deletions

View File

@ -146,15 +146,16 @@ private static ExtendedBlock[][] generateBlocks(Suite s, long size
} }
/* wait for one heartbeat */ /* wait for one heartbeat */
static void wait(final ClientProtocol[] clients, static void wait(final Suite suite,
long expectedUsedSpace, long expectedTotalSpace) throws IOException { long expectedUsedSpace, long expectedTotalSpace) throws IOException {
LOG.info("WAIT expectedUsedSpace=" + expectedUsedSpace LOG.info("WAIT expectedUsedSpace=" + expectedUsedSpace
+ ", expectedTotalSpace=" + expectedTotalSpace); + ", expectedTotalSpace=" + expectedTotalSpace);
for(int n = 0; n < clients.length; n++) { suite.cluster.triggerHeartbeats();
for(int n = 0; n < suite.clients.length; n++) {
int i = 0; int i = 0;
for(boolean done = false; !done; ) { for(boolean done = false; !done; ) {
final long[] s = clients[n].getStats(); final long[] s = suite.clients[n].getStats();
done = s[0] == expectedTotalSpace && s[1] == expectedUsedSpace; done = s[0] == expectedTotalSpace && s[1] >= expectedUsedSpace;
if (!done) { if (!done) {
sleep(100L); sleep(100L);
if (++i % 100 == 0) { if (++i % 100 == 0) {
@ -172,7 +173,7 @@ static void runBalancer(Suite s,
LOG.info("BALANCER 0: totalUsed=" + totalUsed LOG.info("BALANCER 0: totalUsed=" + totalUsed
+ ", totalCapacity=" + totalCapacity + ", totalCapacity=" + totalCapacity
+ ", avg=" + avg); + ", avg=" + avg);
wait(s.clients, totalUsed, totalCapacity); wait(s, totalUsed, totalCapacity);
LOG.info("BALANCER 1"); LOG.info("BALANCER 1");
// get storage reports for relevant blockpools so that we can compare // get storage reports for relevant blockpools so that we can compare
@ -186,7 +187,7 @@ static void runBalancer(Suite s,
Assert.assertEquals(ExitStatus.SUCCESS.getExitCode(), r); Assert.assertEquals(ExitStatus.SUCCESS.getExitCode(), r);
LOG.info("BALANCER 2"); LOG.info("BALANCER 2");
wait(s.clients, totalUsed, totalCapacity); wait(s, totalUsed, totalCapacity);
LOG.info("BALANCER 3"); LOG.info("BALANCER 3");
int i = 0; int i = 0;
@ -530,7 +531,7 @@ private void runTest(final int nNameNodes, String[] racks,
LOG.info("RUN_TEST 2: create files"); LOG.info("RUN_TEST 2: create files");
// fill up the cluster to be 30% full // fill up the cluster to be 30% full
final long totalUsed = (totalCapacity * s.replication)*3/10; final long totalUsed = totalCapacity * 3 / 10;
final long size = (totalUsed/nNameNodes)/s.replication; final long size = (totalUsed/nNameNodes)/s.replication;
for(int n = 0; n < nNameNodes; n++) { for(int n = 0; n < nNameNodes; n++) {
createFile(s, n, size); createFile(s, n, size);