facebook / facebook/rocksdb

Support using user-defined timestamps in combination with BlobDB

Open
#9,818 3 comments 0 reactions 1 assignee Claimed by @jowlyzhang View on GitHub
enhancement
Dominant language
C++
Stars
32.1k
Forks
6.9k
Avg merge
32m
Merged PRs (30d)
1

Description

> Note: Please use Issues only for bug reports. For questions, discussions, feature requests, etc. post to dev group: https://groups.google.com/forum/#!forum/rocksdb or https://www.facebook.com/groups/rocksdb.dev

### Expected behavior

db->Get(...) should return status OK

### Actual behavior

db->Get(...) returns a corruption error ```Status::Corruption("Key mismatch when reading blob")```

### Steps to reproduce the behavior

use the timestamp feature
use the blobdb feature

perform a Get, whereby the get is a MEMTABLE_MISS

The following callstack causes the issue:

```
rocksdb::BlobFileReader::VerifyBlob(...)
rocksdb::BlobFileReader::GetBlob(...)
rocksdb::Version::GetBlob(...)
rocksdb::Version::GetBlob(...)
rocksdb::Version::Get(...)
rocksdb::DBImpl::GetImpl(...)
rocksdb::DBImpl::Get(...)
```

Within the ```BlobFileReader::VerifyBlob``` function:

```
Status BlobFileReader::VerifyBlob(const Slice& record_slice,
const Slice& user_key, uint64_t value_size) {

... blah
... blah
if (record.key != user_key) {
return Status::Corruption("Key mismatch when reading blob");
}
... blah
... blah
}
```

Looking at the memory of the two keys I get (NOTE: i put a | where the timestamp part starts):

user_key
```
0c 00 00 00 00 00 00 01 62 4e c0 35 | ff ff ff ff ff ff ff ff
```

record.key
```
0c 00 00 00 00 00 00 01 62 4e c0 35 | 00 00 00 00 62 4e c0 46
```

`ff ff ff ff ff ff ff ff` is the timestamp upper range given in the Get ReadOptions, and `0c 00 00 00 00 00 00 01 62 4e c0 35` is the user key given in the Get call

Looking a bit further back in the callstack, I can see that the correct timestamp is already available:

```
Status DBImpl::Get(const ReadOptions& read_options,
ColumnFamilyHandle* column_family, const Slice& key,
PinnableSlice* value, std::string* timestamp) {
GetImplOptions get_impl_options;
get_impl_options.column_family = column_family;
get_impl_options.value = value;
get_impl_options.timestamp = timestamp;
Status s = GetImpl(read_options, key, get_impl_options);
return s;
}
```
`get_impl_options.timestamp = timestamp;` has a value of -> `00 00 00 00 62 4e c0 46`

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.