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

Yongjun Zhang commented on HDFS-5939:
-------------------------------------

Hi Guys,

I just uploaded a new version to address your comments.

Since we are now throwing InvalidTopologyException, I tried to remove the 
NoDatanodeException, 
and found a catch there. If NamenodeWebHdfs throw InvalidTopologyException, 
which is a RuntimeException,
then the unit testcase I wrote  (TestWebHDFS.testNoDatanode) will catch  
RemoteException that wraps 
InvalidTopologyException. 

In the unit test I wrote, I tried to catch exception and assert the exception 
is InvalidTopologyException. 
So I tried to use 
RemoteException.unwrapRemoteException(InvalidTopologyException.class) to figure 
out the class wrapped by the RemoteException.  and found that the 
unwrapRemoteException method takes only exception class that's inherited from 
IOException. However, InvalidTopologyException is not. So I won't be able to 
make the assertion.

I decided to put back NoDatanodeException (inherits from IOException) to solve 
this problem. That is, in NamenodeWebHdfs, when we catch 
InvalidTopologyException, we throw NoDatanodeException. This actually makes 
sense to me, since InvalidTopologyException can be for different reasons, when 
caught in NamenodeWebHdfs, it's because of NoDatanode. And we issue a clear 
help message there.

Would you please help look at this version again? many thanks.

  

> WebHdfs returns misleading error code and logs nothing if trying to create a 
> file with no DNs in cluster
> --------------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-5939
>                 URL: https://issues.apache.org/jira/browse/HDFS-5939
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: hdfs-client
>    Affects Versions: 2.3.0
>            Reporter: Yongjun Zhang
>            Assignee: Yongjun Zhang
>         Attachments: HDFS-5939.001.patch, HDFS-5939.002.patch
>
>
> When trying to access hdfs via webhdfs, and when datanode is dead, user will 
> see an exception below without any clue that it's caused by dead datanode:
> $ curl -i -X PUT 
> ".../webhdfs/v1/t1?op=CREATE&user.name=<userName>&overwrite=false"
> ...
> {"RemoteException":{"exception":"IllegalArgumentException","javaClassName":"java.lang.IllegalArgumentException","message":"n
>  must be positive"}}
> Need to fix the report to give user hint about dead datanode.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to