Skip to content

SSCAN returns incorrect results if items are removed from the set between executions #1409

@daniel-wise-ansys

Description

@daniel-wise-ansys

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

  1. Create a set with 2 entries: SADD test-set entry-a entry-b
  2. Perform an SSCAN: SSCAN test-set 0 COUNT 1 - this returns cursor 1
  3. Remove the first entry: SREM test-set entry-a
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions