Skip to content

Commit

Permalink
prepared: docs mention about metadata immutability
Browse files Browse the repository at this point in the history
Added docstring mention about metadata immutability and when not to
enable `cached_result_metadata` optimisation on the statement.
  • Loading branch information
muzarski committed Apr 19, 2024
1 parent 1fcadc9 commit 4798ca3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions scylla/src/statement/prepared_statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,17 @@ impl PreparedStatement {
/// after statement preparation and will use it
/// to deserialize the results of statement execution.
///
/// NOTICE: Users should NOT alter the schema after enablind
/// this optimisation on the statement.
/// To be more precise:
/// they should not alter the tables and UDTs that are used in the given statement.
/// The reason for this is that the decision was made to keep client-side metadata immutable,
/// and so, it is not updated during statement repreparation.
/// Altering the schema, and then, executing the statement with optimisation enabled may lead
/// to runtime errors. In the worst case, it could lead to
/// some data being deserialized to wrong Rust type contained
/// in outdated metadata.
///
/// This option is false by default.
pub fn set_use_cached_result_metadata(&mut self, use_cached_metadata: bool) {
self.config.skip_result_metadata = use_cached_metadata;
Expand Down

0 comments on commit 4798ca3

Please sign in to comment.