facebook / facebook/rocksdb

DeleteRange doesn't work well with row_cache

Open
#4,122 4 comments 2 reactions 1 assignee Claimed by @ajkr View on GitHub
Dominant language
C++
Stars
32.1k
Forks
6.9k
Avg merge
32m
Merged PRs (30d)
1

Description

### Expected behavior & Actual behavior
when row_cache is enabled,
after we delete a key by a DeleteRange call,
we can still Get the key and its value from the db

### Steps to reproduce the behavior
```cpp
#include
#include

int main() {
rocksdb::Options ops;
ops.max_write_buffer_number = 1;
ops.create_if_missing = true;
ops.row_cache = rocksdb::NewLRUCache(1024);

rocksdb::DB *db = nullptr;
auto s = rocksdb::DB::Open(ops, "./db", &db);
assert(s.ok());

const std::string key = "mykey";

s = db->Put(rocksdb::WriteOptions(), key, "myvalue");
assert(s.ok());

// flush so we can use the row cache, not memtable
s = db->Flush(rocksdb::FlushOptions());
assert(s.ok());
std::string value;
s = db->Get(rocksdb::ReadOptions(), key, &value);
assert(s.ok());

s = db->DeleteRange(rocksdb::WriteOptions(), db->DefaultColumnFamily(), "a", "z");
assert(s.ok());

value.clear();
s = db->Get(rocksdb::ReadOptions(), key, &value);
// status should be NotFound, but the program's output is an OK
std::cout << "status: " << s.ToString() << ", value: " << value << std::endl;

return 0;
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.