redis-py icon indicating copy to clipboard operation
redis-py copied to clipboard

cluster - scan do not respect require_full_coverage at false

Open raphaelauv opened this issue 1 year ago • 2 comments

Version: 5.1.1

Platform: python 3.11

Description:

when I run a scan ( with scan_iter helper ) on a redis cluster with require_full_coverage at false

and a node is missing then the scan command fail

  File "/home/raphael/REPO/xx/src/redis_clean.py", line 27, in main
    keys_to_delete = [x for x in r_client.scan_iter(match_regex, 100)]
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/raphael/REPO/xx/src/redis_clean.py", line 27, in <listcomp>
    keys_to_delete = [x for x in r_client.scan_iter(match_regex, 100)]
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/raphael/REPO/xx/venv/lib/python3.11/site-packages/redis/commands/cluster.py", line 793, in scan_iter
    cursors, data = self.scan(match=match, count=count, _type=_type, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/raphael/REPO/xx/venv/lib/python3.11/site-packages/redis/commands/core.py", line 3017, in scan
    return self.execute_command("SCAN", *pieces, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/raphael/REPO/xx/venv/lib/python3.11/site-packages/redis/cluster.py", line 1115, in execute_command
    raise e
  File "/home/raphael/REPO/xx/venv/lib/python3.11/site-packages/redis/cluster.py", line 1101, in execute_command
    res[node.name] = self._execute_command(node, *args, **kwargs)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/raphael/REPO/xx/venv/lib/python3.11/site-packages/redis/cluster.py", line 1174, in _execute_command
    raise e
  File "/home/raphael/REPO/xx/venv/lib/python3.11/site-packages/redis/cluster.py", line 1144, in _execute_command
    connection = get_connection(redis_node, *args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/raphael/REPO/xx/venv/lib/python3.11/site-packages/redis/cluster.py", line 51, in get_connection
    return redis_node.connection or redis_node.connection_pool.get_connection(
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/raphael/REPO/xx/venv/lib/python3.11/site-packages/redis/connection.py", line 1074, in get_connection
    connection.connect()
  File "/home/raphael/REPO/xx/venv/lib/python3.11/site-packages/redis/connection.py", line 283, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 113 connecting to 172.20.0.4:6379. No route to host.

I would expect the command to run in best effort on available nodes.

raphaelauv avatar Oct 11 '24 15:10 raphaelauv

This issue has been automatically marked as stale due to inactivity. It will be closed in 30 days if no further activity occurs. If you believe this issue is still relevant, please add a comment to keep it open.

github-actions[bot] avatar Oct 12 '25 00:10 github-actions[bot]

No stale

raphaelauv avatar Oct 12 '25 08:10 raphaelauv