diff --git a/Makefile b/Makefile index 0fa9d42dc..2665c3a21 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,8 @@ TESTS = \ filelock_test \ merge_test \ redis_test \ - manual_compaction_test + manual_compaction_test \ + stringappend_test TOOLS = \ sst_dump \ diff --git a/utilities/merge_operators/string_append/stringappend_test.cc b/utilities/merge_operators/string_append/stringappend_test.cc index 70128b02c..7fff3e5d9 100644 --- a/utilities/merge_operators/string_append/stringappend_test.cc +++ b/utilities/merge_operators/string_append/stringappend_test.cc @@ -329,6 +329,26 @@ TEST(StringAppendOperatorTest,PersistentVariousKeys) { slists.Append("b","l;"); slists.Append("c","rogosh"); + // The previous changes should be on disk (L0) + // The most recent changes should be in memory (MemTable) + // Hence, this will test both Get() paths. + std::string a,b,c; + slists.Get("a",&a); + slists.Get("b",&b); + slists.Get("c",&c); + + ASSERT_EQ(a,"x\nt\nr\nsa\ngh\njk"); + ASSERT_EQ(b,"y\n2\ndf\nl;"); + ASSERT_EQ(c,"asdasd\nasdasd\nbbnagnagsx\nrogosh"); + } + + // Reopen the database (the previous changes should persist / be remembered) + { + StringAppendOperator append_op('\n'); + auto db = OpenDb(&append_op); + StringLists slists(db); + + // All changes should be on disk. This will test VersionSet Get() std::string a,b,c; slists.Get("a",&a); slists.Get("b",&b);