From febd79c1282c7e73e3f9aae1f7143474b1dde76c Mon Sep 17 00:00:00 2001 From: Zhihong Yu Date: Tue, 15 Oct 2013 17:03:07 +0000 Subject: [PATCH] HBASE-9753 Excessive readpoint checks in MemstoreScanner git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1532432 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/hadoop/hbase/regionserver/MemStore.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java index ea1fc20b4a2..2e10e05badd 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java @@ -678,7 +678,7 @@ public class MemStore implements HeapSize { this.lock.readLock().lock(); try { return Collections.singletonList( - new MemStoreScanner()); + new MemStoreScanner(MultiVersionConsistencyControl.getThreadReadPoint())); } finally { 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 volatile MemStoreLAB allocatorAtCreation; volatile MemStoreLAB snapshotAllocatorAtCreation; + + private long readPoint; /* Some notes... @@ -752,9 +754,10 @@ public class MemStore implements HeapSize { the adds to kvset in the MemStoreScanner. */ - MemStoreScanner() { + MemStoreScanner(long readPoint) { super(); + this.readPoint = readPoint; kvsetAtCreation = kvset; snapshotAtCreation = snapshot; if (allocator != null) { @@ -768,13 +771,11 @@ public class MemStore implements HeapSize { } private KeyValue getNext(Iterator it) { - long readPoint = MultiVersionConsistencyControl.getThreadReadPoint(); - KeyValue v = null; try { while (it.hasNext()) { v = it.next(); - if (v.getMvccVersion() <= readPoint) { + if (v.getMvccVersion() <= this.readPoint) { return v; } }