[
https://issues.apache.org/jira/browse/HBASE-17434?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15814858#comment-15814858
]
Duo Zhang commented on HBASE-17434:
-----------------------------------
{quote}
We do not need to ensure happens-before relationship here. This should be
handled at higher level. Can you think of a scenario where this can be a
problem?
The way volatile ensures happens-before is by using memory fences, and we
already have them in the locks. And since this variable is always updated at
the context of a lock its value is not stall for too long.
{quote}
Think of this, you acquire a lock before calling isEmpty, yeah you have a
memory barrior there, and after this but still before calling isEmpty, another
thread calls pushHead or some other methods that modiify the readOnlyCopy, and
then you come in and call isEmpty. The memory barrior can not guarantee that
you can see the change of what pushHead does as the modifications happens after
the memory barrior, right?
Maybe you can claim that this could never happen, for now, but as I've said
many times, we need to keep the code maintainable... Do not put traps in the
code...
Thanks.
> 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
(v6.3.4#6332)