Skip to content

Commit f1ed076

Browse files
authored
Merge pull request #210 from muzarski/set-use-cached-result-metadata-by-default
prepared: enable cached result metadata optimization by default
2 parents cd63ce3 + 72c7786 commit f1ed076

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

scylla-rust-wrapper/src/prepared.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,17 @@ pub struct CassPrepared {
2323
}
2424

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

0 commit comments

Comments
 (0)