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

Li Bo commented on HDFS-7854:
-----------------------------

hi, Jing
we may encounter some problems in your way of handling of 
{{queueCurrentPacket}} and {{waitAndQueueCurrentPacket}}, and also 
{{waitForAckedSeqno}}.
{{DFSOutputStream#closed}} is different with {{DataStreamer#streamClosed}}. If 
we move these three methods to DataStreamer and replace 
{{DFSOutputStream#closed}} with {{DataStreamer#streamClosed}}, we have changed 
some logic of the original code. For example, two threads(t1, t2) share the 
same DFSOutputStream, if t1 call {{ DFSOutputStream #close()}}, and an 
exception is thrown in this function before closing streamer, then 
{{DFSOutputStream#closed}} is true and {{DataStreamer#streamClosed}} is still 
false. If t2 calls {{ waitForAckedSeqno }}, originally it will immediately quit 
this function because {{DFSOutputStream#closed}} is true; if we call 
{{streamer. waitForAckedSeqno ()}}, now {{DataStreamer#streamClosed}} is still 
false, so t2 will wait for the while loop to exit. I remember that I have 
encountered such kinds of problems before.

Because DFSOutputStream also generates packets, I think it’s not bad for 
DFSOutputStream to maintain a queue shared with a DataStreamer, and it gives 
less changes to the original code.


> Separate class DataStreamer out of DFSOutputStream
> --------------------------------------------------
>
>                 Key: HDFS-7854
>                 URL: https://issues.apache.org/jira/browse/HDFS-7854
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: Li Bo
>            Assignee: Li Bo
>         Attachments: HDFS-7854-001.patch, HDFS-7854-002.patch, 
> HDFS-7854-003.patch
>
>
> This sub task separate DataStreamer from DFSOutputStream. New DataStreamer 
> will accept packets and write them to remote datanodes.



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

Reply via email to