Redis: redis doc recommends using the SCAN command instead of the KEYS command.
- Dominant language
- Python
- Stars
- 5.3k
- Forks
- 383
- Avg merge
- 9h 41m
- Merged PRs (30d)
- 2
Description
There is this note on page https://master--redis-doc.netlify.app/commands/keys/
```
Warning: consider `KEYS` as a command that should only be used in production environments with extreme care. It may ruin performance when it is executed against large databases.
```
I think to use `SCAN` command better.
Command `KEYS` is used in *.lua scripts. In this place:
```lua
-- If there are no more ack groups for this worker, then
-- remove it from the heartbeats set.
local ack_queues = redis.call("keys", dead_worker_acks .. "*")
if not next(ack_queues) then
redis.call("zrem", heartbeats, dead_worker)
end
```
And there is also a problem with lua-scripts if you use Redis-Cluster and pass [RedisCluster](https://redis.readthedocs.io/en/stable/clustering.html#creating-clusters) as broker, there will error, because RedisCluster doesn't support scripts.
Contributor guide
Research direction
Start by locating the Lua script containing redis.call("keys", dead_worker_acks .. "*") and review the Redis KEYS and SCAN documentation linked in the issue. Also investigate the described RedisCluster limitation for scripts. Done should address the affected broker behavior and verify the relevant Redis execution path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, python, redis
- Domain
- backend, databases, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100