git-hulk commented on PR #1712:
URL: https://github.com/apache/kvrocks/pull/1712#issuecomment-1702280321

   > > > Is it possible to lock the dst key only and use the read snapshot like 
SDIFFSTORE/SINTERSTORE?
   > > 
   > > 
   > > @git-hulk can you describe this a bit more? (for example posting a 
pseudo code)
   > 
   > Sure. For now, SDIFFSTORE is implemented in two steps:
   > 
   > * The first step is to calculated the diff result without locking source 
keys
   > * Then overwrite the dst key with locking the dst key
   
   
   
   > actually now we will lock the source keys. it was added in #1700, maybe we 
should remove the source keys locks?
   > 
   > ```
   > rocksdb::Status Set::Diff(const std::vector<Slice> &keys, 
std::vector<std::string> *members) {
   >   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);
   > ```
   > 
   > edit: ohh, i think i got your point. maybe we should split InterStore to 
two function, one do the inter and the other one do the store, just like the 
Set apis. I wanted to do it (adding a ZINTER command) before, but because we 
already had a pending #1517
   
   Great, thank you!


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