You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I extracted the part of speculative_execution::can_be_ignored as
DbError method. This way, we don't have to match against "_" (because
method is defined in the same module as the type - namely scylla_cql).
Copy file name to clipboardExpand all lines: scylla-cql/src/frame/response/error.rs
+42Lines changed: 42 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -151,6 +151,7 @@ impl Error {
151
151
/// An error sent from the database in response to a query
152
152
/// as described in the [specification](https://github.com/apache/cassandra/blob/5ed5e84613ef0e9664a774493db7d2604e3596e0/doc/native_protocol_v4.spec#L1029)\
153
153
#[derive(Error,Debug,Clone,PartialEq,Eq)]
154
+
#[non_exhaustive]
154
155
pubenumDbError{
155
156
/// The submitted query has a syntax error
156
157
#[error("The submitted query has a syntax error")]
@@ -386,6 +387,47 @@ impl DbError {
386
387
} => protocol_features.rate_limit_error.unwrap(),
387
388
}
388
389
}
390
+
391
+
/// Decides whether the error can be ignored. If true, the driver can perform
392
+
/// a speculative retry to the next target.
393
+
pubfncan_speculative_retry(&self) -> bool{
394
+
// Do not remove this lint!
395
+
// It's there for a reason - we don't want new variants
396
+
// automatically fall under `_` pattern when they are introduced.
397
+
#[deny(clippy::wildcard_enum_match_arm)]
398
+
matchself{
399
+
// Errors that will almost certainly appear on other nodes as well
400
+
DbError::SyntaxError
401
+
| DbError::Invalid
402
+
| DbError::AlreadyExists{ .. }
403
+
| DbError::Unauthorized
404
+
| DbError::ProtocolError => false,
405
+
406
+
// Errors that should not appear there - thus, should not be ignored.
0 commit comments