[
https://issues.apache.org/jira/browse/HDFS-6803?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14086397#comment-14086397
]
Yi Liu commented on HDFS-6803:
------------------------------
{quote}
positional read and non-positional can run concurrently
{quote}
Agree, It's better to do like this.
[[email protected]] said: {quote}
Isolation of pread operations
When a pread is in progress, should that change be visible in getPos()?
If not, the method will need to be made synchronized on all implementations (it
isn't right now; I checked). I
If it can be visible, then we could pull the synchronized marker off some
implementations and remove that as a lock point.
{quote}
I think It depends on inputstream implementation and whether pread needs to
modify pos and rely on other Ops like seek().
org.apache.hadoop.hdfs.DFSInputStream will not modify the pos, so we *don't
need to synchronize* it with other methods such as read(), we just need to
synchronize few object variables like {{failures}}, we can define local
{{failures}} to resolve this problem.
On the other hand, if pread relies on pos or Ops like seek(), then we should
synchronized pread with all other methods.
> 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)