You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "git-hulk (via GitHub)" <gi...@apache.org> on 2023/10/19 13:21:11 UTC

Re: [I] Prefix scan didn't work well when enabling the cluster mode [kvrocks]

git-hulk commented on issue #1836:
URL: https://github.com/apache/kvrocks/issues/1836#issuecomment-1770978229

   @EasyProgramming It's a limitation in the scan command when enabling the cluster mode. It'll only look forward N(50) slots when scanning keys, for example:
   
   If we have keys: `aaaa`(slot 0), `bbbb`(slot 10), `cccc`(slot 100), `dddd`(slot 200) and we scan with:
   
   ```
   SCAN "0" MATCH "bb*"
   ```
   it works well since `bbbb` is located at slot 10, and Kvrocks try to look forward next 50 slots. But if you scan with `cc*`:
   
   ```
   SCAN "0" MATCH "cc*"
   ```
   it will return empty array with cursor(`_bbbb`) since `cccc` is located at slot 100.
   
   For the implementation, please refer: https://github.com/apache/kvrocks/blob/unstable/src/storage/redis_db.cc#L365
   
   
   Of course, for this limitation will make the scan command very hard to use. We will try our best to improve this if possible. cc @tisonkun 


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