Skip to content

Commit a4f62a2

Browse files
committed
HDFS-9421. NNThroughputBenchmark replication test NPE with -namenode option. Contributed by Mingliang Liu.
1 parent 2701f2d commit a4f62a2

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2308,6 +2308,9 @@ Release 2.8.0 - UNRELEASED
23082308
HDFS-9387. Fix namenodeUri parameter parsing in NNThroughputBenchmark.
23092309
(Mingliang Liu via xyao)
23102310

2311+
HDFS-9421. NNThroughputBenchmark replication test NPE with -namenode option.
2312+
(Mingliang Liu via xyao)
2313+
23112314
Release 2.7.3 - UNRELEASED
23122315

23132316
INCOMPATIBLE CHANGES

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/NNThroughputBenchmark.java

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@
106106
* By default the refresh is never called.</li>
107107
* <li>-keepResults do not clean up the name-space after execution.</li>
108108
* <li>-useExisting do not recreate the name-space, use existing data.</li>
109-
* <li>-namenode will run the test against a namenode in another
110-
* process or on another host. If you use this option, the namenode
111-
* must have dfs.namenode.fs-limits.min-block-size set to 16.</li>
109+
* <li>-namenode will run the test (except {@link ReplicationStats}) against a
110+
* namenode in another process or on another host. If you use this option,
111+
* the namenode must have dfs.namenode.fs-limits.min-block-size set to 16.</li>
112112
* </ol>
113113
*
114114
* The benchmark first generates inputs for each thread so that the
@@ -126,8 +126,9 @@ public class NNThroughputBenchmark implements Tool {
126126
private static final String GENERAL_OPTIONS_USAGE =
127127
" [-keepResults] | [-logLevel L] | [-UGCacheRefreshCount G] |" +
128128
" [-namenode <namenode URI>]\n" +
129-
" If using -namenode, set the namenode's" +
130-
" dfs.namenode.fs-limits.min-block-size to 16.";
129+
" If using -namenode, set the namenode's " +
130+
"dfs.namenode.fs-limits.min-block-size to 16. Replication test does not " +
131+
"support -namenode.";
131132

132133
static Configuration config;
133134
static NameNode nameNode;
@@ -1471,13 +1472,22 @@ public int run(String[] aArgs) throws Exception {
14711472
ops.add(opStat);
14721473
}
14731474
if(runAll || ReplicationStats.OP_REPLICATION_NAME.equals(type)) {
1474-
opStat = new ReplicationStats(args);
1475-
ops.add(opStat);
1475+
if (namenodeUri != null || args.contains("-namenode")) {
1476+
LOG.warn("The replication test is ignored as it does not support " +
1477+
"standalone namenode in another process or on another host. " +
1478+
"Please run replication test without -namenode argument.");
1479+
} else {
1480+
opStat = new ReplicationStats(args);
1481+
ops.add(opStat);
1482+
}
14761483
}
14771484
if(runAll || CleanAllStats.OP_CLEAN_NAME.equals(type)) {
14781485
opStat = new CleanAllStats(args);
14791486
ops.add(opStat);
14801487
}
1488+
if (ops.isEmpty()) {
1489+
printUsage();
1490+
}
14811491

14821492
if (namenodeUri == null) {
14831493
nameNode = NameNode.createNameNode(argv, config);
@@ -1501,8 +1511,6 @@ public int run(String[] aArgs) throws Exception {
15011511
DFSTestUtil.getRefreshUserMappingsProtocolProxy(config, nnUri);
15021512
getBlockPoolId(dfs);
15031513
}
1504-
if(ops.size() == 0)
1505-
printUsage();
15061514
// run each benchmark
15071515
for(OperationStatsBase op : ops) {
15081516
LOG.info("Starting benchmark: " + op.getOpName());

0 commit comments

Comments
 (0)