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

Kai Zheng commented on HDFS-8905:
---------------------------------

Hi [~rakeshr], I'm back to your comments. Please note the logic codes are 
mostly from old codes as this issue indicated that it's a refactoring. Read of 
a buffer is from *copyFrom* method. In read of a BlockReader, the old code 
tells the destination bytebuffer position shouldn't be affected in case of 
failure, which is reasonable because BlockReader incurs remote access; In copy 
from a bytebuffer, errors are not likely to happen so we don't need the similar 
codes. Now as [~zhz] suggested we'll have *readBlock* and *readBuffer*, which 
may solve the second concern in your comments, because it explicitly tells the 
difference, and the behavior won't need to be strictly consistent. Note the two 
methods or the whole class are not thread safe and they're not expected to be 
called concurrently. If they're called in a thread, the offset is correctly 
maintained and I don't see any problem. Now these classes stand alone, I will 
add more javadocs, avoiding such confusion or concern. Sounds OK?

> Refactor DFSInputStream#ReaderStrategy
> --------------------------------------
>
>                 Key: HDFS-8905
>                 URL: https://issues.apache.org/jira/browse/HDFS-8905
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: erasure-coding
>            Reporter: Kai Zheng
>            Assignee: Kai Zheng
>         Attachments: HDFS-8905-HDFS-7285-v1.patch, HDFS-8905-v2.patch
>
>
> DFSInputStream#ReaderStrategy family don't look very good. This refactors a 
> little bit to make them make more sense.



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

Reply via email to