Closed shivaraj-bh closed 1 year ago
Ok, seems I've got the case where we have a problem:
hedis ignores symbol {
even it does not have a matching one:
ghci> keyToSlot "{\155\247\234j\171\230\210>K"
HashSlot 8700
ghci> keyToSlot "\155\247\234j\171\230\210>K"
HashSlot 8700
While in redis:
127.0.0.1:52922> EVAL "local x = redis.pcall('cluster', 'keyslot', '\x7b\x9b\xf7\xea\x6a\xab\xe6\xd2\x3e\x4b')\nreturn x" 0
(integer) 1529
127.0.0.1:52922> EVAL "local x = redis.pcall('cluster', 'keyslot', '\x9b\xf7\xea\x6a\xab\xe6\xd2\x3e\x4b')\nreturn x" 0
(integer) 8700
Seems there is a bug in condition in keyToSlot that I'll try to fix
Thanks again for the report!
The issue is fixed feel free to check if it works for you
There are few API breakers comming around to it's theoretically possible to port the fix onto the latest 0.15 release. Please ping me if it's required for your use case.
Thanks for the quick response and fix!
In certain scenarios, the output of
keyToSlot
does not align with Redis' perception of the hash value for a given key. For instance, consider the bytestring"{\155\247\234j\171\230\210>K"
. According tokeyToSlot
, the output isHashSlot 8700
, which, in my situation, corresponds to master node 2. However, when attempting to execute the set command on that node, it fails with aMOVED
response. Redis identifies this key as belonging to master node 1. This issue appears to arise specifically when working with special characters in a bytestring.