Commit b8b714c
committed
DRIVER-153: tests for SCYLLA_USE_METADATA_ID extension
Unit tests for the extension across its layers:
test_protocol_features.py: SCYLLA_USE_METADATA_ID parsed from SUPPORTED
and echoed in STARTUP options; absent by default.
test_protocol.py (wire format):
- metadata-id field written on v4 iff the connection negotiated the
extension, with the exact bytes asserted; empty sentinel (b'') when
the statement has no id, on both the extension path (v4) and the v5
native path (previously a TypeError);
- _SKIP_METADATA_FLAG written when skip_meta is requested and the
SCYLLA_USE_METADATA_ID extension is negotiated (v4 or v5), and NOT set
on a native v5 connection without the extension (the id field is still
written there, but the driver does not request skip); also suppressed -
together with the id field - on a v4 connection without the extension,
even when the statement carries an id;
- PREPARED response decoding reads result_metadata_id iff the extension
was negotiated (or v5); METADATA_CHANGED/NO_METADATA flag handling.
test_query.py: PreparedStatement stores the (result_metadata,
result_metadata_id) pair atomically - constructor, update_result_metadata,
and the backwards-compatible single-attribute setters all replace the
pair as one unit, and previously-taken snapshots stay internally
consistent.
test_response_future.py:
- _create_response_future builds ExecuteMessage from a single pair
snapshot: skip_meta only with both an id and usable cached metadata;
disabled for id-less statements, NO_METADATA/LWT statements
(result_metadata None) and zero-column statements (result_metadata []),
while the id still rides on the message;
- _query sends the message exactly as constructed (no per-connection
mutation - regression test for the speculative-execution race) and
decodes a skip_meta response against the metadata snapshotted when the
message was built, not a later read of the statement cache (regression
for a concurrent METADATA_CHANGED racing the send);
- _set_result METADATA_CHANGED path replaces the cached pair atomically;
a response with a new id but no column metadata (empty or absent) is
ignored with a warning, leaving the cached pair unchanged - adopting
the id alone would poison the cache with a stale-metadata/current-id
pair the server would never refresh;
- _execute_after_prepare refreshes the pair from exactly what the
reprepare response carries, including the id, and no longer keeps the
previous id when the response has none (@dkropachev: doing so risked
pairing a stale id with metadata from a different schema version -
test_execute_after_prepare_no_metadata_id_in_response_clears_id);
- a statement with valid cached metadata+id must still get skip_meta=False
when continuous_paging_options is set (@dkropachev: Connection.process_msg
hardcodes result_metadata=None for paging-session pages after the first,
so a skip_meta response would crash decoding them -
test_create_execute_message_continuous_paging_disables_skip_meta).
tests/integration/standard/test_scylla_metadata_id.py: live-server
coverage against a real Scylla node via CCM, closing the one gap unit
tests can't - whether Scylla actually treats the empty result_metadata_id
sentinel as a mismatch rather than a protocol error. Confirms extension
negotiation, the normal METADATA_CHANGED-after-ALTER-TABLE path, and the
sentinel round trip: a statement forced back to result_metadata_id=None
(simulating one prepared before the extension was known, e.g. mid
rolling-upgrade) executes without error and comes back with a fresh id.
Mirrors the equivalent live test already merged in the Java driver
(scylladb/java-driver#758,
should_handle_empty_metadata_id_when_executing_statement_when_supported).
Run locally against Scylla 2026.1.9 via CCM; see PR description for setup
and log excerpt.1 parent fa14e80 commit b8b714c
7 files changed
Lines changed: 1014 additions & 12 deletions
File tree
- cassandra
- tests
- integration/standard
- unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4736 | 4736 | | |
4737 | 4737 | | |
4738 | 4738 | | |
4739 | | - | |
| 4739 | + | |
4740 | 4740 | | |
4741 | 4741 | | |
4742 | 4742 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
614 | 614 | | |
615 | 615 | | |
616 | 616 | | |
617 | | - | |
618 | | - | |
| 617 | + | |
619 | 618 | | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
620 | 624 | | |
621 | 625 | | |
622 | | - | |
623 | | - | |
624 | 626 | | |
625 | 627 | | |
626 | 628 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
0 commit comments