Skip to content

Commit

Permalink
Update scylla-driver
Browse files Browse the repository at this point in the history
  • Loading branch information
rukai committed Sep 6, 2024
1 parent f306014 commit 43cb82b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 38 deletions.
45 changes: 18 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ inherits = "release"
debug = true

[workspace.dependencies]
scylla = { version = "0.13.0", features = ["ssl"] }
scylla = { version = "0.14.0", features = ["ssl"] }
bytes = { version = "1.0.0", features = ["serde"] }
tokio = { version = "1.25.0", features = ["full"] }
tokio-util = { version = "0.7.7", features = ["codec"] }
Expand Down
6 changes: 3 additions & 3 deletions shotover-proxy/benches/windsock/cassandra/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ impl CassandraSession {
async fn query(&self, query: &str) {
match self {
Self::Scylla(session) => {
session.query(query, ()).await.unwrap();
session.query_unpaged(query, ()).await.unwrap();
}
Self::CdrsTokio(session) => {
session.query(query).await.unwrap();
Expand All @@ -271,7 +271,7 @@ impl CassandraSession {
) -> Result<(), String> {
match self {
Self::Scylla(session) => session
.execute(prepared_statement.as_scylla(), (value,))
.execute_unpaged(prepared_statement.as_scylla(), (value,))
.await
.map_err(|err| format!("{err:?}"))
.map(|_| ()),
Expand Down Expand Up @@ -310,7 +310,7 @@ impl CassandraSession {
) -> Result<(), String> {
match self {
Self::Scylla(session) => session
.execute(prepared_statement.as_scylla(), (value, blob))
.execute_unpaged(prepared_statement.as_scylla(), (value, blob))
.await
.map_err(|err| format!("{err:?}"))
.map(|_| ()),
Expand Down
18 changes: 11 additions & 7 deletions test-helpers/src/connection/cassandra/connection/scylla.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use cdrs_tokio::frame::message_error::{ErrorBody, ErrorType};
use scylla::batch::Batch;
use scylla::frame::types::Consistency as ScyllaConsistency;
use scylla::frame::value::{CqlDate, CqlDecimal, CqlTime, CqlTimestamp};
use scylla::serialize::value::SerializeCql;
use scylla::serialize::value::SerializeValue;
use scylla::statement::query::Query;
use scylla::transport::errors::{DbError, QueryError};
use scylla::{ExecutionProfile, QueryResult};
Expand Down Expand Up @@ -74,7 +74,11 @@ impl ScyllaConnection {
let statement = prepared_query.as_scylla();
let values = Self::build_values_scylla(values);

let response = self.session.execute(statement, values).await.unwrap();
let response = self
.session
.execute_unpaged(statement, values)
.await
.unwrap();
let tracing_id = response.tracing_id.unwrap();

tokio::time::sleep(tokio::time::Duration::from_millis(100)).await;
Expand All @@ -101,7 +105,7 @@ impl ScyllaConnection {
}

pub async fn execute_fallible(&self, query: &str) -> Result<Vec<Vec<ResultValue>>, ErrorBody> {
Self::process_scylla_response(self.session.query(query, ()).await)
Self::process_scylla_response(self.session.query_unpaged(query, ()).await)
}

pub async fn execute_with_timestamp(
Expand All @@ -111,7 +115,7 @@ impl ScyllaConnection {
) -> Result<Vec<Vec<ResultValue>>, ErrorBody> {
let mut query = Query::new(query);
query.set_timestamp(Some(timestamp));
Self::process_scylla_response(self.session.query(query, ()).await)
Self::process_scylla_response(self.session.query_unpaged(query, ()).await)
}

pub async fn prepare(&self, query: &str) -> PreparedQuery {
Expand All @@ -134,7 +138,7 @@ impl ScyllaConnection {
});
let values = Self::build_values_scylla(values);

Self::process_scylla_response(self.session.execute(&statement, values).await)
Self::process_scylla_response(self.session.execute_unpaged(&statement, values).await)
}

fn process_scylla_response(
Expand Down Expand Up @@ -167,11 +171,11 @@ impl ScyllaConnection {
}

// TODO: lets return Vec<CqlValue> instead, as it provides better guarantees for correctness
fn build_values_scylla(values: &[ResultValue]) -> Vec<Box<dyn SerializeCql + '_>> {
fn build_values_scylla(values: &[ResultValue]) -> Vec<Box<dyn SerializeValue + '_>> {
values
.iter()
.map(|v| match v {
ResultValue::Int(v) => Box::new(v) as Box<dyn SerializeCql>,
ResultValue::Int(v) => Box::new(v) as Box<dyn SerializeValue>,
ResultValue::Ascii(v) => Box::new(v),
ResultValue::BigInt(v) => Box::new(v),
ResultValue::Blob(v) => Box::new(v),
Expand Down

0 comments on commit 43cb82b

Please sign in to comment.