HDFS-8975. Erasure coding : Fix random failure in TestSafeModeWithStripedFile (Contributed by J.Andreina)
This commit is contained in:
parent
96d6b516b2
commit
ce02b5532c
@ -418,3 +418,7 @@
|
||||
|
||||
HDFS-8853. Erasure Coding: Provide ECSchema validation when setting EC
|
||||
policy. (andreina via zhz)
|
||||
|
||||
HDFS-8975. Erasure coding : Fix random failure in TestSafeModeWithStripedFile
|
||||
(J.Andreina via vinayakumarb)
|
||||
|
||||
|
@ -53,6 +53,7 @@ public class TestSafeModeWithStripedFile {
|
||||
public void setup() throws IOException {
|
||||
conf = new HdfsConfiguration();
|
||||
conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, blockSize);
|
||||
conf.setLong(DFSConfigKeys.DFS_BLOCKREPORT_INTERVAL_MSEC_KEY, 100);
|
||||
cluster = new MiniDFSCluster.Builder(conf).numDataNodes(numDNs).build();
|
||||
cluster.getFileSystem().getClient().setErasureCodingPolicy("/", null);
|
||||
cluster.waitActive();
|
||||
@ -124,6 +125,7 @@ private void doTest(int smallSize, int minStorages) throws IOException {
|
||||
// so the safe blocks count doesn't increment.
|
||||
for (int i = 0; i < minStorages - 1; i++) {
|
||||
cluster.restartDataNode(dnprops.remove(0));
|
||||
cluster.waitActive();
|
||||
cluster.triggerBlockReports();
|
||||
assertEquals(0, NameNodeAdapter.getSafeModeSafeBlocks(nn));
|
||||
}
|
||||
@ -131,17 +133,20 @@ private void doTest(int smallSize, int minStorages) throws IOException {
|
||||
// the block of smallFile reaches minStorages,
|
||||
// so the safe blocks count increment.
|
||||
cluster.restartDataNode(dnprops.remove(0));
|
||||
cluster.waitActive();
|
||||
cluster.triggerBlockReports();
|
||||
assertEquals(1, NameNodeAdapter.getSafeModeSafeBlocks(nn));
|
||||
|
||||
// the 2 blocks of bigFile need DATA_BLK_NUM storages to be safe
|
||||
for (int i = minStorages; i < DATA_BLK_NUM - 1; i++) {
|
||||
cluster.restartDataNode(dnprops.remove(0));
|
||||
cluster.waitActive();
|
||||
cluster.triggerBlockReports();
|
||||
assertTrue(nn.isInSafeMode());
|
||||
}
|
||||
|
||||
cluster.restartDataNode(dnprops.remove(0));
|
||||
cluster.waitActive();
|
||||
cluster.triggerBlockReports();
|
||||
assertFalse(nn.isInSafeMode());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user