[
https://issues.apache.org/jira/browse/HDFS-5939?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13907277#comment-13907277
]
Haohui Mai commented on HDFS-5939:
----------------------------------
{code}
+ LOG.error(" Caught InvalidTopologyException (" + te + ")" +
+ " when trying to redirectURI namenode=" + namenode.toString() +
+ " path=" + path + " op=" + op.toString() +
+ ", suggest to examine the cluster health.");
+ throw new NoDatanodeException("No datanode found");
{code}
You can simply throw an IOException with the message. This is not an error
condition thus I don't think it should log as error. The client will have
sufficient information.
You can fold the unit test into {{TestWebHDFS}}. Based on your description, you
can start the cluster with zero datanode to reproduce the failure.
{code}
+ UserGroupInformation.createUserForTesting("me", new String[]{"my-group"})
+ .doAs(new PrivilegedExceptionAction<Void>() {
{code}
Why {{doAs}} is required?
> 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)