HDFS-5486. Fix TestNameNodeMetrics for HDFS-2832.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-2832@1540619 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bb5bd30df6
commit
a161ff8f09
|
@ -93,3 +93,5 @@ IMPROVEMENTS:
|
||||||
|
|
||||||
HDFS-5480. Update Balancer for HDFS-2832. (Contributed by szetszwo)
|
HDFS-5480. Update Balancer for HDFS-2832. (Contributed by szetszwo)
|
||||||
|
|
||||||
|
HDFS-5486. Fix TestNameNodeMetrics for HDFS-2832. (Arpit Agarwal)
|
||||||
|
|
||||||
|
|
|
@ -124,6 +124,9 @@ public class MiniDFSCluster {
|
||||||
public static final String DFS_NAMENODE_SAFEMODE_EXTENSION_TESTING_KEY
|
public static final String DFS_NAMENODE_SAFEMODE_EXTENSION_TESTING_KEY
|
||||||
= DFS_NAMENODE_SAFEMODE_EXTENSION_KEY + ".testing";
|
= DFS_NAMENODE_SAFEMODE_EXTENSION_KEY + ".testing";
|
||||||
|
|
||||||
|
// Changing this value may break some tests that assume it is 2.
|
||||||
|
public static final int DIRS_PER_DATANODE = 2;
|
||||||
|
|
||||||
static { DefaultMetricsSystem.setMiniClusterMode(true); }
|
static { DefaultMetricsSystem.setMiniClusterMode(true); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1143,15 +1146,16 @@ public class MiniDFSCluster {
|
||||||
// Set up datanode address
|
// Set up datanode address
|
||||||
setupDatanodeAddress(dnConf, setupHostsFile, checkDataNodeAddrConfig);
|
setupDatanodeAddress(dnConf, setupHostsFile, checkDataNodeAddrConfig);
|
||||||
if (manageDfsDirs) {
|
if (manageDfsDirs) {
|
||||||
File dir1 = getInstanceStorageDir(i, 0);
|
StringBuilder sb = new StringBuilder();
|
||||||
File dir2 = getInstanceStorageDir(i, 1);
|
for (int j = 0; j < DIRS_PER_DATANODE; ++j) {
|
||||||
dir1.mkdirs();
|
File dir = getInstanceStorageDir(i, j);
|
||||||
dir2.mkdirs();
|
dir.mkdirs();
|
||||||
if (!dir1.isDirectory() || !dir2.isDirectory()) {
|
if (!dir.isDirectory()) {
|
||||||
throw new IOException("Mkdirs failed to create directory for DataNode "
|
throw new IOException("Mkdirs failed to create directory for DataNode " + dir);
|
||||||
+ i + ": " + dir1 + " or " + dir2);
|
}
|
||||||
|
sb.append((j > 0 ? "," : "") + fileAsURI(dir));
|
||||||
}
|
}
|
||||||
String dirs = fileAsURI(dir1) + "," + fileAsURI(dir2);
|
String dirs = sb.toString();
|
||||||
dnConf.set(DFS_DATANODE_DATA_DIR_KEY, dirs);
|
dnConf.set(DFS_DATANODE_DATA_DIR_KEY, dirs);
|
||||||
conf.set(DFS_DATANODE_DATA_DIR_KEY, dirs);
|
conf.set(DFS_DATANODE_DATA_DIR_KEY, dirs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -434,7 +434,8 @@ public class TestNameNodeMetrics {
|
||||||
// We have one sync when the cluster starts up, just opening the journal
|
// We have one sync when the cluster starts up, just opening the journal
|
||||||
assertCounter("SyncsNumOps", 1L, rb);
|
assertCounter("SyncsNumOps", 1L, rb);
|
||||||
// Each datanode reports in when the cluster comes up
|
// Each datanode reports in when the cluster comes up
|
||||||
assertCounter("BlockReportNumOps", (long)DATANODE_COUNT, rb);
|
assertCounter("BlockReportNumOps",
|
||||||
|
(long)DATANODE_COUNT*MiniDFSCluster.DIRS_PER_DATANODE, rb);
|
||||||
|
|
||||||
// Sleep for an interval+slop to let the percentiles rollover
|
// Sleep for an interval+slop to let the percentiles rollover
|
||||||
Thread.sleep((PERCENTILES_INTERVAL+1)*1000);
|
Thread.sleep((PERCENTILES_INTERVAL+1)*1000);
|
||||||
|
|
Loading…
Reference in New Issue