hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Todd Lipcon (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-3094) add -nonInteractive and -force option to namenode -format command
Date Tue, 20 Mar 2012 02:15:38 GMT

    [ https://issues.apache.org/jira/browse/HDFS-3094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13233127#comment-13233127

Todd Lipcon commented on HDFS-3094:

+    NONINTERACTIVE("-nonInterActive");
should be {{-nonInteractive}} (not a capital 'A')
+    //default force to false
+    private boolean isForce=false;
+    //default interactive to true
+    private boolean isInteractive=true;
These comments are superfluous, since they just say the same thing as the code. Also, please
add spaces before and after the '=' in the variable definitions.
+    public boolean getisForce() {
+      return isForce;
+    }
+    public void setisForce(boolean force) {
+      isForce = force;
+    }
Rename {{getisForce}} to just {{isForce}} or {{isForceEnabled()}}. Rename {{setisForce}} to
{{setForceEnabled()}} or {{setForce()}}. Same goes for {{isInteractive}}/{{setisInteractive}}
below it.

+        //by default force is off and interactive is on
+        startOpt.setisForce(false);
+        startOpt.setisInteractive(true);
you already have these defaults in the variable declarations, no need to duplicate them
- It looks like if you specify invalid options, it won't give any kind of useful error message.
You should probably be throwing HadoopIllegalArgumentException instead of returning null in
several of these cases.
- I don't follow the following comment:
{{+            //make sure the user did not sent force or noninteractive as the clusterid
or an empty clusterid}}

Can you clarify it?
In one of your test cases, you make a new thread and then sleep. This is not a reliable way
of testing, especially since it wants to get user input. This won't work well in many test
environments. I'd suggest we just use manual tests for this, or else set up a way to override
System.in for the purpose of the test, so you can test without spawning a new thread.

Style nits: please make the code look like the surrounding style in the rest of the codebase.
Spaces around '=' signs. No spaces after '(' in if statements. Maximum 80 characters in a
line, etc. No tabs (two space indentation). Space after '//'. Please read over your comments
for typos as well.

> add -nonInteractive and -force option to namenode -format command
> -----------------------------------------------------------------
>                 Key: HDFS-3094
>                 URL: https://issues.apache.org/jira/browse/HDFS-3094
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>    Affects Versions: 0.24.0, 1.0.2
>            Reporter: Arpit Gupta
>            Assignee: Arpit Gupta
>         Attachments: HDFS-3094.branch-1.0.patch, HDFS-3094.branch-1.0.patch, HDFS-3094.branch-1.0.patch,
HDFS-3094.branch-1.0.patch, HDFS-3094.branch-1.0.patch, HDFS-3094.patch, HDFS-3094.patch,
> Currently the bin/hadoop namenode -format prompts the user for a Y/N to setup the directories
in the local file system.
> -force : namenode formats the directories without prompting
> -nonInterActive : namenode format will return with an exit code of 1 if the dir exists.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message