Skip to content

Commit

Permalink
Merge pull request #210 from muzarski/set-use-cached-result-metadata-…
Browse files Browse the repository at this point in the history
…by-default

prepared: enable cached result metadata optimization by default
  • Loading branch information
muzarski authored Dec 2, 2024
2 parents cd63ce3 + 72c7786 commit f1ed076
Showing 1 changed file with 11 additions and 1 deletion.
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

0 comments on commit f1ed076

Please sign in to comment.