HBASE-12931 The existing KeyValues in memstore are not removed completely after inserting cell into memStore (ChiaPing Tsai)

This commit is contained in:
tedyu 2015-03-07 08:26:43 -08:00
parent b6da97890b
commit 76cbf7da65
2 changed files with 6 additions and 2 deletions

View File

@ -588,7 +588,7 @@ public class DefaultMemStore implements MemStore {
// only remove Puts that concurrent scanners cannot possibly see
if (cur.getTypeByte() == KeyValue.Type.Put.getCode() &&
cur.getSequenceId() <= 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

View File

@ -843,12 +843,16 @@ public class TestDefaultMemStore extends TestCase {
this.memstore.upsert(l, 2);// readpoint is 2
long newSize = this.memstore.size.get();
assert(newSize > oldSize);
//The kv1 should be removed.
assert(memstore.cellSet.size() == 2);
KeyValue kv4 = KeyValueTestUtil.create("r", "f", "q", 104, "v");
kv4.setSequenceId(1);
l.clear(); l.add(kv4);
this.memstore.upsert(l, 3);
assertEquals(newSize, this.memstore.size.get());
//The kv2 should be removed.
assert(memstore.cellSet.size() == 2);
//this.memstore = null;
}