Skip to content

Commit

Permalink
Spdb memtable: improve performance (#298)
Browse files Browse the repository at this point in the history
Reduce lock access between switch writes vectors
Avoid unnecessary lock between read and writes
Decrease the writes vectors numbers
  • Loading branch information
ayulas authored and Yuval-Ariel committed Feb 1, 2023
1 parent 66413ff commit 1247fca
Show file tree
Hide file tree
Showing 8 changed files with 815 additions and 336 deletions.
4 changes: 4 additions & 0 deletions db/memtable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,9 @@ class MemTableIterator : public InternalIterator {
iter_ = mem.table_->GetDynamicPrefixIterator(arena);
} else {
iter_ = mem.table_->GetIterator(arena);
/*if (iter_->IsEmpty()) {
is_empty_ = true;
}*/
}
status_.PermitUncheckedError();
}
Expand Down Expand Up @@ -417,6 +420,7 @@ class MemTableIterator : public InternalIterator {
#endif

bool Valid() const override { return valid_ && status_.ok(); }

void Seek(const Slice& k) override {
PERF_TIMER_GUARD(seek_on_memtable_time);
PERF_COUNTER_ADD(seek_on_memtable_count, 1);
Expand Down
2 changes: 2 additions & 0 deletions include/rocksdb/memtablerep.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ class MemTableRep {
// Returns true iff the iterator is positioned at a valid node.
virtual bool Valid() const = 0;

virtual bool IsEmpty() { return false; }

// Returns the key at the current position.
// REQUIRES: Valid()
virtual const char* key() const = 0;
Expand Down
1 change: 1 addition & 0 deletions options/cf_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ struct MutableCFOptions {
size_t memtable_huge_page_size;
size_t max_successive_merges;
size_t inplace_update_num_locks;

std::shared_ptr<const SliceTransform> prefix_extractor;
// [experimental]
// Used to activate or deactive the Mempurge feature (memtable garbage
Expand Down
Loading

0 comments on commit 1247fca

Please sign in to comment.