You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A lot of the calls that I perform to redis are to the JSON redis module, and so I need to use the custom redis.call() function. e.g. client.call('JSON.SET', 'some_key', '$', ...).
However, I noticed that I got the following error rather sporadically:
ReplyError: MOVED 6734 10.16.0.3:31002
at new Promise (<anonymous>)
at executeWithAutoPipelining(...)
...
I ended up figuring out why this happens:
It seems like when autoPipeline=true and ALL commands sent in the pipeline are custom commands (i.e. only commands sent via client.call(...), the commands are sent to a random node instead.
This is because when the pipelineSlotis calculated based on the keys, it has no keys to reference, as everything is considered as args. This results in a random pipeline slot being chosen. Which is often wrong, so it causes the pipeline to fail.
If there is a single native command though (for example redis.set()), then it is able to determine which node to send it to correctly, and everything works fine. Also, if i set autoPipeline=false, then I get zero move errors. These two observations were made as I was debugging the library code.
It seems like it would need a better way to determine which node to send it to. Either allowing to specify the number of keys with client.call() or a some sort of heuristic that inspects the first arg and assumes that is the key (like it is done elsewhere in the code).
The text was updated successfully, but these errors were encountered:
jjsimps
changed the title
Error when autoPipeline=true and all commands are custom
MOVE errors when autoPipeline=true and all commands are custom
May 3, 2024
A lot of the calls that I perform to redis are to the JSON redis module, and so I need to use the custom
redis.call()
function. e.g.client.call('JSON.SET', 'some_key', '$', ...)
.However, I noticed that I got the following error rather sporadically:
I ended up figuring out why this happens:
It seems like when
autoPipeline=true
and ALL commands sent in the pipeline are custom commands (i.e. only commands sent viaclient.call(...)
, the commands are sent to a random node instead.This is because when the
pipelineSlot
is calculated based on the keys, it has no keys to reference, as everything is considered asargs
. This results in a random pipeline slot being chosen. Which is often wrong, so it causes the pipeline to fail.If there is a single native command though (for example
redis.set()
), then it is able to determine which node to send it to correctly, and everything works fine. Also, if i setautoPipeline=false
, then I get zero move errors. These two observations were made as I was debugging the library code.It seems like it would need a better way to determine which node to send it to. Either allowing to specify the number of keys with
client.call()
or a some sort of heuristic that inspects the first arg and assumes that is the key (like it is done elsewhere in the code).The text was updated successfully, but these errors were encountered: