diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/NNThroughputBenchmark.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/NNThroughputBenchmark.java index 350b0e3a1ba8d8..a4e88d759fb4ec 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/NNThroughputBenchmark.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/NNThroughputBenchmark.java @@ -1376,7 +1376,7 @@ void printResults() { class ReplicationStats extends OperationStatsBase { static final String OP_REPLICATION_NAME = "replication"; static final String OP_REPLICATION_USAGE = - "-op replication [-datanodes T] [-nodesToDecommission N] " + + "-op replication [-datanodes T] [-nodesToDecommission D] " + "[-nodeReplicationLimit C] [-totalBlocks B] [-blockSize S] " + "[-replication R] [-baseDirName D]"; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNNThroughputBenchmark.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNNThroughputBenchmark.java index 1910f63a687835..a9836e00035956 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNNThroughputBenchmark.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNNThroughputBenchmark.java @@ -22,8 +22,10 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.FileUtil; +import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.DFSConfigKeys; import org.apache.hadoop.hdfs.DFSTestUtil; +import org.apache.hadoop.hdfs.DistributedFileSystem; import org.apache.hadoop.hdfs.HdfsConfiguration; import org.apache.hadoop.hdfs.MiniDFSCluster; import org.apache.hadoop.hdfs.protocol.DirectoryListing; @@ -203,40 +205,18 @@ public void testNNThroughputWithBaseDir() throws Exception { final Configuration benchConf = new HdfsConfiguration(); benchConf.setInt(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, 16); FileSystem.setDefaultUri(benchConf, cluster.getURI()); + DistributedFileSystem fs = cluster.getFileSystem(); NNThroughputBenchmark.runBenchmark(benchConf, new String[] {"-op", "create", "-keepResults", "-files", "3", "-baseDirName", "/nnThroughputBenchmark1", "-close"}); - FSNamesystem fsNamesystem = cluster.getNamesystem(); - DirectoryListing listing = fsNamesystem.getListing("/", HdfsFileStatus.EMPTY_NAME, false); - Boolean dirExist1 = false; - Boolean dirExist2 = false; - for (HdfsFileStatus f : listing.getPartialListing()) { - if (f.getFullName("/").equals("/nnThroughputBenchmark1")) { - dirExist1 = true; - } - if (f.getFullName("/").equals("/nnThroughputBenchmark")) { - dirExist2 = true; - } - } - Assert.assertEquals(dirExist1, true); - Assert.assertEquals(dirExist2, false); + Assert.assertTrue(fs.exists(new Path("/nnThroughputBenchmark1"))); + Assert.assertFalse(fs.exists(new Path("/nnThroughputBenchmark"))); NNThroughputBenchmark.runBenchmark(benchConf, new String[] {"-op", "all", "-baseDirName", "/nnThroughputBenchmark1"}); - listing = fsNamesystem.getListing("/", HdfsFileStatus.EMPTY_NAME, false); - dirExist1 = false; - dirExist2 = false; - for (HdfsFileStatus f : listing.getPartialListing()) { - if (f.getFullName("/").equals("/nnThroughputBenchmark1")) { - dirExist1 = true; - } - if (f.getFullName("/").equals("/nnThroughputBenchmark")) { - dirExist2 = true; - } - } - Assert.assertEquals(dirExist1, true); - Assert.assertEquals(dirExist2, false); + Assert.assertTrue(fs.exists(new Path("/nnThroughputBenchmark1"))); + Assert.assertFalse(fs.exists(new Path("/nnThroughputBenchmark"))); } finally { if (cluster != null) { cluster.shutdown();