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


##########
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:
   Hmmm this part the logic is:
   
   ```
   get bf_data ( a string ) in createBloomFilterInBatch
   pin_slice.Pin(bf_data), which will clone the bf_data
   ```
   
   Would you mind try:
   
   ```
   *pin_slice.GetSelf() = std::move(bf_data);
   ```
   
   I think it might be better than `PinSelf` to avoid a round of copying?



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