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

Wei-Chiu Chuang edited comment on HDFS-13511 at 4/27/18 4:01 PM:
-----------------------------------------------------------------

+1 for a specialized exception class.

 

There are a number of places in Hadoop code where a general IOException is 
thrown and downstream or caller has to do string matching. Like for example 
what I mentioned in HDFS-11711.


was (Author: jojochuang):
+1 for a specialized exception class.

 

There are a number of places in Hadoop code where a general IOException is 
thrown and downstream or caller has to do string match. Like for example what I 
mentioned in HDFS-11711.

> Provide specialized exception when block length cannot be obtained
> ------------------------------------------------------------------
>
>                 Key: HDFS-13511
>                 URL: https://issues.apache.org/jira/browse/HDFS-13511
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>            Reporter: Ted Yu
>            Priority: Major
>
> In downstream project, I saw the following code:
> {code}
>         FSDataInputStream inputStream = hdfs.open(new Path(path));
> ...
>         if (options.getRecoverFailedOpen() && dfs != null && 
> e.getMessage().toLowerCase()
>             .startsWith("cannot obtain block length for")) {
> {code}
> The above tightly depends on the following in DFSInputStream#readBlockLength
> {code}
>     throw new IOException("Cannot obtain block length for " + locatedblock);
> {code}
> The check based on string matching is brittle in production deployment.
> After discussing with [~ste...@apache.org], better approach is to introduce 
> specialized IOException, e.g. CannotObtainBlockLengthException so that 
> downstream project doesn't have to rely on string matching.



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