mapleFU commented on code in PR #1888:
URL: https://github.com/apache/kvrocks/pull/1888#discussion_r1396667583
##########
src/types/redis_bloom_chain.cc:
##########
@@ -51,11 +51,13 @@ rocksdb::Status BloomChain::getBFDataList(const
std::vector<std::string> &bf_key
read_options.snapshot = ss.GetSnapShot();
bf_data_list->reserve(bf_key_list.size());
- for (const auto &bf_key : bf_key_list) {
- std::string bf_data;
- rocksdb::Status s = storage_->Get(read_options, bf_key, &bf_data);
+ rocksdb::PinnableSlice pin_value;
+ for (int i = 0; i < bf_key_list.size(); ++i) {
+ auto &bf_key = bf_key_list[i];
+ rocksdb::Status s = storage_->Get(read_options,
storage_->GetDB()->DefaultColumnFamily(), bf_key, &pin_value);
if (!s.ok()) return s;
- bf_data_list->push_back(std::move(bf_data));
+ bf_data_list->emplace_back(pin_value.ToString());
+ pin_value.Reset();
Review Comment:
Yes and no, changing `std::vector<std::string>` to `std::vector<Slice>`
might suffer from lifetime problem, we need to change it to
`std::vector<PinnableSlice>`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]