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

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

ayushtkn commented on code in PR #6709:
URL: https://github.com/apache/hadoop/pull/6709#discussion_r1554546040


##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java:
##########
@@ -1201,7 +1200,7 @@ private void lostFoundInit(DFSClient dfs) {
         lfInitedOk = true;
       }
     }  catch (Exception e) {
-      e.printStackTrace();
+      LOG.error(lfName + " dir init failed.", e);
       lfInitedOk = false;
     }

Review Comment:
   why do we need to catch the exception itself, can't we just throw. If I 
catch the logic, we catch the exception and set ``lfInitedOk`` to `false`  and 
then in the calling method we throw
   ```
         if (!lfInitedOk) {
           throw new IOException("failed to initialize lost+found");
         }
   ```
   Can't we directly throw. The client will get the exception, it will log or 
whatever rather than logging here





> Fix namenode fsck swallows the exception stacktrace, this can help us to 
> troubleshooting log.
> ---------------------------------------------------------------------------------------------
>
>                 Key: HDFS-17454
>                 URL: https://issues.apache.org/jira/browse/HDFS-17454
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>    Affects Versions: 3.3.6
>            Reporter: xiaojunxiang
>            Priority: Minor
>              Labels: pull-request-available
>         Attachments: image-2024-04-05-15-40-37-147.png, 
> image-2024-04-05-15-41-38-420.png
>
>
> When I used `hdfs fsck /xxx.txt -move`, missing error, but I can't kown the 
> reason, because the exception stacktrace doesn't append to LOG, original code:
> !image-2024-04-05-15-40-37-147.png!
>  
> When I fix it, look, we can see the exception stacktrace:
> !image-2024-04-05-15-41-38-420.png!



--
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