Return-Path: X-Original-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4C70C18DC8 for ; Tue, 2 Jun 2015 06:26:18 +0000 (UTC) Received: (qmail 96010 invoked by uid 500); 2 Jun 2015 06:26:18 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 95953 invoked by uid 500); 2 Jun 2015 06:26:18 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-issues@hadoop.apache.org Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 95941 invoked by uid 99); 2 Jun 2015 06:26:18 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Jun 2015 06:26:18 +0000 Date: Tue, 2 Jun 2015 06:26:18 +0000 (UTC) From: "Rakesh R (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HDFS-8386) Improve synchronization of 'streamer' reference in DFSOutputStream - accessed inconsistently with respect to synchronization MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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)