mapleFU commented on code in PR #1888:
URL: https://github.com/apache/kvrocks/pull/1888#discussion_r1403904017


##########
src/types/redis_bloom_chain.cc:
##########
@@ -190,17 +192,22 @@ rocksdb::Status BloomChain::InsertCommon(const Slice 
&user_key, const std::vecto
     } else {
       if (metadata.size + 1 > metadata.GetCapacity()) {
         if (metadata.IsScaling()) {
-          batch->Put(bf_key_list.back(), bf_data_list.back());
+          batch->Put(bf_key_list.back(), bf_data_list.back().ToStringView());
           std::string bf_data;
           createBloomFilterInBatch(ns_key, &metadata, batch, &bf_data);
-          bf_data_list.push_back(std::move(bf_data));
+          rocksdb::PinnableSlice pin_slice;
+          pin_slice.PinSelf(rocksdb::Slice(bf_data));

Review Comment:
   (This trick is used in `PinnableWideColumns::MoveValue` )
   
   ```
   inline void PinnableWideColumns::MoveValue(std::string&& value) {
     std::string* const buf = value_.GetSelf();
     assert(buf);
   
     *buf = std::move(value);
     value_.PinSelf();
   }
   ```



-- 
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]

Reply via email to