HBASE-9753 Excessive readpoint checks in MemstoreScanner

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1532432 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2013-10-15 17:03:07 +00:00
parent 16bf1c48f0
commit febd79c128
1 changed files with 6 additions and 5 deletions

View File

@ -678,7 +678,7 @@ public class MemStore implements HeapSize {
this.lock.readLock().lock(); this.lock.readLock().lock();
try { try {
return Collections.<KeyValueScanner>singletonList( return Collections.<KeyValueScanner>singletonList(
new MemStoreScanner()); new MemStoreScanner(MultiVersionConsistencyControl.getThreadReadPoint()));
} finally { } finally {
this.lock.readLock().unlock(); this.lock.readLock().unlock();
} }
@ -730,6 +730,8 @@ public class MemStore implements HeapSize {
// The allocator and snapshot allocator at the time of creating this scanner // The allocator and snapshot allocator at the time of creating this scanner
volatile MemStoreLAB allocatorAtCreation; volatile MemStoreLAB allocatorAtCreation;
volatile MemStoreLAB snapshotAllocatorAtCreation; volatile MemStoreLAB snapshotAllocatorAtCreation;
private long readPoint;
/* /*
Some notes... Some notes...
@ -752,9 +754,10 @@ public class MemStore implements HeapSize {
the adds to kvset in the MemStoreScanner. the adds to kvset in the MemStoreScanner.
*/ */
MemStoreScanner() { MemStoreScanner(long readPoint) {
super(); super();
this.readPoint = readPoint;
kvsetAtCreation = kvset; kvsetAtCreation = kvset;
snapshotAtCreation = snapshot; snapshotAtCreation = snapshot;
if (allocator != null) { if (allocator != null) {
@ -768,13 +771,11 @@ public class MemStore implements HeapSize {
} }
private KeyValue getNext(Iterator<KeyValue> it) { private KeyValue getNext(Iterator<KeyValue> it) {
long readPoint = MultiVersionConsistencyControl.getThreadReadPoint();
KeyValue v = null; KeyValue v = null;
try { try {
while (it.hasNext()) { while (it.hasNext()) {
v = it.next(); v = it.next();
if (v.getMvccVersion() <= readPoint) { if (v.getMvccVersion() <= this.readPoint) {
return v; return v;
} }
} }