Open fmeneghetti opened 5 months ago
All commands that are not read-only are routed to master nodes already, so that is not an issue.
I noticed a while ago that we transparently handle ASKED
redirections, but propagate MOVED
redirections as errors. I don't know why we do that, the Redis cluster design assumes that clients handle MOVED
redirections as well. That is an issue we have, I believe.
I think there is a problem with the "xreadGroup" command because it is recognized as "readOnly" and therefore is also sent to the replication nodes.
Command XREADGROUP = new CommandImpl("xreadgroup", -7, false, false, false, new KeyLocator(true, new BeginSearchKeyword("STREAMS", 4), new FindKeysRange(-1, 1, 2)));
The first param is Boolean readOnly
You might want to debug CommandImpl.isReadOnly()
, which determines if the command is actually treated as read-only, based on argument values first.
I did it:
15:58:46.761 [vert.x-eventloop-thread-2] INFO i.m.s.v.tst.pri.TstDeployerVerticle - XREADGROUP GROUP mgg.signal.workers mgg.signal.worker:1 COUNT 1 BLOCK 1000 STREAMS stream:message > 15:58:46.761 [vert.x-eventloop-thread-2] INFO i.m.s.v.tst.pri.TstDeployerVerticle - command=xreadgroup 15:58:46.761 [vert.x-eventloop-thread-2] INFO i.v.r.c.impl.RedisClusterConnection - [redis]keySlot=1163 15:58:46.761 [vert.x-eventloop-thread-2] INFO i.v.r.c.impl.RedisClusterConnection - [redis]readOnly=true 15:58:46.761 [vert.x-eventloop-thread-2] INFO i.v.r.c.impl.RedisClusterConnection - [redis]endpoints=[redis://172.26.0.101:7001, redis://172.26.0.105:7005] 15:58:46.761 [vert.x-eventloop-thread-2] INFO i.v.r.c.impl.RedisClusterConnection - [redis]endpoint=redis://172.26.0.105:7005 15:58:46.761 [vert.x-eventloop-thread-2] ERROR i.v.r.c.impl.RedisClusterConnection - [redis]MOVED 1163 172.26.0.101:7001
After changing the "ro" parameter of the KeyLocator class, I saw that things are working fine:
Command XREADGROUP = new CommandImpl("xreadgroup", -7, false, false, false, new KeyLocator(false, new BeginSearchKeyword("STREAMS", 4), new FindKeysRange(-1, 1, 2)));
16:04:49.681 [vert.x-eventloop-thread-2] INFO i.m.s.v.tst.pri.TstDeployerVerticle - XREADGROUP GROUP mgg.signal.workers mgg.signal.worker:1 COUNT 1 BLOCK 1000 STREAMS stream:message > 16:04:49.681 [vert.x-eventloop-thread-2] INFO i.m.s.v.tst.pri.TstDeployerVerticle - command=xreadgroup 16:04:49.681 [vert.x-eventloop-thread-2] INFO i.v.r.c.impl.RedisClusterConnection - [redis]keySlot=1163 16:04:49.681 [vert.x-eventloop-thread-2] INFO i.v.r.c.impl.RedisClusterConnection - [redis]readOnly=false 16:04:49.681 [vert.x-eventloop-thread-2] INFO i.v.r.c.impl.RedisClusterConnection - [redis]endpoints=[redis://172.26.0.101:7001, redis://172.26.0.105:7005] 16:04:49.681 [vert.x-eventloop-thread-2] INFO i.v.r.c.impl.RedisClusterConnection - [redis]endpoint=redis://172.26.0.101:7001
now in the log is printed correctly: "readOnly=false"
Funny. The command descriptors are automatically generated from Redis COMMAND
output (https://redis.io/commands/command/), so should be correct. Maybe we have a bug in the isReadOnly
logic, I'd have to take a proper look, I didn't have to dig into that deeply yet.
Hi @Ladicek, do you have news? Thanks.
I don't have any news, no.
I am experiencing some issues in Redis Cluster mode, particularly with the MOVED error. It is still unclear to me how to transparently handle this when the cluster is unbalanced.
I think there is a problem with the "xreadgroup" command, though, because unlike the "xread" command, which is a read command, "xreadgroup" is a write command.
In RedisReplicas.SHARE or RedisReplicas.ALWAYS mode I run into the MOVED error.
I suppose it is to treat the command as "master only":
addMasterOnlyCommand(XREADGROUP);
vertx-redis-client -> 4.5.6