Describe the bug
If you perform an SSCAN and get a cursor, then remove items from the set, then do another SSCAN using the previously returned cursor you can get incorrect results. It looks like this is because the returned cursor is simply the position in the set for the last entry returned, so if the size of the set changes it refers to the wrong position.
Steps to reproduce the bug
- Create a set with 2 entries:
SADD test-set entry-a entry-b
- Perform an SSCAN:
SSCAN test-set 0 COUNT 1 - this returns cursor 1
- Remove the first entry:
SREM test-set entry-a
- Perform another SSCAN using the previously returned cursor:
SSCAN test-set 1 COUNT 1 - this returns no results instead of the expected entry-b
Expected behavior
Using the cursor returned before the set was modified should return the remaining set entries - this is the behaviour in other Redis-like datastores.
Screenshots
No response
Release version
No response
IDE
No response
OS version
No response
Additional context
No response