disable populating block cache for in-place updates

Summary:
There's no point populating the block cache during this read. The key we read is guaranteed to be overwritten with a new `kValueType` key immediately afterwards, so can't be accessed again. A user was seeing high turnover of data blocks, at least partially due to this.
Closes https://github.com/facebook/rocksdb/pull/2959

Differential Revision: D5961672

Pulled By: ajkr

fbshipit-source-id: e7cb27c156c5db3b32af355c780efb99dbdf087c
main
Andrew Kryczka 7 years ago committed by Facebook Github Bot
parent d27258d3a6
commit 880411f54c
  1. 9
      db/write_batch.cc

@ -848,10 +848,8 @@ class MemTableInserter : public WriteBatch::Handler {
// cause memory allocations though unused.
// Make creation optional but do not incur
// unique_ptr additional allocation
using
MemPostInfoMap = std::map<MemTable*, MemTablePostProcessInfo>;
using
PostMapType = std::aligned_storage<sizeof(MemPostInfoMap)>::type;
using MemPostInfoMap = std::map<MemTable*, MemTablePostProcessInfo>;
using PostMapType = std::aligned_storage<sizeof(MemPostInfoMap)>::type;
PostMapType mem_post_info_map_;
// current recovered transaction we are rebuilding (recovery)
WriteBatch* rebuilding_trx_;
@ -1002,6 +1000,9 @@ class MemTableInserter : public WriteBatch::Handler {
SnapshotImpl read_from_snapshot;
read_from_snapshot.number_ = sequence_;
ReadOptions ropts;
// it's going to be overwritten for sure, so no point caching data block
// containing the old version
ropts.fill_cache = false;
ropts.snapshot = &read_from_snapshot;
std::string prev_value;

Loading…
Cancel
Save