You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ta...@apache.org on 2024/01/05 16:58:22 UTC
(hadoop) branch branch-3.3 updated: HDFS-17315. Optimize the namenode format code logic. (#6400)
This is an automated email from the ASF dual-hosted git repository.
tasanuma pushed a commit to branch branch-3.3
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-3.3 by this push:
new d682217ff280 HDFS-17315. Optimize the namenode format code logic. (#6400)
d682217ff280 is described below
commit d682217ff2806fcff6e03e3e2d587374088da4ca
Author: huangzhaobo <hu...@126.com>
AuthorDate: Sat Jan 6 00:47:17 2024 +0800
HDFS-17315. Optimize the namenode format code logic. (#6400)
Signed-off-by: Takanobu Asanuma <ta...@apache.org>
(cherry picked from commit 08713665c01116455f6e36e9d89a37095e88f40d)
---
.../main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java
index a7bea6def91c..124543c851f2 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java
@@ -1252,7 +1252,6 @@ public class NameNode extends ReconfigurableBase implements
}
Collection<URI> nameDirsToFormat = FSNamesystem.getNamespaceDirs(conf);
- List<URI> sharedDirs = FSNamesystem.getSharedEditsDirs(conf);
List<URI> editDirsToFormat =
FSNamesystem.getNamespaceEditsDirs(conf);
@@ -1264,10 +1263,8 @@ public class NameNode extends ReconfigurableBase implements
}
LOG.info("Formatting using clusterid: {}", clusterId);
-
- FSImage fsImage = new FSImage(conf, nameDirsToFormat, editDirsToFormat);
FSNamesystem fsn = null;
- try {
+ try (FSImage fsImage = new FSImage(conf, nameDirsToFormat, editDirsToFormat)) {
fsn = new FSNamesystem(conf, fsImage);
fsImage.getEditLog().initJournalsForWrite();
@@ -1295,7 +1292,6 @@ public class NameNode extends ReconfigurableBase implements
LOG.warn("Encountered exception during format", ioe);
throw ioe;
} finally {
- fsImage.close();
if (fsn != null) {
fsn.close();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org