You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Nicolas Liochon (JIRA)" <ji...@apache.org> on 2013/11/13 13:01:26 UTC
[jira] [Created] (HBASE-9963) Remove the ReentrantReadWriteLock in
the MemStore
Nicolas Liochon created HBASE-9963:
--------------------------------------
Summary: 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.96.0, 0.98.0
Reporter: Nicolas Liochon
Assignee: Nicolas Liochon
Priority: Minor
Fix For: 0.98.0, 0.96.1
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)