hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Loughran (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-12726) Unsupported operations should throw UnsupportedOperationException
Date Wed, 27 Jan 2016 18:02:39 GMT

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

Steve Loughran commented on HADOOP-12726:
-----------------------------------------

bq. I'd also balk at creating Frankenstein's exception.

see {{java.io.InterruptedIOException}} as evidence our strategy is legitmate

bq. Is your concern that some bits of the system are catching IOException with the expectation
that they will also catch unsupported operations? 

 Yes, I am confident that some apps will be doing just that. Indeed, I'd use your KMS patch
as an example.

bq. I think it should be pretty reasonable to go through the code to find all cases of calls
to potentially unsupported operations

Which code are we talking about here? FileSystem is a public API, tagged as stable. To see
how these things get used, you can't just look at Hadoop-core, you need HBase, accumulo, spark,
hive, ... etc in your IDE. I know, I've been there.

The exception model is part of its semantics.

Now, looking at what coverage there is of the [FS API|https://hadoop.apache.org/docs/stable2/hadoop-project-dist/hadoop-common/filesystem/fsdatainputstream.html],
it does say that seek can throw UnsupportedOperationException, indeed, it's implied its preferred
to an IOE.

{code}
supported(FSDIS, Seekable.seek) else raise [UnsupportedOperationException, IOException]
{code}

Which meant when I was rummaging around the implementations of seek(), some must do this -looks
like {{CompressionInputStream}} is one of them.

So, if you can show that other implementations of various unsupported operations are actually
throwing {{UnsupportedOperationException}} then  you can make the case that changing the exception
is not incompatible, just making things more consistent. You get to be the one who looks through
all the methods though

> Unsupported operations should throw UnsupportedOperationException
> -----------------------------------------------------------------
>
>                 Key: HADOOP-12726
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12726
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: fs
>    Affects Versions: 2.7.1
>            Reporter: Daniel Templeton
>            Assignee: Daniel Templeton
>
> In the {{FileSystem}} implementation classes, unsupported operations throw {{new IOException("Not
supported")}}, which makes it needlessly difficult to distinguish an actual error from an
unsupported operation.  They should instead throw {{new UnsupportedOperationException()}}.
> It's possible that this anti-idiom is used elsewhere in the code base.  This JIRA should
include finding and cleaning up those instances as well.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message