Skip to content

Conversation

@nikagra
Copy link

@nikagra nikagra commented Oct 15, 2025

…ion.

Issue gocql#527

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:

  1. parse SCYLLA_USE_METADATA_ID protocol extension from SUPPORTED frame;
    • if present in SUPPORTED, send it in the STARTUP frame;
  2. 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
  3. 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.

Changes

  • Implemented scyllaUseMetadataIdExt as cqlProtocolExtension interface (ensures protocol extension negotiation)
  • Updated framer to have scyllaUseMetadataId flag set if the extension was negotiated
  • Use scyllaUseMetadataId flag to:
    • write resultMetadataID during writing of EXECUTE frame and
    • read resultMetadataID during parsing of RESULT (prepared) frame
  • Extending integration tests

@dkropachev
Copy link
Collaborator

@nikagra , please rebase and update PR description

worryg0d and others added 2 commits October 29, 2025 17:56
Native Protocol 5 was introduced with the release of C* 4.0. This PR provides full support
for a newer version including new format frames (segments), and new fields for QUERY, BATCH, and EXECUTE messages.
Also, this PR brings changes to the Compressor interface to follow an append-like design.
One more thing, it bumps Go version to the newer 1.19.

Patch by Bohdan Siryk; Reviewed by João Reis, James Hartig for CASSGO-1 CASSGO-30
…y to internal package. Integration tests config changes. Reverting unwanted merge changes.

Detailed summary:
- Moving CRC functionality to internal package.
- Update test cluster hosts to match CCM-created cluster
    - Update flagCluster default from 127.0.0.1 to 127.0.2.1,127.0.2.2,127.0.2.3 to align with the 3-node cluster configuration created by CCM. Fixes connection refused errors in integration tests.
- Adding validation to `ReadTimeout` value in `ClusterConfig`
- Removing `headSize` from `framer`.
- Adding `.vscode` to `.gitignore`.
@nikagra nikagra force-pushed the support-scylla-use-metadata-id-extention branch from eab9ebd to 6ce9936 Compare October 30, 2025 19:04
…nhancements. Refactor keyspace handling in `TestQuery_SetKeyspace`
Changes:
- Implemented `scyllaUseMetadataIdExt` as `cqlProtocolExtension` interface (ensures protocol extension negotiation)
- Updated `framer` to have `scyllaUseMetadataId` flag set if the extension was negotiated
- Use `scyllaUseMetadataId` flag to:
  - write `resultMetadataID` during writing of EXECUTE frame and
  - read `resultMetadataID` during parsing of RESULT (prepared) frame
@nikagra nikagra force-pushed the support-scylla-use-metadata-id-extention branch from a56f941 to c3fb900 Compare November 3, 2025 13:14
…lla's metadata ID extension with comprehensive test cases for various protocol versions.
@nikagra nikagra force-pushed the support-scylla-use-metadata-id-extention branch from 1f2fe11 to 4999fb6 Compare November 4, 2025 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants