@ -221,8 +221,9 @@ TEST_F(MemTableListTest, GetTest) {
autovector < MemTable * > to_delete ;
autovector < MemTable * > to_delete ;
LookupKey lkey ( " key1 " , seq ) ;
LookupKey lkey ( " key1 " , seq ) ;
bool found = list . current ( ) - > Get ( lkey , & value , & s , & merge_context ,
bool found = list . current ( ) - > Get (
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
lkey , & value , /*timestamp*/ nullptr , & s , & merge_context ,
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
ASSERT_FALSE ( found ) ;
ASSERT_FALSE ( found ) ;
// Create a MemTable
// Create a MemTable
@ -244,19 +245,22 @@ TEST_F(MemTableListTest, GetTest) {
// Fetch the newly written keys
// Fetch the newly written keys
merge_context . Clear ( ) ;
merge_context . Clear ( ) ;
found = mem - > Get ( LookupKey ( " key1 " , seq ) , & value , & s , & merge_context ,
found = mem - > Get ( LookupKey ( " key1 " , seq ) , & value ,
/*timestamp*/ nullptr , & s , & merge_context ,
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
ASSERT_TRUE ( s . ok ( ) & & found ) ;
ASSERT_TRUE ( s . ok ( ) & & found ) ;
ASSERT_EQ ( value , " value1 " ) ;
ASSERT_EQ ( value , " value1 " ) ;
merge_context . Clear ( ) ;
merge_context . Clear ( ) ;
found = mem - > Get ( LookupKey ( " key1 " , 2 ) , & value , & s , & merge_context ,
found = mem - > Get ( LookupKey ( " key1 " , 2 ) , & value ,
/*timestamp*/ nullptr , & s , & merge_context ,
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
// MemTable found out that this key is *not* found (at this sequence#)
// MemTable found out that this key is *not* found (at this sequence#)
ASSERT_TRUE ( found & & s . IsNotFound ( ) ) ;
ASSERT_TRUE ( found & & s . IsNotFound ( ) ) ;
merge_context . Clear ( ) ;
merge_context . Clear ( ) ;
found = mem - > Get ( LookupKey ( " key2 " , seq ) , & value , & s , & merge_context ,
found = mem - > Get ( LookupKey ( " key2 " , seq ) , & value ,
/*timestamp*/ nullptr , & s , & merge_context ,
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
ASSERT_TRUE ( s . ok ( ) & & found ) ;
ASSERT_TRUE ( s . ok ( ) & & found ) ;
ASSERT_EQ ( value , " value2.2 " ) ;
ASSERT_EQ ( value , " value2.2 " ) ;
@ -283,28 +287,29 @@ TEST_F(MemTableListTest, GetTest) {
// Fetch keys via MemTableList
// Fetch keys via MemTableList
merge_context . Clear ( ) ;
merge_context . Clear ( ) ;
found =
found = list . current ( ) - > Get (
list . current ( ) - > Get ( LookupKey ( " key1 " , seq ) , & value , & s , & merge_context ,
LookupKey ( " key1 " , seq ) , & value , /*timestamp*/ nullptr , & s ,
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
& merge_context , & max_covering_tombstone_seq , ReadOptions ( ) ) ;
ASSERT_TRUE ( found & & s . IsNotFound ( ) ) ;
ASSERT_TRUE ( found & & s . IsNotFound ( ) ) ;
merge_context . Clear ( ) ;
merge_context . Clear ( ) ;
found = list . current ( ) - > Get ( LookupKey ( " key1 " , saved_seq ) , & value , & s ,
found = list . current ( ) - > Get (
& merge_context , & max_covering_tombstone_seq ,
LookupKey ( " key1 " , saved_seq ) , & value , /*timestamp*/ nullptr ,
ReadOptions ( ) ) ;
& s , & merge_context , & max_covering_tombstone_seq , ReadOptions ( ) ) ;
ASSERT_TRUE ( s . ok ( ) & & found ) ;
ASSERT_TRUE ( s . ok ( ) & & found ) ;
ASSERT_EQ ( " value1 " , value ) ;
ASSERT_EQ ( " value1 " , value ) ;
merge_context . Clear ( ) ;
merge_context . Clear ( ) ;
found =
found = list . current ( ) - > Get (
list . current ( ) - > Get ( LookupKey ( " key2 " , seq ) , & value , & s , & merge_context ,
LookupKey ( " key2 " , seq ) , & value , /*timestamp*/ nullptr , & s ,
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
& merge_context , & max_covering_tombstone_seq , ReadOptions ( ) ) ;
ASSERT_TRUE ( s . ok ( ) & & found ) ;
ASSERT_TRUE ( s . ok ( ) & & found ) ;
ASSERT_EQ ( value , " value2.3 " ) ;
ASSERT_EQ ( value , " value2.3 " ) ;
merge_context . Clear ( ) ;
merge_context . Clear ( ) ;
found = list . current ( ) - > Get ( LookupKey ( " key2 " , 1 ) , & value , & s , & merge_context ,
found = list . current ( ) - > Get (
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
LookupKey ( " key2 " , 1 ) , & value , /*timestamp*/ nullptr , & s ,
& merge_context , & max_covering_tombstone_seq , ReadOptions ( ) ) ;
ASSERT_FALSE ( found ) ;
ASSERT_FALSE ( found ) ;
ASSERT_EQ ( 2 , list . NumNotFlushed ( ) ) ;
ASSERT_EQ ( 2 , list . NumNotFlushed ( ) ) ;
@ -333,8 +338,9 @@ TEST_F(MemTableListTest, GetFromHistoryTest) {
autovector < MemTable * > to_delete ;
autovector < MemTable * > to_delete ;
LookupKey lkey ( " key1 " , seq ) ;
LookupKey lkey ( " key1 " , seq ) ;
bool found = list . current ( ) - > Get ( lkey , & value , & s , & merge_context ,
bool found = list . current ( ) - > Get (
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
lkey , & value , /*timestamp*/ nullptr , & s , & merge_context ,
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
ASSERT_FALSE ( found ) ;
ASSERT_FALSE ( found ) ;
// Create a MemTable
// Create a MemTable
@ -355,13 +361,15 @@ TEST_F(MemTableListTest, GetFromHistoryTest) {
// Fetch the newly written keys
// Fetch the newly written keys
merge_context . Clear ( ) ;
merge_context . Clear ( ) ;
found = mem - > Get ( LookupKey ( " key1 " , seq ) , & value , & s , & merge_context ,
found = mem - > Get ( LookupKey ( " key1 " , seq ) , & value ,
/*timestamp*/ nullptr , & s , & merge_context ,
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
// MemTable found out that this key is *not* found (at this sequence#)
// MemTable found out that this key is *not* found (at this sequence#)
ASSERT_TRUE ( found & & s . IsNotFound ( ) ) ;
ASSERT_TRUE ( found & & s . IsNotFound ( ) ) ;
merge_context . Clear ( ) ;
merge_context . Clear ( ) ;
found = mem - > Get ( LookupKey ( " key2 " , seq ) , & value , & s , & merge_context ,
found = mem - > Get ( LookupKey ( " key2 " , seq ) , & value ,
/*timestamp*/ nullptr , & s , & merge_context ,
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
ASSERT_TRUE ( s . ok ( ) & & found ) ;
ASSERT_TRUE ( s . ok ( ) & & found ) ;
ASSERT_EQ ( value , " value2.2 " ) ;
ASSERT_EQ ( value , " value2.2 " ) ;
@ -372,15 +380,15 @@ TEST_F(MemTableListTest, GetFromHistoryTest) {
// Fetch keys via MemTableList
// Fetch keys via MemTableList
merge_context . Clear ( ) ;
merge_context . Clear ( ) ;
found =
found = list . current ( ) - > Get ( LookupKey ( " key1 " , seq ) , & value ,
list . current ( ) - > Get ( LookupKey ( " key1 " , seq ) , & value , & s , & merge_context ,
/*timestamp*/ nullptr , & s , & merge_context ,
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
ASSERT_TRUE ( found & & s . IsNotFound ( ) ) ;
ASSERT_TRUE ( found & & s . IsNotFound ( ) ) ;
merge_context . Clear ( ) ;
merge_context . Clear ( ) ;
found =
found = list . current ( ) - > Get ( LookupKey ( " key2 " , seq ) , & value ,
list . current ( ) - > Get ( LookupKey ( " key2 " , seq ) , & value , & s , & merge_context ,
/*timestamp*/ nullptr , & s , & merge_context ,
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
ASSERT_TRUE ( s . ok ( ) & & found ) ;
ASSERT_TRUE ( s . ok ( ) & & found ) ;
ASSERT_EQ ( " value2.2 " , value ) ;
ASSERT_EQ ( " value2.2 " , value ) ;
@ -400,27 +408,27 @@ TEST_F(MemTableListTest, GetFromHistoryTest) {
// Verify keys are no longer in MemTableList
// Verify keys are no longer in MemTableList
merge_context . Clear ( ) ;
merge_context . Clear ( ) ;
found =
found = list . current ( ) - > Get ( LookupKey ( " key1 " , seq ) , & value ,
list . current ( ) - > Get ( LookupKey ( " key1 " , seq ) , & value , & s , & merge_context ,
/*timestamp*/ nullptr , & s , & merge_context ,
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
ASSERT_FALSE ( found ) ;
ASSERT_FALSE ( found ) ;
merge_context . Clear ( ) ;
merge_context . Clear ( ) ;
found =
found = list . current ( ) - > Get ( LookupKey ( " key2 " , seq ) , & value ,
list . current ( ) - > Get ( LookupKey ( " key2 " , seq ) , & value , & s , & merge_context ,
/*timestamp*/ nullptr , & s , & merge_context ,
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
ASSERT_FALSE ( found ) ;
ASSERT_FALSE ( found ) ;
// Verify keys are present in history
// Verify keys are present in history
merge_context . Clear ( ) ;
merge_context . Clear ( ) ;
found = list . current ( ) - > GetFromHistory (
found = list . current ( ) - > GetFromHistory (
LookupKey ( " key1 " , seq ) , & value , & s , & merge_context ,
LookupKey ( " key1 " , seq ) , & value , /*timestamp*/ nullptr , & s , & merge_context ,
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
ASSERT_TRUE ( found & & s . IsNotFound ( ) ) ;
ASSERT_TRUE ( found & & s . IsNotFound ( ) ) ;
merge_context . Clear ( ) ;
merge_context . Clear ( ) ;
found = list . current ( ) - > GetFromHistory (
found = list . current ( ) - > GetFromHistory (
LookupKey ( " key2 " , seq ) , & value , & s , & merge_context ,
LookupKey ( " key2 " , seq ) , & value , /*timestamp*/ nullptr , & s , & merge_context ,
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
ASSERT_TRUE ( found ) ;
ASSERT_TRUE ( found ) ;
ASSERT_EQ ( " value2.2 " , value ) ;
ASSERT_EQ ( " value2.2 " , value ) ;
@ -462,42 +470,42 @@ TEST_F(MemTableListTest, GetFromHistoryTest) {
// Verify keys are no longer in MemTableList
// Verify keys are no longer in MemTableList
merge_context . Clear ( ) ;
merge_context . Clear ( ) ;
found =
found = list . current ( ) - > Get ( LookupKey ( " key1 " , seq ) , & value ,
list . current ( ) - > Get ( LookupKey ( " key1 " , seq ) , & value , & s , & merge_context ,
/*timestamp*/ nullptr , & s , & merge_context ,
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
ASSERT_FALSE ( found ) ;
ASSERT_FALSE ( found ) ;
merge_context . Clear ( ) ;
merge_context . Clear ( ) ;
found =
found = list . current ( ) - > Get ( LookupKey ( " key2 " , seq ) , & value ,
list . current ( ) - > Get ( LookupKey ( " key2 " , seq ) , & value , & s , & merge_context ,
/*timestamp*/ nullptr , & s , & merge_context ,
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
ASSERT_FALSE ( found ) ;
ASSERT_FALSE ( found ) ;
merge_context . Clear ( ) ;
merge_context . Clear ( ) ;
found =
found = list . current ( ) - > Get ( LookupKey ( " key3 " , seq ) , & value ,
list . current ( ) - > Get ( LookupKey ( " key3 " , seq ) , & value , & s , & merge_context ,
/*timestamp*/ nullptr , & s , & merge_context ,
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
ASSERT_FALSE ( found ) ;
ASSERT_FALSE ( found ) ;
// Verify that the second memtable's keys are in the history
// Verify that the second memtable's keys are in the history
merge_context . Clear ( ) ;
merge_context . Clear ( ) ;
found = list . current ( ) - > GetFromHistory (
found = list . current ( ) - > GetFromHistory (
LookupKey ( " key1 " , seq ) , & value , & s , & merge_context ,
LookupKey ( " key1 " , seq ) , & value , /*timestamp*/ nullptr , & s , & merge_context ,
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
ASSERT_TRUE ( found & & s . IsNotFound ( ) ) ;
ASSERT_TRUE ( found & & s . IsNotFound ( ) ) ;
merge_context . Clear ( ) ;
merge_context . Clear ( ) ;
found = list . current ( ) - > GetFromHistory (
found = list . current ( ) - > GetFromHistory (
LookupKey ( " key3 " , seq ) , & value , & s , & merge_context ,
LookupKey ( " key3 " , seq ) , & value , /*timestamp*/ nullptr , & s , & merge_context ,
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
ASSERT_TRUE ( found ) ;
ASSERT_TRUE ( found ) ;
ASSERT_EQ ( " value3 " , value ) ;
ASSERT_EQ ( " value3 " , value ) ;
// Verify that key2 from the first memtable is no longer in the history
// Verify that key2 from the first memtable is no longer in the history
merge_context . Clear ( ) ;
merge_context . Clear ( ) ;
found =
found = list . current ( ) - > Get ( LookupKey ( " key2 " , seq ) , & value ,
list . current ( ) - > Get ( LookupKey ( " key2 " , seq ) , & value , & s , & merge_context ,
/*timestamp*/ nullptr , & s , & merge_context ,
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
& max_covering_tombstone_seq , ReadOptions ( ) ) ;
ASSERT_FALSE ( found ) ;
ASSERT_FALSE ( found ) ;
// Cleanup
// Cleanup