-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Prepared statements invalidation used to be completely broken, you can read details on it here
Recently core merged PR that fixes problems for select statements.
After that PR, if driver supply SCYLLA_USE_METADATA_ID
at the startup, when statements is prepared server hands out result queries metadata hash.
When driver executes this query it sends metadata id alongside with the request.
Server checks driver metadata id and what it has on its side, if there is any difference it will send new metadata and metadata id.
Driver suppose to pick it up and update metadata and metadata id on it's side, before deserializing response, solving issue with having outdated metadata on driver side.
Unfortunately it is solved only for SELECT statements, UPDATE/INSERT will be solved on separate occasion.
Core changes are in, we need to start working on driver side.
To Be Done:
- parse
SCYLLA_USE_METADATA_ID
protocol extension from SUPPORTED frame;- if present in SUPPORTED, send it in the STARTUP frame;
- if the extension is negotiated:
- store the metadata ID, same way it is done for CQL v5
- read
METADATA_CHANGED
(=3
) flag in result metadata; - if the flag is set, read the new metadata ID (short bytes) and update it on prepare statement
- if received new result metadata that is different from the cached one:
- use the new metadata for deserialization instead of the old one;
- replace the old cached metadata with the new one.
Resolve skip metadata flag
Default value of skip metadata flag should be treated as safest option
Which means that if SCYLLA_USE_METADATA_ID
was negotiated or CQL v5 is used then it is true, result metadata is skipped.
In other cases it is false.