Skip to content

prepared: enable cached result metadata optimization by default #210

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion scylla-rust-wrapper/src/prepared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,17 @@ pub struct CassPrepared {
}

impl CassPrepared {
pub fn new_from_prepared_statement(statement: PreparedStatement) -> Self {
pub fn new_from_prepared_statement(mut statement: PreparedStatement) -> Self {
// We already cache the metadata on cpp-rust-driver side (see CassPrepared::result_metadata field),
// thus we can enable the optimization on rust-driver side as well. This will prevent the server
// from sending redundant bytes representing a result metadata during EXECUTE.
//
// NOTE: We are aware that it makes cached metadata immutable. It is expected, though - there
// is an integration test for this for CQL protocol v4 (AlterDoesntUpdateColumnCount).
// This issue is addressed in CQL protocol v5, but Scylla doesn't support it yet, and probably
// won't support it in the near future.
statement.set_use_cached_result_metadata(true);

let variable_col_data_types = statement
.get_variable_col_specs()
.iter()
Expand Down