From 53dc8546d4b5c6ffe715c61c5d058c533aca4b0a Mon Sep 17 00:00:00 2001 From: Aaron Myers Date: Tue, 10 Apr 2012 02:25:40 +0000 Subject: [PATCH] HDFS-3235. MiniDFSClusterManager doesn't correctly support -format option. Contributed by Henry Robinson. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1311556 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../org/apache/hadoop/test/MiniDFSClusterManager.java | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 63c77a7a5c..12e4bc5784 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -121,6 +121,9 @@ Trunk (unreleased changes) HDFS-3119. Overreplicated block is not deleted even after the replication factor is reduced after sync follwed by closing that file. (Ashish Singhi via umamahesh) + + HDFS-3235. MiniDFSClusterManager doesn't correctly support -format option. + (Henry Robinson via atm) Release 2.0.0 - UNRELEASED diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/test/MiniDFSClusterManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/test/MiniDFSClusterManager.java index 4622b4cd5c..bd6e524f7c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/test/MiniDFSClusterManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/test/MiniDFSClusterManager.java @@ -68,6 +68,7 @@ public class MiniDFSClusterManager { private StartupOption dfsOpts; private String writeConfig; private Configuration conf; + private boolean format; private static final long SLEEP_INTERVAL_MS = 1000 * 60; @@ -138,6 +139,7 @@ public void start() throws IOException, FileNotFoundException { dfs = new MiniDFSCluster.Builder(conf).nameNodePort(nameNodePort) .numDataNodes(numDataNodes) .startupOption(dfsOpts) + .format(format) .build(); dfs.waitActive(); @@ -196,8 +198,13 @@ private boolean parseArguments(String[] args) { // HDFS numDataNodes = intArgument(cli, "datanodes", 1); nameNodePort = intArgument(cli, "nnport", 0); - dfsOpts = cli.hasOption("format") ? - StartupOption.FORMAT : StartupOption.REGULAR; + if (cli.hasOption("format")) { + dfsOpts = StartupOption.FORMAT; + format = true; + } else { + dfsOpts = StartupOption.REGULAR; + format = false; + } // Runner writeDetails = cli.getOptionValue("writeDetails");