|
|
@ -370,7 +370,9 @@ class MemTableConstructor: public Constructor { |
|
|
|
: Constructor(cmp), |
|
|
|
: Constructor(cmp), |
|
|
|
internal_comparator_(cmp), |
|
|
|
internal_comparator_(cmp), |
|
|
|
table_factory_(new SkipListFactory) { |
|
|
|
table_factory_(new SkipListFactory) { |
|
|
|
memtable_ = new MemTable(internal_comparator_, table_factory_.get()); |
|
|
|
Options options; |
|
|
|
|
|
|
|
options.memtable_factory = table_factory_; |
|
|
|
|
|
|
|
memtable_ = new MemTable(internal_comparator_, options); |
|
|
|
memtable_->Ref(); |
|
|
|
memtable_->Ref(); |
|
|
|
} |
|
|
|
} |
|
|
|
~MemTableConstructor() { |
|
|
|
~MemTableConstructor() { |
|
|
@ -378,7 +380,9 @@ class MemTableConstructor: public Constructor { |
|
|
|
} |
|
|
|
} |
|
|
|
virtual Status FinishImpl(const Options& options, const KVMap& data) { |
|
|
|
virtual Status FinishImpl(const Options& options, const KVMap& data) { |
|
|
|
delete memtable_->Unref(); |
|
|
|
delete memtable_->Unref(); |
|
|
|
memtable_ = new MemTable(internal_comparator_, table_factory_.get()); |
|
|
|
Options memtable_options; |
|
|
|
|
|
|
|
memtable_options.memtable_factory = table_factory_; |
|
|
|
|
|
|
|
memtable_ = new MemTable(internal_comparator_, memtable_options); |
|
|
|
memtable_->Ref(); |
|
|
|
memtable_->Ref(); |
|
|
|
int seq = 1; |
|
|
|
int seq = 1; |
|
|
|
for (KVMap::const_iterator it = data.begin(); |
|
|
|
for (KVMap::const_iterator it = data.begin(); |
|
|
@ -1268,10 +1272,11 @@ class MemTableTest { }; |
|
|
|
TEST(MemTableTest, Simple) { |
|
|
|
TEST(MemTableTest, Simple) { |
|
|
|
InternalKeyComparator cmp(BytewiseComparator()); |
|
|
|
InternalKeyComparator cmp(BytewiseComparator()); |
|
|
|
auto table_factory = std::make_shared<SkipListFactory>(); |
|
|
|
auto table_factory = std::make_shared<SkipListFactory>(); |
|
|
|
MemTable* memtable = new MemTable(cmp, table_factory.get()); |
|
|
|
Options options; |
|
|
|
|
|
|
|
options.memtable_factory = table_factory; |
|
|
|
|
|
|
|
MemTable* memtable = new MemTable(cmp, options); |
|
|
|
memtable->Ref(); |
|
|
|
memtable->Ref(); |
|
|
|
WriteBatch batch; |
|
|
|
WriteBatch batch; |
|
|
|
Options options; |
|
|
|
|
|
|
|
WriteBatchInternal::SetSequence(&batch, 100); |
|
|
|
WriteBatchInternal::SetSequence(&batch, 100); |
|
|
|
batch.Put(std::string("k1"), std::string("v1")); |
|
|
|
batch.Put(std::string("k1"), std::string("v1")); |
|
|
|
batch.Put(std::string("k2"), std::string("v2")); |
|
|
|
batch.Put(std::string("k2"), std::string("v2")); |
|
|
|