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

ASF GitHub Bot commented on HDFS-17277:
---------------------------------------

tasanuma commented on code in PR #6323:
URL: https://github.com/apache/hadoop/pull/6323#discussion_r1438473858


##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java:
##########
@@ -1423,9 +1420,7 @@ private static boolean format(Configuration conf, boolean 
force,
       LOG.warn("Encountered exception during format", ioe);
       throw ioe;
     } finally {
-      if (fsImage != null) {
-        fsImage.close();
-      }
+      fsImage.close();

Review Comment:
   @slfan1989 Since the `fsImage` variable is initialized with `new FSImage`, 
it can't be null, and IntelliJ has issued a warning that `fsImage != null is 
always true`. Generally, even in such situations, performing a null check is 
considered good practice as future code changes could potentially cause the 
variable to become null. However, I thought this is unlikely in this case.





> Delete invalid code logic in namenode format
> --------------------------------------------
>
>                 Key: HDFS-17277
>                 URL: https://issues.apache.org/jira/browse/HDFS-17277
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>            Reporter: zhangzhanchang
>            Assignee: zhangzhanchang
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 3.4.0, 3.3.9
>
>
> There is invalid logical processing in the namenode format process



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to