Skip to content

Commit 562d007

Browse files
committed
Use newer Scylla driver crate version
1 parent d738461 commit 562d007

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 {
@@ -694,15 +711,15 @@ impl AdminKeyValueStore for ScyllaDbStoreInternal {
694711
Ok(result) => result,
695712
Err(error) => {
696713
let invalid_or_not_found = match &error {
697-
QueryError::DbError(db_error, msg) => {
698-
*db_error == DbError::Invalid && msg.as_str() == miss_msg
699-
}
714+
PagerExecutionError::NextPageError(NextPageError::RequestFailure(
715+
RequestError::LastAttemptError(RequestAttemptError::DbError(db_error, msg)),
716+
)) => *db_error == DbError::Invalid && msg.as_str() == miss_msg,
700717
_ => false,
701718
};
702719
if invalid_or_not_found {
703720
return Ok(Vec::new());
704721
} else {
705-
return Err(ScyllaDbStoreInternalError::ScyllaDbQueryError(error));
722+
return Err(ScyllaDbStoreInternalError::PagerExecutionError(error));
706723
}
707724
}
708725
};
@@ -784,7 +801,9 @@ impl AdminKeyValueStore for ScyllaDbStoreInternal {
784801
return Ok(true);
785802
};
786803
let missing_table = match &error {
787-
QueryError::DbError(db_error, msg) => {
804+
PrepareError::AllAttemptsFailed {
805+
first_attempt: RequestAttemptError::DbError(db_error, msg),
806+
} => {
788807
if *db_error != DbError::Invalid {
789808
false
790809
} else {
@@ -798,7 +817,7 @@ impl AdminKeyValueStore for ScyllaDbStoreInternal {
798817
if missing_table {
799818
Ok(false)
800819
} else {
801-
Err(ScyllaDbStoreInternalError::ScyllaDbQueryError(error))
820+
Err(ScyllaDbStoreInternalError::PrepareError(error))
802821
}
803822
}
804823

0 commit comments

Comments
 (0)