hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Manjunath Anand (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-17434) New Synchronization Scheme for Compaction Pipeline
Date Sun, 08 Jan 2017 07:02:58 GMT

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

Manjunath Anand commented on HBASE-17434:

Hi [~eshcar] , I went through this patch and the patch submitted for HBASE-17081 and felt
that using ReentrantReadWriteLock would be more advisable than synchronized blocks due to
below 2 reasons:-
1) Allows readers to concurrently access the pipeline and also allows for fine grain read
and write locks where required
2) Also allows to lock on something other than the pipeline. This makes more meaning when
you compare the drain method implemented in the HBASE-17081 patch (which has O(n) complexity)
versus what I present below (which has O(1) complexity) using the new locking mechanism:-
public List<ImmutableSegment> drain() {
    List<ImmutableSegment> result = null;
    try {
      result = this.pipeline;
      this.pipeline = new LinkedList<>();
      this.readOnlyCopy = new LinkedList<>();
    } finally {
    return result;

> 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
> 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