kvrocks
kvrocks copied to clipboard
Optimize the implementation of command RANDOMKEY
Search before asking
- [X] I had searched in the issues and found no similar issues.
Motivation
Currently the result key of command RANDOMKEY is not randomized enough, so we'd better do some research and optimize it.
Solution
No response
Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
I'll try this.
@Yangsx-1 Assigned.
Can we add a random_scan function? This function will select the key at random intervals during the scan, after scan we can randomly select keys from the scan result. This may be more random. @PragmaTwice @git-hulk @torwig
Could you give more detailed design of it? I cannot get your point well.
Besides, I think one possible way is to add more random cursors, and select one of them each time.
Could you give more detailed design of it? I cannot get your point well.
Besides, I think one possible way is to add more random cursors, and select one of them each time.
Oh, i mean, we can add a random interval in the iteration of scaning.
For example, the scan result may be 1 2 3 4 5 6 now, after add a random interval, the result may be 1 3 6 9 10 12 rather than pure sequential scanning. And we can select a key from the result of random scan.