1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-29 17:41:15 +03:00

14 Commits

Author SHA1 Message Date
4ac591c7c4 Set correct cluster slot for scan commands, similarly to Java's Jedis client (#2623)
- At present, the `scan` command is dispatched to a random slot.
- As far as I can tell, the scanX family of commands are not cluster aware (e.g. don't redirect the client to the correct slot).
- You can see [here](869dc0bb66/src/main/java/redis/clients/jedis/ShardedCommandObjects.java (L101)), the Jedis client calling `processKey` on the match argument, and this is what this PR also does.

We've had this patch running in production, and it seems to work well for us.

For further thought:
- Continuing looking at other Redis clients (e.g. Jedis), they outright [reject as invalid](869dc0bb66/src/main/java/redis/clients/jedis/ShardedCommandObjects.java (L98)) any scan command that does not include a hash-tag. Presumably this has the advantage of users not being surprised when their scan produces no results when a random server is picked.
- Perhaps it would be sensible for go-redis to do the same also?

Co-authored-by: Nedyalko Dyakov <1547186+ndyakov@users.noreply.github.com>
2025-06-24 13:43:03 +03:00
7fa451c740 chore: fewer test dependencies 2023-01-27 15:01:50 +00:00
97b491aace chore: update import path 2023-01-23 08:48:54 +02:00
a18fad5bd3 chore: v9 2022-06-04 17:42:06 +03:00
9b6ee9c3cc chore: gofmt all code 2021-09-08 16:52:29 +03:00
26373ef2f1 follow to golang-lint 1.40
Signed-off-by: monkey <golang@88.com>
2021-05-13 10:33:38 +08:00
3fc96195a4 Reduce dependency chain 2020-09-17 14:32:08 +01:00
14c843ef89 gofumports 2020-07-16 09:52:07 +03:00
64995f9a51 Tweak auto-reloads 2020-06-29 17:51:47 +03:00
0ffefcde98 Use random node to load cluster slots 2020-06-29 17:26:11 +03:00
2559f32464 cluster: optimize newClusterState 2018-07-22 14:17:42 +03:00
3de5605ab2 Pick random node when command does not have keys 2017-12-28 16:47:08 +02:00
7cbee9d337 Enable reaper on ClusterClient and add tests. 2016-10-02 12:44:01 +00:00
0bf3759a6d Create hashtag package. 2015-12-31 16:25:20 +02:00