HDFS-3093. Fix bug where namenode -format interpreted the -force flag in reverse. Contributed by Todd Lipcon.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1300813 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fbae7714cf
commit
6d0b8df880
|
@ -205,6 +205,9 @@ Release 0.23.3 - UNRELEASED
|
||||||
|
|
||||||
HDFS-2764. TestBackupNode is racy. (atm)
|
HDFS-2764. TestBackupNode is racy. (atm)
|
||||||
|
|
||||||
|
HDFS-3093. Fix bug where namenode -format interpreted the -force flag in
|
||||||
|
reverse. (todd)
|
||||||
|
|
||||||
BREAKDOWN OF HDFS-1623 SUBTASKS
|
BREAKDOWN OF HDFS-1623 SUBTASKS
|
||||||
|
|
||||||
HDFS-2179. Add fencing framework and mechanisms for NameNode HA. (todd)
|
HDFS-2179. Add fencing framework and mechanisms for NameNode HA. (todd)
|
||||||
|
|
|
@ -207,7 +207,7 @@ public class NameNode {
|
||||||
/** Format a new filesystem. Destroys any filesystem that may already
|
/** Format a new filesystem. Destroys any filesystem that may already
|
||||||
* exist at this location. **/
|
* exist at this location. **/
|
||||||
public static void format(Configuration conf) throws IOException {
|
public static void format(Configuration conf) throws IOException {
|
||||||
format(conf, false);
|
format(conf, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static NameNodeMetrics metrics;
|
static NameNodeMetrics metrics;
|
||||||
|
@ -644,12 +644,12 @@ public class NameNode {
|
||||||
* for each existing directory and format them.
|
* for each existing directory and format them.
|
||||||
*
|
*
|
||||||
* @param conf
|
* @param conf
|
||||||
* @param isConfirmationNeeded
|
* @param force
|
||||||
* @return true if formatting was aborted, false otherwise
|
* @return true if formatting was aborted, false otherwise
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
private static boolean format(Configuration conf,
|
private static boolean format(Configuration conf,
|
||||||
boolean isConfirmationNeeded)
|
boolean force)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
String nsId = DFSUtil.getNamenodeNameServiceId(conf);
|
String nsId = DFSUtil.getNamenodeNameServiceId(conf);
|
||||||
String namenodeId = HAUtil.getNameNodeId(conf, nsId);
|
String namenodeId = HAUtil.getNameNodeId(conf, nsId);
|
||||||
|
@ -659,7 +659,7 @@ public class NameNode {
|
||||||
Collection<URI> dirsToFormat = FSNamesystem.getNamespaceDirs(conf);
|
Collection<URI> dirsToFormat = FSNamesystem.getNamespaceDirs(conf);
|
||||||
List<URI> editDirsToFormat =
|
List<URI> editDirsToFormat =
|
||||||
FSNamesystem.getNamespaceEditsDirs(conf);
|
FSNamesystem.getNamespaceEditsDirs(conf);
|
||||||
if (!confirmFormat(dirsToFormat, isConfirmationNeeded, true)) {
|
if (!confirmFormat(dirsToFormat, force, true)) {
|
||||||
return true; // aborted
|
return true; // aborted
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -868,7 +868,7 @@ public class NameNode {
|
||||||
|
|
||||||
switch (startOpt) {
|
switch (startOpt) {
|
||||||
case FORMAT:
|
case FORMAT:
|
||||||
boolean aborted = format(conf, true);
|
boolean aborted = format(conf, false);
|
||||||
System.exit(aborted ? 1 : 0);
|
System.exit(aborted ? 1 : 0);
|
||||||
return null; // avoid javac warning
|
return null; // avoid javac warning
|
||||||
case GENCLUSTERID:
|
case GENCLUSTERID:
|
||||||
|
|
Loading…
Reference in New Issue