You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "PragmaTwice (via GitHub)" <gi...@apache.org> on 2025/09/20 14:49:34 UTC

Re: [PR] fix: Optimize performance of command MDel [kvrocks]

PragmaTwice commented on code in PR #3195:
URL: https://github.com/apache/kvrocks/pull/3195#discussion_r2365663051


##########
src/storage/redis_db.cc:
##########
@@ -183,17 +183,15 @@ rocksdb::Status Database::MDel(engine::Context &ctx, const std::vector<Slice> &k
 
   std::vector<rocksdb::Status> statuses(slice_keys.size());
   std::vector<rocksdb::PinnableSlice> pin_values(slice_keys.size());
-  storage_->MultiGet(ctx, ctx.GetReadOptions(), metadata_cf_handle_, slice_keys.size(), slice_keys.data(),
+  storage_->MultiGet(ctx, ctx.DefaultMultiGetOptions(), metadata_cf_handle_, slice_keys.size(), slice_keys.data(),
                      pin_values.data(), statuses.data());
 
   for (size_t i = 0; i < slice_keys.size(); i++) {
     if (!statuses[i].ok() && !statuses[i].IsNotFound()) return statuses[i];
     if (statuses[i].IsNotFound()) continue;
 
     Metadata metadata(kRedisNone, false);
-    // Explicit construct a rocksdb::Slice to avoid the implicit conversion from
-    // PinnableSlice to Slice.
-    auto s = metadata.Decode(rocksdb::Slice(pin_values[i].data(), pin_values[i].size()));
+    auto s = metadata.Decode(pin_values[i]);

Review Comment:
   What's the meaning?
   
   > Pass PinnableSlice directly instead of make copy before passed by value when calling Metadata::Decode
   
   I don't think this is a copy. IMHO it's just a slice/view. cc @mapleFU  



-- 
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: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org