-
Notifications
You must be signed in to change notification settings - Fork 110
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
Use the correct version of PreparedMetadata for each node #815
Comments
I wonder if it's a Rust specific issue - do other drivers behave correctly? |
I don't think this issue is solveable for a case of two clients. Let's suppose that client A does this:
and in the meantime client B:
Therefore closing this issue, I don't think that there is a good solution for this without changing the protocol (V5 protocol solved this problem). |
If protocol V5 solved this, shouldn't we keep this open until we and Scylla introduce support for it? |
That's going to take some time... |
Having this issue open doesn't hurt anybody, and it describes a bug that users might encounter |
Each unprepared statement has to be prepared on all nodes.
The driver sends a
PREPARE
request to every node, and in response it getsPreparedMetadata
which contains information about this prepared statement.Currently we assume that every node will return the same
PreparedMetadata
, after all we prepare the same statement on all of them. It turns out that this assumption isn't always true. During a rolling update different nodes might run different versions of Scylla, and different versions of Scylla might generate differentPreparedMetadata
for the same statement.The driver ignores the fact that
PreparedMetadata
is different on some nodes, and because of this it might send a malformed request to them.For example we could have the following query:
scylladb/scylladb@19a6e69 changed how prepared queries look like when the same named bind variable is used multiple times.
For the above example, here's how the prepared metadata looks like on
2021.1.16
:And here's how it looks on
2022.2.12
:Note that the number of bind variables has changed - on
2022.1.16
Scylla expects two bound variables, but in2022.2.12
it expects to see only one.If we try to do a rolling update from
2021.1.16
to2022.2.12
and run the example query, the following will happen:PreparedMetadata
generated by the old versionUNPREPARED
, as this node's cache has been cleared during the restartPREPARE
request, and receives thePreparedMetadata
generated by the new version of ScyllaPreparedMetadata
PreparedMetadata
The driver should be aware that some nodes require the old
PreparedMetadata
, and some require the new one. It should keep all of the required versions around and use the correct one for each node.Refs: #575
The text was updated successfully, but these errors were encountered: