|
@@ -1252,7 +1252,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> editDirsToFormat =
|
|
List<URI> editDirsToFormat =
|
|
FSNamesystem.getNamespaceEditsDirs(conf);
|
|
FSNamesystem.getNamespaceEditsDirs(conf);
|
|
|
|
|
|
@@ -1264,10 +1263,8 @@ public class NameNode extends ReconfigurableBase implements
|
|
}
|
|
}
|
|
|
|
|
|
LOG.info("Formatting using clusterid: {}", clusterId);
|
|
LOG.info("Formatting using clusterid: {}", clusterId);
|
|
-
|
|
|
|
- FSImage fsImage = new FSImage(conf, nameDirsToFormat, editDirsToFormat);
|
|
|
|
FSNamesystem fsn = null;
|
|
FSNamesystem fsn = null;
|
|
- try {
|
|
|
|
|
|
+ try (FSImage fsImage = new FSImage(conf, nameDirsToFormat, editDirsToFormat)) {
|
|
fsn = new FSNamesystem(conf, fsImage);
|
|
fsn = new FSNamesystem(conf, fsImage);
|
|
fsImage.getEditLog().initJournalsForWrite();
|
|
fsImage.getEditLog().initJournalsForWrite();
|
|
|
|
|
|
@@ -1295,7 +1292,6 @@ 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 {
|
|
- fsImage.close();
|
|
|
|
if (fsn != null) {
|
|
if (fsn != null) {
|
|
fsn.close();
|
|
fsn.close();
|
|
}
|
|
}
|