Skip to content

Commit aa79301

Browse files
authored
Use newer Scylla driver crate version (#3772)
## Motivation Same as #3789, the rust driver crate also needs to be updated ## Proposal Update crate and make things compile ## Test Plan CI + will deploy a network with this ## Release Plan - Nothing to do / These changes follow the usual release cycle.
1 parent 2c183bc commit aa79301

File tree

3 files changed

+66
-39
lines changed

3 files changed

+66
-39
lines changed

Cargo.lock

Lines changed: 22 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,12 @@ revm-precompile = "16.2.0"
147147
revm-primitives = "15.2.0"
148148
rocksdb = "0.21.0"
149149
ruzstd = "0.7.1"
150-
scylla = "0.15.1"
150+
scylla = "1.1.0"
151+
secp256k1 = { version = "0.30.0", default-features = false, features = [
152+
"alloc",
153+
"rand",
154+
"serde",
155+
] }
151156
semver = "1.0.22"
152157
serde = { version = "1.0.197", features = ["derive"] }
153158
serde-name = "0.2.1"

linera-views/src/backends/scylla_db.rs

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,16 @@ use async_lock::{Semaphore, SemaphoreGuard};
1717
use futures::{future::join_all, FutureExt as _, StreamExt};
1818
use linera_base::ensure;
1919
use scylla::{
20-
batch::BatchStatement,
21-
prepared_statement::PreparedStatement,
22-
statement::batch::BatchType,
23-
transport::errors::{DbError, QueryError},
24-
Session, SessionBuilder,
20+
client::{session::Session, session_builder::SessionBuilder},
21+
deserialize::{DeserializationError, TypeCheckError},
22+
errors::{
23+
DbError, ExecutionError, IntoRowsResultError, NewSessionError, NextPageError, NextRowError,
24+
PagerExecutionError, PrepareError, RequestAttemptError, RequestError, RowsError,
25+
},
26+
statement::{
27+
batch::{BatchStatement, BatchType},
28+
prepared::PreparedStatement,
29+
},
2530
};
2631
use serde::{Deserialize, Serialize};
2732
use thiserror::Error;
@@ -465,27 +470,27 @@ pub enum ScyllaDbStoreInternalError {
465470

466471
/// A deserialization error in ScyllaDB
467472
#[error(transparent)]
468-
DeserializationError(#[from] scylla::deserialize::DeserializationError),
473+
DeserializationError(#[from] DeserializationError),
469474

470475
/// A row error in ScyllaDB
471476
#[error(transparent)]
472-
RowsError(#[from] scylla::transport::query_result::RowsError),
477+
RowsError(#[from] RowsError),
473478

474479
/// A type error in the accessed data in ScyllaDB
475480
#[error(transparent)]
476-
IntoRowsResultError(#[from] scylla::transport::query_result::IntoRowsResultError),
481+
IntoRowsResultError(#[from] IntoRowsResultError),
477482

478483
/// A type check error in ScyllaDB
479484
#[error(transparent)]
480-
TypeCheckError(#[from] scylla::deserialize::TypeCheckError),
485+
TypeCheckError(#[from] TypeCheckError),
481486

482487
/// A query error in ScyllaDB
483488
#[error(transparent)]
484-
ScyllaDbQueryError(#[from] scylla::transport::errors::QueryError),
489+
PagerExecutionError(#[from] PagerExecutionError),
485490

486491
/// A query error in ScyllaDB
487492
#[error(transparent)]
488-
ScyllaDbNewSessionError(#[from] scylla::transport::errors::NewSessionError),
493+
ScyllaDbNewSessionError(#[from] NewSessionError),
489494

490495
/// Namespace contains forbidden characters
491496
#[error("Namespace contains forbidden characters")]
@@ -498,6 +503,18 @@ pub enum ScyllaDbStoreInternalError {
498503
/// The batch is too long to be written
499504
#[error("The batch is too long to be written")]
500505
BatchTooLong,
506+
507+
/// A prepare error in ScyllaDB
508+
#[error(transparent)]
509+
PrepareError(#[from] PrepareError),
510+
511+
/// An execution error in ScyllaDB
512+
#[error(transparent)]
513+
ExecutionError(#[from] ExecutionError),
514+
515+
/// A next row error in ScyllaDB
516+
#[error(transparent)]
517+
NextRowError(#[from] NextRowError),
501518
}
502519

503520
impl KeyValueStoreError for ScyllaDbStoreInternalError {
@@ -689,16 +706,16 @@ impl AdminKeyValueStore for ScyllaDbStoreInternal {
689706
let result = match result {
690707
Ok(result) => result,
691708
Err(error) => {
692-
let invalid_or_not_found = match &error {
693-
QueryError::DbError(db_error, msg) => {
694-
*db_error == DbError::Invalid && msg.as_str() == miss_msg
695-
}
709+
let invalid_or_keyspace_not_found = match &error {
710+
PagerExecutionError::NextPageError(NextPageError::RequestFailure(
711+
RequestError::LastAttemptError(RequestAttemptError::DbError(db_error, msg)),
712+
)) => *db_error == DbError::Invalid && msg.as_str() == miss_msg,
696713
_ => false,
697714
};
698-
if invalid_or_not_found {
715+
if invalid_or_keyspace_not_found {
699716
return Ok(Vec::new());
700717
} else {
701-
return Err(ScyllaDbStoreInternalError::ScyllaDbQueryError(error));
718+
return Err(ScyllaDbStoreInternalError::PagerExecutionError(error));
702719
}
703720
}
704721
};
@@ -780,7 +797,9 @@ impl AdminKeyValueStore for ScyllaDbStoreInternal {
780797
return Ok(true);
781798
};
782799
let missing_table = match &error {
783-
QueryError::DbError(db_error, msg) => {
800+
PrepareError::AllAttemptsFailed {
801+
first_attempt: RequestAttemptError::DbError(db_error, msg),
802+
} => {
784803
if *db_error != DbError::Invalid {
785804
false
786805
} else {
@@ -794,7 +813,7 @@ impl AdminKeyValueStore for ScyllaDbStoreInternal {
794813
if missing_table {
795814
Ok(false)
796815
} else {
797-
Err(ScyllaDbStoreInternalError::ScyllaDbQueryError(error))
816+
Err(ScyllaDbStoreInternalError::PrepareError(error))
798817
}
799818
}
800819

0 commit comments

Comments
 (0)