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

Colin Patrick McCabe commented on HADOOP-11626:
-----------------------------------------------

Thanks, Eddy.  I guess what concerns me now is that we are checking for 
{{(nread != len)}}, but then we're announcing that the read was short without 
actually checking that {{nread < len}}.  It might require a logic error for 
{{nread > len}}, but it still seems like something that could happen if there 
is a bug.  I think we should only log about a short read after we check that it 
was short.  There is also another place where this logic message and exception 
occur, so we should change both (or put them in a common function) if we are 
changing either.

> Comment ReadStatistics to indicate that it tracks the actual read occurred
> --------------------------------------------------------------------------
>
>                 Key: HADOOP-11626
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11626
>             Project: Hadoop Common
>          Issue Type: Bug
>    Affects Versions: 2.6.0
>            Reporter: Lei (Eddy) Xu
>            Assignee: Lei (Eddy) Xu
>            Priority: Trivial
>         Attachments: HADOOP-11626.000.patch, HADOOP-11626.001.patch, 
> HADOOP-11626.002.patch
>
>
> In {{DFSOutputStream#actualGetFromOneDataNode()}}, it updates the 
> {{ReadStatistics}} even the read is failed:
> {code}
>         int nread = reader.readAll(buf, offset, len);
>         updateReadStatistics(readStatistics, nread, reader);
>         if (nread != len) {
>           throw new IOException("truncated return from reader.read(): " +
>                                 "excpected " + len + ", got " + nread);
>         }
> {code}
> It indicates that {{ReadStatistics}} tracks actual read occurred. Need to add 
> comment to {{ReadStatistics}} to make this clear.



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

Reply via email to