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

Steve Loughran commented on HADOOP-12533:
-----------------------------------------

h2. {{seek()}}

# I'd go from {{e.getMessage()}} in the log statement to just {{e}}; some 
exceptions don't have a message, but they do have a {{toString()}} value. I 
don't think it's the case here, but it's still a practise we shouldn't have in 
the codebase.
# in that try/catch statement, I'd add a check for {{in}} being non-null before 
closing it. Use {{ IOUtils.closeStream(in)}} for this

Looking at the whole input stream code, I can see that the close operation 
always assumes in is valid too, it sets {{closed=true}} after closing the 
stream in an unsynced method, and checks for that {{closed==true}} flag are 
patchy. Best to review that code and consistently reject operations like 
{{seek}} on a closed stream., maybe in {{close()}} catch exceptions in 
{{in.close()}} and always set it to null afterwards. 

{code}
public synchronized void close() throws IOException {
  if (!closed) {
    closed = true;
    IOUtils.closeStream(in)
    in = null;
  }
}
{code}

Not sure if this patch is the right place for that (it'll show up in the FS 
contract tests), but at the very least seek() should refuse to seek if 
{{closed==true}} and use {{IOUtils for that close}}. 

> Introduce FileNotFoundException in WASB for read and seek API
> -------------------------------------------------------------
>
>                 Key: HADOOP-12533
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12533
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: tools
>    Affects Versions: 2.8.0
>            Reporter: Dushyanth
>            Assignee: Dushyanth
>             Fix For: 2.8.0
>
>         Attachments: HADOOP-12533.001.patch, HADOOP-12533.002.patch
>
>
> Currently WASB throws a IOException in read and seek API for both Block and 
> Page blobs for scenarios where the backing blobs do not exists. This creates 
> problems for applications like HBase which expect a FileNotFoundException in 
> these scenarios. 
> The fix for the problem is to check if the exceptions from Azure storage is 
> because for Blob not found and throw FileNotFound exception if that is the 
> case.



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

Reply via email to