hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lars Hofhansl (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-9963) Remove the ReentrantReadWriteLock in the MemStore
Date Thu, 14 Nov 2013 22:07:21 GMT

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

Lars Hofhansl commented on HBASE-9963:
--------------------------------------

Going to commit this in 0.94 as well.
Ran TestAtomicOperation a few times... All good.

> Remove the ReentrantReadWriteLock in the MemStore
> -------------------------------------------------
>
>                 Key: HBASE-9963
>                 URL: https://issues.apache.org/jira/browse/HBASE-9963
>             Project: HBase
>          Issue Type: Improvement
>          Components: regionserver
>    Affects Versions: 0.98.0, 0.96.0
>            Reporter: Nicolas Liochon
>            Assignee: Nicolas Liochon
>            Priority: Minor
>             Fix For: 0.98.0, 0.96.1, 0.94.14
>
>         Attachments: 9963.96.v3.patch, 9963.v1.patch, 9963.v2.patch, 9963.v3.patch
>
>
> If I'm not wrong, the MemStore is always used from the HStore. The code in HStore puts
a lock before calling MemStore. So the lock in Memstore is useless. 
> For example, in HStore
> {code}
>   @Override
>   public long upsert(Iterable<Cell> cells, long readpoint) throws IOException {
>     this.lock.readLock().lock();
>     try {
>       return this.memstore.upsert(cells, readpoint);
>     } finally {
>       this.lock.readLock().unlock();
>     }
>   }
> {code}
> With this in MemStore
> {code}
>   public long upsert(Iterable<Cell> cells, long readpoint) {
>    this.lock.readLock().lock(); // <==========Am I useful?
>     try {
>       long size = 0;
>       for (Cell cell : cells) {
>         size += upsert(cell, readpoint);
>       }
>       return size;
>     } finally {
>       this.lock.readLock().unlock();
>     }
>   }
> {code}
> I've checked, all the locks in MemStore are backed by a lock in HStore, the only exception
beeing
> {code}
>   void snapshot() {
>     this.memstore.snapshot();
>   }
> {code}
> And I would say it's a bug. If it's confirm ([~lhofhansl], what do you think?), I will
add a lock there and remove all of them in MemStore. They do appear in the profiling.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message