mirror of
https://github.com/ceph/ceph
synced 2025-01-19 17:41:39 +00:00
Merge pull request #15058 from yuyuyu101/wip-rocksdb-opt
kv/rocksdb: supports SliceParts interface Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
commit
d79c7723eb
@ -34,6 +34,17 @@ using std::string;
|
||||
#undef dout_prefix
|
||||
#define dout_prefix *_dout << "rocksdb: "
|
||||
|
||||
static rocksdb::SliceParts prepare_sliceparts(const bufferlist &bl, rocksdb::Slice *slices)
|
||||
{
|
||||
unsigned n = 0;
|
||||
for (std::list<buffer::ptr>::const_iterator p = bl.buffers().begin();
|
||||
p != bl.buffers().end(); ++p, ++n) {
|
||||
slices[n].data_ = p->c_str();
|
||||
slices[n].size_ = p->length();
|
||||
}
|
||||
return rocksdb::SliceParts(slices, n);
|
||||
}
|
||||
|
||||
//
|
||||
// One of these per rocksdb instance, implements the merge operator prefix stuff
|
||||
//
|
||||
@ -561,10 +572,10 @@ void RocksDBStore::RocksDBTransactionImpl::set(
|
||||
rocksdb::Slice(to_set_bl.buffers().front().c_str(),
|
||||
to_set_bl.length()));
|
||||
} else {
|
||||
// make a copy
|
||||
bufferlist val = to_set_bl;
|
||||
bat.Put(rocksdb::Slice(key),
|
||||
rocksdb::Slice(val.c_str(), val.length()));
|
||||
rocksdb::Slice key_slice(key);
|
||||
rocksdb::Slice value_slices[to_set_bl.buffers().size()];
|
||||
bat.Put(nullptr, rocksdb::SliceParts(&key_slice, 1),
|
||||
prepare_sliceparts(to_set_bl, value_slices));
|
||||
}
|
||||
}
|
||||
|
||||
@ -582,10 +593,10 @@ void RocksDBStore::RocksDBTransactionImpl::set(
|
||||
rocksdb::Slice(to_set_bl.buffers().front().c_str(),
|
||||
to_set_bl.length()));
|
||||
} else {
|
||||
// make a copy
|
||||
bufferlist val = to_set_bl;
|
||||
bat.Put(rocksdb::Slice(key),
|
||||
rocksdb::Slice(val.c_str(), val.length()));
|
||||
rocksdb::Slice key_slice(key);
|
||||
rocksdb::Slice value_slices[to_set_bl.buffers().size()];
|
||||
bat.Put(nullptr, rocksdb::SliceParts(&key_slice, 1),
|
||||
prepare_sliceparts(to_set_bl, value_slices));
|
||||
}
|
||||
}
|
||||
|
||||
@ -653,9 +664,10 @@ void RocksDBStore::RocksDBTransactionImpl::merge(
|
||||
to_set_bl.length()));
|
||||
} else {
|
||||
// make a copy
|
||||
bufferlist val = to_set_bl;
|
||||
bat.Merge(rocksdb::Slice(key),
|
||||
rocksdb::Slice(val.c_str(), val.length()));
|
||||
rocksdb::Slice key_slice(key);
|
||||
rocksdb::Slice value_slices[to_set_bl.buffers().size()];
|
||||
bat.Merge(nullptr, rocksdb::SliceParts(&key_slice, 1),
|
||||
prepare_sliceparts(to_set_bl, value_slices));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,16 +97,6 @@ class BlueRocksRandomAccessFile : public rocksdb::RandomAccessFile {
|
||||
return rocksdb::Status::OK();
|
||||
}
|
||||
|
||||
// Used by the file_reader_writer to decide if the ReadAhead wrapper
|
||||
// should simply forward the call and do not enact buffering or locking.
|
||||
bool ShouldForwardRawRequest() const override {
|
||||
return false;
|
||||
}
|
||||
|
||||
// For cases when read-ahead is implemented in the platform dependent
|
||||
// layer
|
||||
void EnableReadAhead() override {}
|
||||
|
||||
// Tries to get an unique ID for this file that will be the same each time
|
||||
// the file is opened (and will stay the same while the file is open).
|
||||
// Furthermore, it tries to make this ID at most "max_size" bytes. If such an
|
||||
|
Loading…
Reference in New Issue
Block a user