facebook / facebook/rocksdb

Get with kBlockCacheTier return Status::OK() when block cache is disabled

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

Description

When opening a database with `no_block_cache = true`, trying to read with `read_tier = kBlockCacheTier` should return `Status::Incomplete()`. However, the return value is `Status::OK()` and the value is empty.

### Expected behavior

The `Get()` call should return `Status::Incomplete()`.

### Actual behavior

The call returns with `Status::OK()` and an empty value.

### Steps to reproduce the behavior

```c++
#include
#include
#include
#include

using namespace rocksdb;

int main(int argc, char const *argv[])
{
BlockBasedTableOptions table_options;
table_options.no_block_cache = true;
Options options;
options.create_if_missing = true;
options.table_factory.reset(NewBlockBasedTableFactory(table_options));

DB* db = nullptr;
Status s = DB::Open(options, "./cache_tier_db", &db);
assert(s.ok());

const std::string key = "key";
const std::string value = "value";

assert(db->Put(WriteOptions(), key, value).ok());

assert(db->Flush(FlushOptions()).ok());

{
PinnableSlice result;
assert(db->Get(ReadOptions(), db->DefaultColumnFamily(), key, &result).ok());
assert(result == value);
}

// Disallow I/O
ReadOptions read_options;
read_options.read_tier = kBlockCacheTier;

PinnableSlice result;
s = db->Get(read_options, db->DefaultColumnFamily(), key, &result);
assert(result.empty());
assert(s.IsIncomplete());

delete db;

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.