Browse Source

Delete invalid code logic in namenode format (#6323)

Signed-off-by: Takanobu Asanuma <tasanuma@apache.org>
zzccctv 1 year ago
parent
commit
9f76fba6a4

+ 1 - 6
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java

@@ -1381,9 +1381,6 @@ public class NameNode extends ReconfigurableBase implements
     
     
     Collection<URI> nameDirsToFormat = FSNamesystem.getNamespaceDirs(conf);
     Collection<URI> nameDirsToFormat = FSNamesystem.getNamespaceDirs(conf);
     List<URI> sharedDirs = FSNamesystem.getSharedEditsDirs(conf);
     List<URI> sharedDirs = FSNamesystem.getSharedEditsDirs(conf);
-    List<URI> dirsToPrompt = new ArrayList<URI>();
-    dirsToPrompt.addAll(nameDirsToFormat);
-    dirsToPrompt.addAll(sharedDirs);
     List<URI> editDirsToFormat = 
     List<URI> editDirsToFormat = 
                  FSNamesystem.getNamespaceEditsDirs(conf);
                  FSNamesystem.getNamespaceEditsDirs(conf);
 
 
@@ -1426,9 +1423,7 @@ public class NameNode extends ReconfigurableBase implements
       LOG.warn("Encountered exception during format", ioe);
       LOG.warn("Encountered exception during format", ioe);
       throw ioe;
       throw ioe;
     } finally {
     } finally {
-      if (fsImage != null) {
-        fsImage.close();
-      }
+      fsImage.close();
       if (fsn != null) {
       if (fsn != null) {
         fsn.close();
         fsn.close();
       }
       }