Genuineh opened a new pull request, #3024:
URL: https://github.com/apache/kvrocks/pull/3024

   Fix: [3023](https://github.com/apache/kvrocks/issues/3023)
    
   Since there are no comments or related tests, I don't know what this old 
code does, but it seems to be for acceleration. However, it appears that when 
the key is not found and the HASH_SLOTS_MAX_ITERATIONS limit is triggered, this 
might cause some keys not to be scanned, leading to the 3023 bug.
   
   ```cpp
       if (slot_id > slot_start + HASH_SLOTS_MAX_ITERATIONS) {
         if (keys->empty()) {
           if (iter->Valid()) {
             std::tie(std::ignore, user_key) = 
ExtractNamespaceKey<std::string>(iter->key(), storage_->IsSlotIdEncoded());
             auto res = std::mismatch(prefix.begin(), prefix.end(), 
user_key.begin());
             if (res.first == prefix.end() && util::StringMatch(suffix_glob, 
user_key.substr(prefix.size()))) {
               keys->emplace_back(user_key);
             }
   
             end_cursor->append(user_key);
           }
         } else {
           end_cursor->append(user_key);
         }
   ```
   The main modifications are the addition of tests and changes to redis_db.cc, 
while others are caused by `./x.py format` or test packages change.
   
   For the testing, I copied most of the previous scan tests, created a file to 
retest under the condition of a (2*master-slave) cluster, and added the use of 
the go-redis clusterclient and its related code.
   
   ### Additional Questions
   1.In Go tests, it may be possible to use the `UniversalClient` to unify the 
clients for both cluster and single-node modes.
   2.In the use cases other than replication, it seems that testing under the 
cluster scheme has not been attempted, which may pose risks. The implementation 
of some commands like scan may be related to the cluster to a certain extent.
   
   
   @git-hulk Please review the code, 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