hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Duo Zhang (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-17434) New Synchronization Scheme for Compaction Pipeline
Date Tue, 10 Jan 2017 08:37:59 GMT

    [ https://issues.apache.org/jira/browse/HBASE-17434?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15814335#comment-15814335

Duo Zhang commented on HBASE-17434:

Volatile - I follow the oracle documentation in https://docs.oracle.com/javase/tutorial/essential/concurrency/atomic.html
which says reads and writes of reference variable are always atomic, while long and double
are atomic if declared volatile. Therefor, version which is long needs to be volatile, but
readOnlyCopy is ok without a volatile.

The readOnlyCopy is just a pointer actually, which means it is a long... And even if java
can guarantee atomic access for a long without volatile, it does not mean you can just avoid
the volatile here. volatile has other side effect as it ensures happens-before order. See


And one example is CopyOnWriteArrayList, the array field is declared as volatile. This is
a class in jdk and written by Doug Lea, the king of concurrent programming in java.


> New Synchronization Scheme for Compaction Pipeline
> --------------------------------------------------
>                 Key: HBASE-17434
>                 URL: https://issues.apache.org/jira/browse/HBASE-17434
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Eshcar Hillel
>            Assignee: Eshcar Hillel
>         Attachments: HBASE-17434-V01.patch, HBASE-17434-V02.patch, HBASE-17434-V03.patch,
HBASE-17434-V04.patch, HBASE-17434.master.001.patch
> A new copyOnWrite synchronization scheme is introduced for the compaction pipeline.
> The new scheme is better since it removes the lock from getSegments() which is invoked
in every get and scan operation, and it reduces the number of LinkedList objects that are
created at runtime, thus can reduce GC (not by much, but still...).
> In addition, it fixes the method getTailSize() in compaction pipeline. This method creates
a MemstoreSize object which comprises the data size and the overhead size of the segment and
needs to be atomic.

This message was sent by Atlassian JIRA

View raw message