Repository: hbase Updated Branches: refs/heads/0.98 1b4f8afae -> d4e820069
HBASE-12931 The existing KeyValues in memstore are not removed completely after inserting cell into memStore (ChiaPing Tsai) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/d4e82006 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/d4e82006 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/d4e82006 Branch: refs/heads/0.98 Commit: d4e82006940bb2df94810350217a7a2df55eca0e Parents: 1b4f8af Author: tedyu <yuzhih...@gmail.com> Authored: Wed Mar 11 07:47:41 2015 -0700 Committer: tedyu <yuzhih...@gmail.com> Committed: Wed Mar 11 07:47:41 2015 -0700 ---------------------------------------------------------------------- .../java/org/apache/hadoop/hbase/regionserver/MemStore.java | 2 +- .../java/org/apache/hadoop/hbase/regionserver/TestMemStore.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/d4e82006/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java ---------------------------------------------------------------------- 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 8430c1c..caa4c65 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 @@ -588,7 +588,7 @@ public class MemStore implements HeapSize { // only remove Puts that concurrent scanners cannot possibly see if (cur.getTypeByte() == KeyValue.Type.Put.getCode() && cur.getMvccVersion() <= readpoint) { - if (versionsVisible > 1) { + if (versionsVisible >= 1) { // if we get here we have seen at least one version visible to the oldest scanner, // which means we can prove that no scanner will see this version http://git-wip-us.apache.org/repos/asf/hbase/blob/d4e82006/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStore.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStore.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStore.java index 39c6cfb..7fdade9 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStore.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStore.java @@ -833,11 +833,16 @@ public class TestMemStore extends TestCase { long newSize = this.memstore.size.get(); assert(newSize > oldSize); + //The kv1 should be removed. + assert(memstore.kvset.size() == 2); + KeyValue kv4 = KeyValueTestUtil.create("r", "f", "q", 104, "v"); kv4.setMvccVersion(1); l.clear(); l.add(kv4); this.memstore.upsert(l, 3); assertEquals(newSize, this.memstore.size.get()); + //The kv2 should be removed. + assert(memstore.kvset.size() == 2); //this.memstore = null; }