diff --git a/Cargo.lock b/Cargo.lock index c563e037a..3d3485b49 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4439,9 +4439,8 @@ dependencies = [ [[package]] name = "scylla" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8139623d3fb0c8205b15e84fa587f3aa0ba61f876c19a9157b688f7c1763a7c5" +version = "0.15.0" +source = "git+https://github.com/rukai/scylla-rust-driver?branch=make_connection_setup_request_error_public#bde3e60dd8ca437b0b9b99cb91e3f3f4b500719a" dependencies = [ "arc-swap", "async-trait", @@ -4472,9 +4471,8 @@ dependencies = [ [[package]] name = "scylla-cql" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de7020bcd1f6fdbeaed356cd426bf294b2071bd7120d48d2e8e319295e2acdcd" +version = "0.4.0" +source = "git+https://github.com/rukai/scylla-rust-driver?branch=make_connection_setup_request_error_public#bde3e60dd8ca437b0b9b99cb91e3f3f4b500719a" dependencies = [ "async-trait", "byteorder", @@ -4482,16 +4480,17 @@ dependencies = [ "lz4_flex", "scylla-macros", "snap", + "stable_deref_trait", "thiserror 1.0.69", "tokio", "uuid", + "yoke", ] [[package]] name = "scylla-macros" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3859b6938663fc5062e3b26f3611649c9bd26fb252e85f6fdfa581e0d2ce74b6" +version = "0.7.0" +source = "git+https://github.com/rukai/scylla-rust-driver?branch=make_connection_setup_request_error_public#bde3e60dd8ca437b0b9b99cb91e3f3f4b500719a" dependencies = [ "darling", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index be69dde5f..aecd2beb9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ inherits = "release" debug = true [workspace.dependencies] -scylla = { version = "0.14.0", features = ["ssl"] } +scylla = { version = "0.15.0", features = ["ssl"], git = "https://github.com/rukai/scylla-rust-driver", branch = "make_connection_setup_request_error_public" } bytes = { version = "1.0.0", features = ["serde"] } tokio = { version = "1.25.0", features = ["full"] } tokio-util = { version = "0.7.7", features = ["codec"] } diff --git a/shotover-proxy/tests/cassandra_int_tests/mod.rs b/shotover-proxy/tests/cassandra_int_tests/mod.rs index f85f0d089..f464148d7 100644 --- a/shotover-proxy/tests/cassandra_int_tests/mod.rs +++ b/shotover-proxy/tests/cassandra_int_tests/mod.rs @@ -9,6 +9,10 @@ use futures::Future; use pretty_assertions::assert_eq; use rstest::rstest; use rstest_reuse::{self, *}; +use scylla::transport::errors::{ + ConnectionError, ConnectionPoolError, ConnectionSetupRequestError, + ConnectionSetupRequestErrorKind, DbError, NewSessionError, +}; use scylla::SessionBuilder; use std::net::SocketAddr; #[cfg(feature = "cassandra-cpp-driver-tests")] @@ -141,10 +145,16 @@ async fn passthrough_cassandra_down() { .await .unwrap_err(); match err { - scylla::transport::errors::NewSessionError::IoError(err) => { + NewSessionError::ConnectionPoolError(ConnectionPoolError::Broken { + last_connection_error: + ConnectionError::ConnectionSetupRequestError(ConnectionSetupRequestError { + error: ConnectionSetupRequestErrorKind::DbError(DbError::ServerError, err), + .. + }), + }) => { assert_eq!( format!("{err}"), - format!("No connections in the pool; last connection failed with: Database returned an error: Internal server error. This indicates a server-side bug, Error message: Internal shotover (or custom transform) bug: Chain failed to send and/or receive messages, the connection will now be closed. + format!("Internal shotover (or custom transform) bug: Chain failed to send and/or receive messages, the connection will now be closed. Caused by: 0: CassandraSinkSingle transform failed diff --git a/test-helpers/src/connection/cassandra/connection/scylla.rs b/test-helpers/src/connection/cassandra/connection/scylla.rs index 5668b219d..8e7a7d927 100644 --- a/test-helpers/src/connection/cassandra/connection/scylla.rs +++ b/test-helpers/src/connection/cassandra/connection/scylla.rs @@ -2,6 +2,7 @@ use super::{Compression, Consistency, PreparedQuery, ProtocolVersion, Tls}; use crate::connection::cassandra::ResultValue; use cdrs_tokio::frame::message_error::{ErrorBody, ErrorType}; use scylla::batch::Batch; +use scylla::frame::response::result::Row; use scylla::frame::types::Consistency as ScyllaConsistency; use scylla::frame::value::{CqlDate, CqlDecimal, CqlTime, CqlTimestamp}; use scylla::serialize::value::SerializeValue; @@ -79,7 +80,7 @@ impl ScyllaConnection { .execute_unpaged(statement, values) .await .unwrap(); - let tracing_id = response.tracing_id.unwrap(); + let tracing_id = response.tracing_id().unwrap(); tokio::time::sleep(tokio::time::Duration::from_millis(100)).await; self.session @@ -145,18 +146,26 @@ impl ScyllaConnection { response: Result, ) -> Result>, ErrorBody> { match response { - Ok(value) => Ok(match value.rows { - Some(rows) => rows - .into_iter() - .map(|x| { - x.columns - .into_iter() - .map(ResultValue::new_from_scylla) - .collect() - }) - .collect(), - None => vec![], - }), + Ok(value) => { + if value.is_rows() { + Ok(value + .into_rows_result() + .unwrap() + .rows::() + .unwrap() + .map(|x| { + x.unwrap() + .columns + .into_iter() + .map(ResultValue::new_from_scylla) + .collect() + }) + .collect()) + } else { + value.result_not_rows().unwrap(); + Ok(vec![]) + } + } Err(QueryError::DbError(code, message)) => Err(ErrorBody { ty: match code { DbError::Overloaded => ErrorType::Overloaded,