HDFS-14599. HDFS-12487 breaks test TestDiskBalancer.testDiskBalancerWithFedClusterWithOneNameServiceEmpty. Contributed by He Xiaoqiao.

(cherry picked from commit 4a212242d9)
This commit is contained in:
Inigo Goiri 2019-06-27 10:00:05 -07:00 committed by Wei-Chiu Chuang
parent e95a4ddbb1
commit 53f6d26500
2 changed files with 6 additions and 11 deletions

View File

@ -906,8 +906,8 @@ public class DiskBalancer {
try {
ExtendedBlock block = iter.nextBlock();
if(null == block){
LOG.info("NextBlock call returned null.No valid block to copy. {}",
item.toJson());
LOG.info("NextBlock call returned null. No valid block to copy. {}",
item.toJson());
return null;
}
// A valid block is a finalized block, we iterate until we get
@ -923,13 +923,11 @@ public class DiskBalancer {
item.incErrorCount();
}
}
if (item.getErrorCount() >= getMaxError(item)) {
item.setErrMsg("Error count exceeded.");
LOG.info("Maximum error count exceeded. Error count: {} Max error:{} ",
item.getErrorCount(), item.getMaxDiskErrors());
}
return null;
}

View File

@ -316,14 +316,12 @@ public class TestDiskBalancer {
final Path filePath = new Path(fileName);
long fileLen = blockCount * blockSize;
//Writing data only to one nameservice.
FileSystem fs = cluster.getFileSystem(0);
TestBalancer.createFile(cluster, filePath, fileLen, (short) 1,
0);
DFSTestUtil.waitReplication(fs, filePath, (short) 1);
GenericTestUtils.LogCapturer logCapturer = GenericTestUtils.LogCapturer
.captureLogs(DiskBalancer.LOG);
@ -334,15 +332,14 @@ public class TestDiskBalancer {
NodePlan plan = dataMover.generatePlan();
dataMover.executePlan(plan);
dataMover.verifyPlanExectionDone();
//Because here we have one nameservice empty, don't check
// blockPoolCount.
// Because here we have one nameservice empty, don't check blockPoolCount.
dataMover.verifyAllVolumesHaveData(false);
} finally {
Assert.assertTrue(logCapturer.getOutput().contains("There are no " +
"blocks in the blockPool"));
String logOut = logCapturer.getOutput();
Assert.assertTrue("Wrong log: " + logOut, logOut.contains(
"NextBlock call returned null. No valid block to copy."));
cluster.shutdown();
}
}
@Test