HDFS-17574. Make NNThroughputBenchmark support human-friendly units about blocksize. (#6931). Contributed by wangzhongwei.
Signed-off-by: He Xiaoqiao <hexiaoqiao@apache.org>
This commit is contained in:
parent
51cb858cc8
commit
5730656660
@ -587,7 +587,7 @@ void parseArguments(List<String> args) {
|
||||
numOpsRequired = Integer.parseInt(args.get(++i));
|
||||
} else if (args.get(i).equals("-blockSize")) {
|
||||
if(i+1 == args.size()) printUsage();
|
||||
blockSize = Long.parseLong(args.get(++i));
|
||||
blockSize = StringUtils.TraditionalBinaryPrefix.string2long(args.get(++i));
|
||||
} else if(args.get(i).equals("-threads")) {
|
||||
if(i+1 == args.size()) printUsage();
|
||||
numThreads = Integer.parseInt(args.get(++i));
|
||||
@ -1260,7 +1260,7 @@ void parseArguments(List<String> args) {
|
||||
blocksPerFile = Integer.parseInt(args.get(++i));
|
||||
} else if (args.get(i).equals("-blockSize")) {
|
||||
if(i+1 == args.size()) printUsage();
|
||||
blockSize = Long.parseLong(args.get(++i));
|
||||
blockSize = StringUtils.TraditionalBinaryPrefix.string2long(args.get(++i));
|
||||
} else if(args.get(i).equals("-baseDirName")) {
|
||||
if (i + 1 == args.size()) {
|
||||
printUsage();
|
||||
@ -1498,7 +1498,7 @@ void parseArguments(List<String> args) {
|
||||
replication = Short.parseShort(args.get(++i));
|
||||
} else if (args.get(i).equals("-blockSize")) {
|
||||
if(i+1 == args.size()) printUsage();
|
||||
blockSize = Long.parseLong(args.get(++i));
|
||||
blockSize = StringUtils.TraditionalBinaryPrefix.string2long(args.get(++i));
|
||||
} else if(args.get(i).equals("-baseDirName")) {
|
||||
if (i + 1 == args.size()) {
|
||||
printUsage();
|
||||
|
@ -285,4 +285,23 @@ public void testNNThroughputWithBlockSize() throws Exception {
|
||||
"-blockSize", "32", "-close"});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This test runs {@link NNThroughputBenchmark} against a mini DFS cluster
|
||||
* with explicit -blockSize option like 1m.
|
||||
*/
|
||||
@Test(timeout = 120000)
|
||||
public void testNNThroughputBlockSizeArgWithLetterSuffix() throws Exception {
|
||||
final Configuration conf = new HdfsConfiguration();
|
||||
conf.setInt(DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_KEY, 16);
|
||||
try (MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).build()) {
|
||||
cluster.waitActive();
|
||||
final Configuration benchConf = new HdfsConfiguration();
|
||||
benchConf.setLong(DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_KEY, 16);
|
||||
FileSystem.setDefaultUri(benchConf, cluster.getURI());
|
||||
NNThroughputBenchmark.runBenchmark(benchConf,
|
||||
new String[]{"-op", "create", "-keepResults", "-files", "3",
|
||||
"-blockSize", "1m", "-close"});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user