HDFS-13542. TestBlockManager#testNeededReplicationWhileAppending fails due to improper cluster shutdown in TestBlockManager#testBlockManagerMachinesArray on Windows. Contributed by Anbang Hu.
This commit is contained in:
parent
11794e5eda
commit
d88d9f2874
|
@ -441,8 +441,8 @@ public class TestBlockManager {
|
|||
String src = "/test-file";
|
||||
Path file = new Path(src);
|
||||
MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).build();
|
||||
cluster.waitActive();
|
||||
try {
|
||||
cluster.waitActive();
|
||||
BlockManager bm = cluster.getNamesystem().getBlockManager();
|
||||
FileSystem fs = cluster.getFileSystem();
|
||||
NamenodeProtocols namenode = cluster.getNameNodeRpc();
|
||||
|
@ -481,9 +481,11 @@ public class TestBlockManager {
|
|||
IOUtils.closeStream(out);
|
||||
}
|
||||
} finally {
|
||||
if (cluster != null) {
|
||||
cluster.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell the block manager that replication is completed for the given
|
||||
|
@ -970,9 +972,11 @@ public class TestBlockManager {
|
|||
assertTrue(fs.exists(file1));
|
||||
fs.delete(file1, true);
|
||||
assertTrue(!fs.exists(file1));
|
||||
if (cluster != null) {
|
||||
cluster.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUseDelHint() {
|
||||
|
@ -1070,9 +1074,11 @@ public class TestBlockManager {
|
|||
assertEquals(0, bm.getBlockOpQueueLength());
|
||||
assertTrue(doneLatch.await(1, TimeUnit.SECONDS));
|
||||
} finally {
|
||||
if (cluster != null) {
|
||||
cluster.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// spam the block manager with IBRs to verify queuing is occurring.
|
||||
@Test
|
||||
|
@ -1145,15 +1151,18 @@ public class TestBlockManager {
|
|||
long batched = MetricsAsserts.getLongCounter("BlockOpsBatched", rb);
|
||||
assertTrue(batched > 0);
|
||||
} finally {
|
||||
if (cluster != null) {
|
||||
cluster.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test(timeout = 60000)
|
||||
public void testBlockManagerMachinesArray() throws Exception {
|
||||
final Configuration conf = new HdfsConfiguration();
|
||||
final MiniDFSCluster cluster =
|
||||
new MiniDFSCluster.Builder(conf).numDataNodes(4).build();
|
||||
try {
|
||||
cluster.waitActive();
|
||||
BlockManager blockManager = cluster.getNamesystem().getBlockManager();
|
||||
FileSystem fs = cluster.getFileSystem();
|
||||
|
@ -1170,7 +1179,8 @@ public class TestBlockManager {
|
|||
File storageDir = cluster.getInstanceStorageDir(0, 0);
|
||||
File dataDir = MiniDFSCluster.getFinalizedDir(storageDir, bpid);
|
||||
assertTrue("Data directory does not exist", dataDir.exists());
|
||||
BlockInfo blockInfo = blockManager.blocksMap.getBlocks().iterator().next();
|
||||
BlockInfo blockInfo =
|
||||
blockManager.blocksMap.getBlocks().iterator().next();
|
||||
ExtendedBlock blk = new ExtendedBlock(bpid, blockInfo.getBlockId(),
|
||||
blockInfo.getNumBytes(), blockInfo.getGenerationStamp());
|
||||
DatanodeDescriptor failedStorageDataNode =
|
||||
|
@ -1224,6 +1234,11 @@ public class TestBlockManager {
|
|||
"replicas and failed storages",
|
||||
locatedBlocks.getLocatedBlocks().size() == 1);
|
||||
ns.readUnlock();
|
||||
} finally {
|
||||
if (cluster != null) {
|
||||
cluster.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue