Skip to content

Commit 9a220d5

Browse files
committed
Use newer Scylla driver crate version
1 parent a1a363c commit 9a220d5

File tree

3 files changed

+59
-37
lines changed

3 files changed

+59
-37
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ revm-precompile = "16.2.0"
149149
revm-primitives = "15.2.0"
150150
rocksdb = "0.21.0"
151151
ruzstd = "0.7.1"
152-
scylla = "0.15.1"
152+
scylla = "1.1.0"
153153
secp256k1 = { version = "0.30.0", default-features = false, features = [
154154
"alloc",
155155
"rand",

linera-views/src/backends/scylla_db.rs

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

467472
/// A deserialization error in ScyllaDB
468473
#[error(transparent)]
469-
DeserializationError(#[from] scylla::deserialize::DeserializationError),
474+
DeserializationError(#[from] DeserializationError),
470475

471476
/// A row error in ScyllaDB
472477
#[error(transparent)]
473-
RowsError(#[from] scylla::transport::query_result::RowsError),
478+
RowsError(#[from] RowsError),
474479

475480
/// A type error in the accessed data in ScyllaDB
476481
#[error(transparent)]
477-
IntoRowsResultError(#[from] scylla::transport::query_result::IntoRowsResultError),
482+
IntoRowsResultError(#[from] IntoRowsResultError),
478483

479484
/// A type check error in ScyllaDB
480485
#[error(transparent)]
481-
TypeCheckError(#[from] scylla::deserialize::TypeCheckError),
486+
TypeCheckError(#[from] TypeCheckError),
482487

483488
/// A query error in ScyllaDB
484489
#[error(transparent)]
485-
ScyllaDbQueryError(#[from] scylla::transport::errors::QueryError),
490+
PagerExecutionError(#[from] PagerExecutionError),
486491

487492
/// A query error in ScyllaDB
488493
#[error(transparent)]
489-
ScyllaDbNewSessionError(#[from] scylla::transport::errors::NewSessionError),
494+
ScyllaDbNewSessionError(#[from] NewSessionError),
490495

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

504521
impl KeyValueStoreError for ScyllaDbStoreInternalError {
@@ -692,15 +709,15 @@ impl AdminKeyValueStore for ScyllaDbStoreInternal {
692709
Ok(result) => result,
693710
Err(error) => {
694711
let invalid_or_not_found = match &error {
695-
QueryError::DbError(db_error, msg) => {
696-
*db_error == DbError::Invalid && msg.as_str() == miss_msg
697-
}
712+
PagerExecutionError::NextPageError(NextPageError::RequestFailure(
713+
RequestError::LastAttemptError(RequestAttemptError::DbError(db_error, msg)),
714+
)) => *db_error == DbError::Invalid && msg.as_str() == miss_msg,
698715
_ => false,
699716
};
700717
if invalid_or_not_found {
701718
return Ok(Vec::new());
702719
} else {
703-
return Err(ScyllaDbStoreInternalError::ScyllaDbQueryError(error));
720+
return Err(ScyllaDbStoreInternalError::PagerExecutionError(error));
704721
}
705722
}
706723
};
@@ -782,7 +799,9 @@ impl AdminKeyValueStore for ScyllaDbStoreInternal {
782799
return Ok(true);
783800
};
784801
let missing_table = match &error {
785-
QueryError::DbError(db_error, msg) => {
802+
PrepareError::AllAttemptsFailed {
803+
first_attempt: RequestAttemptError::DbError(db_error, msg),
804+
} => {
786805
if *db_error != DbError::Invalid {
787806
false
788807
} else {
@@ -796,7 +815,7 @@ impl AdminKeyValueStore for ScyllaDbStoreInternal {
796815
if missing_table {
797816
Ok(false)
798817
} else {
799-
Err(ScyllaDbStoreInternalError::ScyllaDbQueryError(error))
818+
Err(ScyllaDbStoreInternalError::PrepareError(error))
800819
}
801820
}
802821

0 commit comments

Comments
 (0)