-
Notifications
You must be signed in to change notification settings - Fork 694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Cluster: Inconsistent MOVED/READONLY errors for read-only client #869
Comments
Makes sense. MOVED if all cases would be better. I don't think this is a very severe bug, because clients are not expected to use READONLY with write commands. It is not clearly documented what will happen if they do. I don't think it needs to be a blocker for 8.0.0. |
In my case, it works differently. I use Valkey 8.0.1.
Is change to all cases to |
@soloestoy are you familiar with these differences? |
I think the difference is just that @proost started In interactive mode, Thus, no |
I had a look at the PR #1284 and this issue again. On a more in-depth look, I stand corrected: The reason is that Valkey issues In contrast to this, a Line 455 in e9a1fe0
This makes sense, as The problem with So, |
Isn't this error returned before the script even starts, because EVAL is a flagged as a write command? There is a readonly version of |
In "READWRITE" mode, yes. Although it will be a In "READONLY" mode, as the key's slot is handled by the replica, the script will begin to run. For example:
publishes the message and fails with |
@gmbnomis |
While it may look more consistent at first glance, the information conveyed by a "MOVED" to the client does not allow to use it in this situation: In READWRITE mode, Valkey can determine if the EVAL command should be executed on the current node or redirected before starting the script execution. This is why we see a MOVED error in this case. The situation in READONLY mode is more complex:
The critical point is that once a script starts executing, we can't safely return a MOVED error. Returning MOVED could lead to the entire script being re-executed on another node, which could result in duplicate operations (e.g. messages published multiple times). Thus, if a script accesses a key it is not supposed to access, Valkey deliberately does not return MOVED (as indicated, see Line 455 in e9a1fe0
|
@gmbnomis |
Describe the bug
Issuing a write command in Valkey cluster (7.2.6 and 8.0) while in read-only mode (i.e. after a "READONLY" command) returns
different errors depending on whether the command is part of a script or not.
(I think this issue is not very significant, but it is an inconsistency)
To reproduce
Use the following commands on a cluster replica node. In this particular example, key "a" is served by a different node, key "b" is served by the primary of the current node:
Expected behavior
I think the description of the "READONLY" command does not make fully clear what is supposed to happen if a client uses a writing command, but I suppose we should see "MOVED" in all four cases here.
The text was updated successfully, but these errors were encountered: