summaryrefslogtreecommitdiff
path: root/memtable
diff options
context:
space:
mode:
authorBaptiste Lemaire <blemaire@fb.com>2021-08-13 14:34:43 -0700
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>2021-08-13 14:35:41 -0700
commite51be2c5a1ea66f2e79ef10f7d43b9338c0a7ef1 (patch)
tree6bca48ffcbb7e7d672e9e2f18431f3cd30b3824e /memtable
parent74a652a45ff63350640245ba7994bebc748bb0d4 (diff)
Improve MemPurge sampling (#8656)
Summary: Previously, the `MemPurge` sampling function was assessing whether a random entry from a memtable was garbage or not by simply querying the given memtable (see https://github.com/facebook/rocksdb/issues/8628 for more details). In this diff, I am updating the sampling function by querying not only the memtable the entry was drawn from, but also all subsequent memtables that have a greater memtable ID. I also added the size of the value for KV entries in the payload/useful payload estimates (which was also one of the reasons why sampling was not as good as mempurging all the time in terms of L0 SST files reduction). Once these changes were made, I was able to clean obsolete objects and functions from the `MemtableList` struct, and did a bit of cleanup everywhere. Pull Request resolved: https://github.com/facebook/rocksdb/pull/8656 Reviewed By: pdillinger Differential Revision: D30288583 Pulled By: bjlemaire fbshipit-source-id: 7646a545ec56f4715949daa59ab5eee74540feb3
Diffstat (limited to 'memtable')
-rw-r--r--memtable/skiplistrep.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/memtable/skiplistrep.cc b/memtable/skiplistrep.cc
index abe7144ab..d7f78672f 100644
--- a/memtable/skiplistrep.cc
+++ b/memtable/skiplistrep.cc
@@ -97,8 +97,8 @@ public:
return (end_count >= start_count) ? (end_count - start_count) : 0;
}
- void UniqueRandomSample(const uint64_t& num_entries,
- const uint64_t& target_sample_size,
+ void UniqueRandomSample(const uint64_t num_entries,
+ const uint64_t target_sample_size,
std::unordered_set<const char*>* entries) override {
entries->clear();
// Avoid divide-by-0.