Some prepared statements do not know their result metadata at PREPARE
time and therefore return the metadata_id of empty metadata. When such a
statement later produces a ROWS response with real metadata, comparing the
client-supplied metadata_id against the prepared response metadata_id is
incorrect: the server keeps NO_METADATA even though the actual rows metadata
differs.
Scylla already has the actual rows metadata when EXECUTE returns a ROWS
result. Use that first execution to promote the cached prepared statement to
the normal metadata_id path.
This change keeps the existing behavior for statements whose PREPARED
response already carries real result metadata. For prepared statements whose
PREPARED response had empty result metadata, the first EXECUTE with
metadata_id support now:
- calculates the metadata_id from the actual rows metadata
- updates the cached prepared entry with that metadata_id
- marks the prepared entry as having non-empty result metadata
- uses the promoted metadata_id for the current response
After that promotion, subsequent EXECUTEs use the existing fast path and do
not need to recalculate the metadata_id again.
The prepared statement remains read-only through public checked weak
handles. The mutation is performed only through the prepared statements
cache/query_processor layer, which owns the mutable cached entry.
Testing:
- add a regression test verifying that a ROWS response built from a stale
empty-metadata id returns METADATA_CHANGED and the actual rows
metadata_id
Scylla in-source tests.
For details on how to run the tests, see docs/dev/testing.md
Shared C++ utils, libraries are in lib/, for Python - pylib/
alternator - Python tests which connect to a single server and use the DynamoDB API unit, boost, raft - unit tests in C++ cqlpy - Python tests which connect to a single server and use CQL topology* - tests that set up clusters and add/remove nodes cql - approval tests that use CQL and pre-recorded output rest_api - tests for Scylla REST API Port 9000 scylla-gdb - tests for scylla-gdb.py helper script nodetool - tests for C++ implementation of nodetool
If you can use an existing folder, consider adding your test to it. New folders should be used for new large categories/subsystems, or when the test environment is significantly different from some existing suite, e.g. you plan to start scylladb with different configuration, and you intend to add many tests and would like them to reuse an existing Scylla cluster (clusters can be reused for tests within the same folder).
To add a new folder, create a new directory, and then
copy & edit its suite.ini.