[ 
https://issues.apache.org/jira/browse/HDFS-13321?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zhenhao Li updated HDFS-13321:
------------------------------
    Description: 
Their are some situations that different exception types are caught, but the 
handling of those exceptions can not show the differences of those types. Here 
are the code snippets we found which have this problem:

*hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java*

[https://github.com/apache/hadoop/blob/bec79ca2495abdc347d64628151c90f5ce777046/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java]

At Line *233* and Line *235.* We can see that two exception types are caught, 
but the logging statements here can not show the exception type at all.

Also there are comments for these two catch clauses respectively, one is 
"{color:#707070}// namenode is busy{color}", the other one is 
"{color:#707070}// namenode is not available",{color:#333333} but the log 
messages are too generic, can not show the "busy" or "not available" of 
namenode.{color}{color}

It may cause confusions to the person who is reading the log, the person can 
not know what exception happened here and can not distinguish logs generated by 
these two statements.

 Maybe adding stack trace information to these two logging statements and 
change the log message to handle specific situations is a simple way to improve 
it.

  was:
Their are some situations that different exception types are caught, but the 
handling of those exceptions can not show the differences of those types. Here 
are the code snippet we found which have this problem:

*hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java*

[https://github.com/apache/hadoop/blob/bec79ca2495abdc347d64628151c90f5ce777046/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java]

At Line *233* and Line *235.* We can see that two exception types are caught, 
but the logging statements here can not show the exception type at all.

Also there are comments for these two catch clauses respectively, one is 
"{color:#707070}// namenode is busy{color}", the other one is 
"{color:#707070}// namenode is not available", {color:#333333}but the log 
messages are too generic, can not show the "busy" or "not available" of 
namenode.{color}{color}

It may cause confusions to the person who are reading the log, the person can 
not know what exception happened here and can not distinguish logs generated by 
these two statements.

 Maybe adding stack trace information to these two logging statements and 
change the log message to handle specific situations is a simple way to improve 
it.


> Inadequate information for handling catch clauses
> -------------------------------------------------
>
>                 Key: HDFS-13321
>                 URL: https://issues.apache.org/jira/browse/HDFS-13321
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: datanode
>    Affects Versions: 3.0.0
>            Reporter: Zhenhao Li
>            Priority: Major
>              Labels: easyfix
>
> Their are some situations that different exception types are caught, but the 
> handling of those exceptions can not show the differences of those types. 
> Here are the code snippets we found which have this problem:
> *hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java*
> [https://github.com/apache/hadoop/blob/bec79ca2495abdc347d64628151c90f5ce777046/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java]
> At Line *233* and Line *235.* We can see that two exception types are caught, 
> but the logging statements here can not show the exception type at all.
> Also there are comments for these two catch clauses respectively, one is 
> "{color:#707070}// namenode is busy{color}", the other one is 
> "{color:#707070}// namenode is not available",{color:#333333} but the log 
> messages are too generic, can not show the "busy" or "not available" of 
> namenode.{color}{color}
> It may cause confusions to the person who is reading the log, the person can 
> not know what exception happened here and can not distinguish logs generated 
> by these two statements.
>  Maybe adding stack trace information to these two logging statements and 
> change the log message to handle specific situations is a simple way to 
> improve it.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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