Commit 1d589808 authored by Daniel Murphy's avatar Daniel Murphy Committed by Commit Bot

[LevelDBService] Disabling block caching on bulk scans

Bug: 784020
Change-Id: I973eb7cbd7067ce3a95a4ee4781f9d8aa3d54739
Reviewed-on: https://chromium-review.googlesource.com/765096Reviewed-by: default avatarMarijn Kruisselbrink <mek@chromium.org>
Commit-Queue: Daniel Murphy <dmurph@chromium.org>
Cr-Commit-Position: refs/heads/master@{#516102}
parent 4eea3abf
......@@ -27,8 +27,12 @@ template <typename FunctionType>
leveldb::Status ForEachWithPrefix(leveldb::DB* db,
const leveldb::Slice& key_prefix,
FunctionType function) {
std::unique_ptr<leveldb::Iterator> it(
db->NewIterator(leveldb::ReadOptions()));
leveldb::ReadOptions read_options;
// Disable filling the cache for bulk scans. Either this is for deletion
// (where caching those blocks doesn't make sense) or a mass-read, which the
// user "should" be caching / only needing once.
read_options.fill_cache = false;
std::unique_ptr<leveldb::Iterator> it(db->NewIterator(read_options));
it->Seek(key_prefix);
for (; it->Valid(); it->Next()) {
if (!it->key().starts_with(key_prefix))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment