You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "mapleFU (via GitHub)" <gi...@apache.org> on 2024/03/09 17:38:01 UTC
[PR] Trying to use mget in SADD [kvrocks]
mapleFU opened a new pull request, #2146:
URL: https://github.com/apache/kvrocks/pull/2146
(no comment)
--
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
Re: [PR] Trying to use mget in SADD [kvrocks]
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #2146:
URL: https://github.com/apache/kvrocks/pull/2146#discussion_r1518651288
##########
src/types/redis_set.cc:
##########
@@ -68,14 +68,30 @@ rocksdb::Status Set::Add(const Slice &user_key, const std::vector<Slice> &member
WriteBatchLogData log_data(kRedisSet);
batch->PutLogData(log_data.Encode());
std::unordered_set<std::string_view> mset;
+ std::vector<std::string_view> set_member;
+ std::vector<std::string> set_subkeys;
+ std::vector<Slice> set_subkeys_slice;
for (const auto &member : members) {
if (!mset.insert(member.ToStringView()).second) {
continue;
}
std::string sub_key = InternalKey(ns_key, member, metadata.version, storage_->IsSlotIdEncoded()).Encode();
- s = storage_->Get(rocksdb::ReadOptions(), sub_key, &value);
- if (s.ok()) continue;
- batch->Put(sub_key, Slice());
+ set_member.push_back(member.ToStringView());
+ set_subkeys.push_back(std::move(sub_key));
+ set_subkeys_slice.emplace_back(set_subkeys.back());
+ }
+ std::vector<rocksdb::PinnableSlice> dummy_values(set_subkeys_slice.size());
+ std::vector<rocksdb::Status> mget_status(set_subkeys_slice.size());
+ storage_->MultiGet(storage_->DefaultMultiGetOptions(), metadata_cf_handle_, set_subkeys.size(),
+ set_subkeys_slice.data(), dummy_values.data(), mget_status.data());
+ dummy_values.clear();
+ set_subkeys_slice.clear();
+ set_subkeys.clear();
+ for (size_t idx = 0; idx < mget_status.size(); ++idx) {
+ const rocksdb::Status &status = mget_status[idx];
+ if (!status.ok() && !s.IsNotFound()) return status;
+ if (status.IsNotFound()) continue;
Review Comment:
```suggestion
if (status.ok()) continue;
```
--
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
Re: [PR] Trying to use mget in SADD [kvrocks]
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #2146:
URL: https://github.com/apache/kvrocks/pull/2146#issuecomment-1987109190
The performance didn't change in this patch, will close firstly
--
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
Re: [PR] Trying to use mget in SADD [kvrocks]
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU closed pull request #2146: Trying to use mget in SADD
URL: https://github.com/apache/kvrocks/pull/2146
--
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