-
Notifications
You must be signed in to change notification settings - Fork 53
DRIVER-153: negotiate and implement SCYLLA_USE_METADATA_ID extension #770
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -573,6 +573,9 @@ def _write_query_params(self, f, protocol_version): | |||||
| if self.timestamp is not None: | ||||||
| flags |= _PROTOCOL_TIMESTAMP_FLAG | ||||||
|
|
||||||
| if self.skip_meta: | ||||||
| flags |= _SKIP_METADATA_FLAG | ||||||
|
|
||||||
| if self.keyspace is not None: | ||||||
| if ProtocolVersion.uses_keyspace_flag(protocol_version): | ||||||
| flags |= _WITH_KEYSPACE_FLAG | ||||||
|
|
@@ -642,6 +645,8 @@ def send_body(self, f, protocol_version): | |||||
| write_string(f, self.query_id) | ||||||
| if ProtocolVersion.uses_prepared_metadata(protocol_version): | ||||||
| write_string(f, self.result_metadata_id) | ||||||
| elif self.result_metadata_id is not None: | ||||||
| write_string(f, self.result_metadata_id) | ||||||
|
Comment on lines
+648
to
+649
|
||||||
| elif self.result_metadata_id is not None: | |
| write_string(f, self.result_metadata_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. The elif self.result_metadata_id is not None path in send_body is now only reached when the caller explicitly set the field — which only happens in _query() after confirming connection.features.use_metadata_id (or CQL v5). For any connection that didn't negotiate the extension, result_metadata_id remains None and the branch is never taken, so the wire layout is unaffected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is still a problem here. If the result id feature is negotiated on the connection, then you need to ALWAYS send some result metadata id in EXECUTE. Skipping the write_string will result in a protocol error.
Your use_metadata_id may be False even if extension was negotiated, if the server decided to skip the metadata in PREPARED response. In such case, you'll skip writing the id here, and encounter protocol error.
Even if you fix this specific case, there is still possibility of mixed cluster, with some nodes supporting the extension. In that case result_metadata_id will be None, and if you send to a node that has the extension negotiated, you'll again not send the id and encounter protocol error.
To sum up: this serialization here should check if feature is negotiated, and base sending this field only on that.
Uh oh!
There was an error while loading. Please reload this page.