Was this page helpful?
After a query fails the driver might decide to retry it based on its
Retry Policy and the query itself.
Retry policy can be configured for
Session or just for a single query.
By default there are three retry policies:
Fallthrough Retry Policy - never retries, returns all errors straight to the user
Default Retry Policy - used by default, might retry if there is a high chance of success
It’s possible to implement a custom
Retry Policy by implementing the traits
A query is idempotent if it can be applied multiple times without changing the result of the initial application
Specifying that a query is idempotent increases the chances that it will be retried in case of failure. Idempotent queries can be retried in situations where retrying non idempotent queries would be dangerous.
Idempotence has to be specified manually, the driver is not able to figure it out by itself.
use scylla::query::Query; use scylla::prepared_statement::PreparedStatement; // Specify that a Query is idempotent let mut my_query: Query = Query::new("SELECT a FROM ks.tab"); my_query.set_is_idempotent(true); // Specify that a PreparedStatement is idempotent let mut prepared: PreparedStatement = session .prepare("SELECT a FROM ks.tab") .await?; prepared.set_is_idempotent(true);