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