Skip to content

Commit

Permalink
Fix BlobDB::Get which only get out the value offset
Browse files Browse the repository at this point in the history
Blob db use StackableDB::get which only get out the
value offset, but not the value.
Fix by making BlobDB::Get override the designated getter.
  • Loading branch information
foolenough committed Jul 12, 2017
1 parent f2af4f7 commit 14ad364
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion utilities/blob_db/blob_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class BlobDB : public StackableDB {
using rocksdb::StackableDB::Get;
virtual Status Get(const ReadOptions& options,
ColumnFamilyHandle* column_family, const Slice& key,
std::string* value) override = 0;
PinnableSlice* value) override = 0;

using rocksdb::StackableDB::MultiGet;
virtual std::vector<Status> MultiGet(
Expand Down
5 changes: 3 additions & 2 deletions utilities/blob_db/blob_db_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ Status BlobDBImpl::CommonGet(const ColumnFamilyData* cfd, const Slice& key,

Status BlobDBImpl::Get(const ReadOptions& options,
ColumnFamilyHandle* column_family, const Slice& key,
std::string* value) {
PinnableSlice* value) {
auto cfh = reinterpret_cast<ColumnFamilyHandleImpl*>(column_family);
auto cfd = cfh->cfd();

Expand All @@ -1341,7 +1341,8 @@ Status BlobDBImpl::Get(const ReadOptions& options,
return s;
}

s = CommonGet(cfd, key, index_entry, value);
s = CommonGet(cfd, key, index_entry, value->GetSelf());
value->PinSelf();
return s;
}

Expand Down
2 changes: 1 addition & 1 deletion utilities/blob_db/blob_db_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class BlobDBImpl : public BlobDB {

using rocksdb::StackableDB::Get;
Status Get(const ReadOptions& options, ColumnFamilyHandle* column_family,
const Slice& key, std::string* value) override;
const Slice& key, PinnableSlice* value) override;

using rocksdb::StackableDB::NewIterator;
virtual Iterator* NewIterator(const ReadOptions& opts,
Expand Down

0 comments on commit 14ad364

Please sign in to comment.