enjoy-binbin commented on code in PR #1712:
URL: https://github.com/apache/kvrocks/pull/1712#discussion_r1314411327


##########
src/storage/redis_db.cc:
##########
@@ -121,6 +121,39 @@ rocksdb::Status Database::Del(const Slice &user_key) {
   return storage_->Delete(storage_->DefaultWriteOptions(), 
metadata_cf_handle_, ns_key);
 }
 
+rocksdb::Status Database::MDel(const std::vector<Slice> &keys, uint64_t 
*deleted_cnt) {
+  *deleted_cnt = 0;
+
+  std::vector<std::string> lock_keys;
+  lock_keys.reserve(keys.size());
+  for (const auto &key : keys) {
+    std::string ns_key = AppendNamespacePrefix(key);
+    lock_keys.emplace_back(std::move(ns_key));
+  }
+  MultiLockGuard guard(storage_->GetLockManager(), lock_keys);
+
+  auto batch = storage_->GetWriteBatchBase();
+  WriteBatchLogData log_data(kRedisNone);
+  batch->PutLogData(log_data.Encode());
+
+  for (const auto &ns_key : lock_keys) {
+    std::string value;
+    rocksdb::Status s = storage_->Get(rocksdb::ReadOptions(), 
metadata_cf_handle_, ns_key, &value);

Review Comment:
   look like a good idea, i take a shot, not sure i wrote it right, please take 
a look, thanks.



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