[
https://issues.apache.org/jira/browse/HDFS-8386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14568620#comment-14568620
]
Rakesh R commented on HDFS-8386:
--------------------------------
Thank you [~andrew.wang] for the interest.
{{streamer}} is used by the erasure coding element
[DFSStripedOutputStream.java#L283|https://github.com/apache/hadoop/blob/HDFS-7285/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSStripedOutputStream.java#L283].
Considering this usage, can we keep the visibility same as {{protected}}. But
I feel it is possible to to make the visibility to {{private}}, following is
one proposal to make it {{private}}. I hope the below code snippet will be
helpful to know about the proposed changes. If you agree I'm happy to do the
changes accordingly. Any thoughts?
# Expose update and getter API in DFSOutputStream.java:
{code}
protected synchronized void updateStreamer(DataStreamer streamer) {
this.streamer = streamer;
}
protected synchronized DataStreamer getStreamer() {
return streamer;
}
{code}
# Modify the logic to access {{streamer}} in DFSStripedOutputStream.java like,
{code}
private synchronized StripedDataStreamer getCurrentStreamer() {
return (StripedDataStreamer)super.getStreamer();
}
private synchronized StripedDataStreamer setCurrentStreamer(int i) {
super.updateStreamer(streamers.get(i));
return getCurrentStreamer();
}
{code}
> Improve synchronization of 'streamer' reference in DFSOutputStream - accessed
> inconsistently with respect to synchronization
> ----------------------------------------------------------------------------------------------------------------------------
>
> Key: HDFS-8386
> URL: https://issues.apache.org/jira/browse/HDFS-8386
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: hdfs-client
> Reporter: Rakesh R
> Assignee: Rakesh R
> Attachments: HDFS-8386-00.patch
>
>
> Presently {{DFSOutputStream#streamer}} object reference is accessed
> inconsistently with respect to synchronization. It would be good to improve
> this part. This has been noticed when implementing the erasure coding feature.
> Please refer the related [discussion
> thread|https://issues.apache.org/jira/browse/HDFS-8294?focusedCommentId=14541411&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14541411]
> in the jira HDFS-8294 for more details.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)