Skip to content

RedisCluster scan_iter does not return all keys from all nodes #2003

@felixwang9817

Description

@felixwang9817

Version: What redis-py and what redis version is the issue happening on?

redis-py==4.1.2 and redis-cli 6.2.6

Platform: What platform / version? (For example Python 3.5.1 on Windows 7 / Ubuntu 15.10 / Azure)

Python 3.7.12 on MacOS 11.4

Description: I started a local Redis cluster with 6 nodes (3 master nodes with ports 6001-6003, 3 slave nodes with ports 6004-6006). I wrote 19 total items to the Redis cluster: 1 is stored by 6001, 13 by 6002, and 5 by 6003. I confirmed this by doing

$ redis-cli -c -p 6001           
127.0.0.1:6001> KEYS *
1) "\x02\x00\x00\x00\x04\x00\x00\x00\x04\x00\x00\x00\x8b\x13\x00\x00integration_test_5d7072_1"
127.0.0.1:6001>

for each of the 3 master nodes.

However, when I call client.scan_iter(b"*"), I get a list containing only a single key, which is the key from node 6001. Here my client object was constructed as follows:

startup_nodes = [{'host': '127.0.0.1', 'port': '6001'}, {'host': '127.0.0.1', 'port': '6002'}, {'host': '127.0.0.1', 'port': '6003'}]
kwargs["startup_nodes"] = [
    ClusterNode(**node) for node in startup_nodes
]
self._client = RedisCluster(**kwargs)

This looks to me like there is an issue with scan_iter on RedisClusters, where it doesn't return all keys from all nodes.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions