[
https://issues.apache.org/jira/browse/HDFS-6803?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14086314#comment-14086314
]
Yi Liu commented on HDFS-6803:
------------------------------
Hi [[email protected]], yes, the thread safety model for Hadoop
InputStream/OutputStream is a bit chaotic: most methods are synchronized, but
some others are not. Positioned read requires implementions should be
thread-safe, but WebHDFS inputstream(HDFS-6813), HarInputStream (HADOOP-10930)
don't follow, DFSInputStream is not thread-safe(maybe it is after synchronizing
few object variables). We should make them consistent.
If we don't to make thread-safe for them, we'd better to remove related
*synchronized*, then it's a bit more efficient. If we want thread-safe, we
should ensure it.
> Documenting DFSClient#DFSInputStream expectations reading and preading in
> concurrent context
> --------------------------------------------------------------------------------------------
>
> Key: HDFS-6803
> URL: https://issues.apache.org/jira/browse/HDFS-6803
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: hdfs-client
> Affects Versions: 2.4.1
> Reporter: stack
> Attachments: DocumentingDFSClientDFSInputStream (1).pdf
>
>
> Reviews of the patch posted the parent task suggest that we be more explicit
> about how DFSIS is expected to behave when being read by contending threads.
> It is also suggested that presumptions made internally be made explicit
> documenting expectations.
> Before we put up a patch we've made a document of assertions we'd like to
> make into tenets of DFSInputSteam. If agreement, we'll attach to this issue
> a patch that weaves the assumptions into DFSIS as javadoc and class comments.
--
This message was sent by Atlassian JIRA
(v6.2#6252)