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 20ECCDA89 for ; Wed, 13 Mar 2013 14:08:28 +0000 (UTC) Received: (qmail 25203 invoked by uid 500); 13 Mar 2013 14:08:27 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 24867 invoked by uid 500); 13 Mar 2013 14:08:27 -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 24802 invoked by uid 99); 13 Mar 2013 14:08:26 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Mar 2013 14:08:26 +0000 Date: Wed, 13 Mar 2013 14:08:26 +0000 (UTC) From: "Hudson (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HDFS-4522) LightWeightGSet expects incrementing a volatile to be atomic 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-4522?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13601158#comment-13601158 ] Hudson commented on HDFS-4522: ------------------------------ Integrated in Hadoop-Mapreduce-trunk #1371 (See [https://builds.apache.org/job/Hadoop-Mapreduce-trunk/1371/]) HDFS-4522. LightWeightGSet expects incrementing a volatile to be atomic. Contributed by Colin Patrick McCabe. (Revision 1455780) Result = SUCCESS atm : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1455780 Files : * /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt * /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/util/LightWeightGSet.java > LightWeightGSet expects incrementing a volatile to be atomic > ------------------------------------------------------------ > > Key: HDFS-4522 > URL: https://issues.apache.org/jira/browse/HDFS-4522 > Project: Hadoop HDFS > Issue Type: Bug > Affects Versions: 2.0.5-beta > Reporter: Colin Patrick McCabe > Assignee: Colin Patrick McCabe > Priority: Minor > Fix For: 2.0.5-beta > > Attachments: HDFS-4522.001.patch, HDFS-4522.002.patch > > > LightWeightGSet uses a volatile integer to track the current modification number (kind of an epoch number). > Unfortunately, it includes code like this, that increments this volatile int: > {code} > //insert the element to the head of the linked list > modification++; > size++; > {code} > The bug here is that in between reading the value of modification, incrementing it, and storing it back in the variable, another thread may have modified it. This could lead to lost updates. > We should use {{AtomicInteger}} for these cases. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira