hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hudson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-4522) LightWeightGSet expects incrementing a volatile to be atomic
Date Wed, 13 Mar 2013 14:08:26 GMT

    [ 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

View raw message