HDFS-7127. TestLeaseRecovery leaks MiniDFSCluster instances. Contributed by Chris Nauroth.
(cherry picked from commit b607c3c363
)
This commit is contained in:
parent
afde00a0f5
commit
6bace90b29
|
@ -611,6 +611,8 @@ Release 2.6.0 - UNRELEASED
|
|||
HDFS-7111. TestSafeMode assumes Unix line endings in safe mode tip.
|
||||
(cnauroth)
|
||||
|
||||
HDFS-7127. TestLeaseRecovery leaks MiniDFSCluster instances. (cnauroth)
|
||||
|
||||
Release 2.5.1 - 2014-09-05
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -41,6 +41,7 @@ import org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.TestInterDatanodePr
|
|||
import org.apache.hadoop.hdfs.server.namenode.LeaseManager;
|
||||
import org.apache.hadoop.hdfs.server.namenode.NameNodeAdapter;
|
||||
import org.apache.hadoop.security.UserGroupInformation;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
public class TestLeaseRecovery {
|
||||
|
@ -48,6 +49,15 @@ public class TestLeaseRecovery {
|
|||
static final short REPLICATION_NUM = (short)3;
|
||||
private static final long LEASE_PERIOD = 300L;
|
||||
|
||||
private MiniDFSCluster cluster;
|
||||
|
||||
@After
|
||||
public void shutdown() throws IOException {
|
||||
if (cluster != null) {
|
||||
cluster.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
static void checkMetaInfo(ExtendedBlock b, DataNode dn
|
||||
) throws IOException {
|
||||
TestInterDatanodeProtocol.checkMetaInfo(b, dn);
|
||||
|
@ -82,9 +92,6 @@ public class TestLeaseRecovery {
|
|||
final int ORG_FILE_SIZE = 3000;
|
||||
Configuration conf = new HdfsConfiguration();
|
||||
conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, BLOCK_SIZE);
|
||||
MiniDFSCluster cluster = null;
|
||||
|
||||
try {
|
||||
cluster = new MiniDFSCluster.Builder(conf).numDataNodes(5).build();
|
||||
cluster.waitActive();
|
||||
|
||||
|
@ -116,7 +123,6 @@ public class TestLeaseRecovery {
|
|||
checkMetaInfo(lastblock, datanodes[i]);
|
||||
}
|
||||
|
||||
|
||||
DataNode.LOG.info("dfs.dfs.clientName=" + dfs.dfs.clientName);
|
||||
cluster.getNameNodeRpc().append(filestr, dfs.dfs.clientName);
|
||||
|
||||
|
@ -152,10 +158,6 @@ public class TestLeaseRecovery {
|
|||
cluster.getNameNodeRpc().setSafeMode(
|
||||
HdfsConstants.SafeModeAction.SAFEMODE_LEAVE, false);
|
||||
}
|
||||
finally {
|
||||
if (cluster != null) {cluster.shutdown();}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Block Recovery when the meta file not having crcs for all chunks in block
|
||||
|
@ -166,8 +168,7 @@ public class TestLeaseRecovery {
|
|||
Configuration conf = new Configuration();
|
||||
conf.set(DFSConfigKeys.DFS_BLOCK_LOCAL_PATH_ACCESS_USER_KEY,
|
||||
UserGroupInformation.getCurrentUser().getShortUserName());
|
||||
MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(1)
|
||||
.build();
|
||||
cluster = new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
|
||||
Path file = new Path("/testRecoveryFile");
|
||||
DistributedFileSystem dfs = cluster.getFileSystem();
|
||||
FSDataOutputStream out = dfs.create(file);
|
||||
|
|
Loading…
Reference in New Issue