Skip to content

Commit

Permalink
Revert "Pick connections based on batch first statement's shard"
Browse files Browse the repository at this point in the history
The new code, and in particualr the fancy GAT workaroound,
cause problems when trying to pass batch values by reference,
as described in scylladb#568.

Fixes: scylladb#568
Unfixes: scylladb#448

This reverts commit 24ee954.

Signed-off-by: Jan Ciolek <[email protected]>
  • Loading branch information
cvybhu committed Oct 4, 2022
1 parent acf1dd9 commit 4aea075
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 343 deletions.
18 changes: 3 additions & 15 deletions scylla-cql/src/frame/request/batch.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::frame::{frame_errors::ParseError, value::BatchValuesIterator};
use crate::frame::frame_errors::ParseError;
use bytes::{BufMut, Bytes};
use std::convert::TryInto;

Expand Down Expand Up @@ -54,21 +54,9 @@ where
// Serializing queries
types::write_short(self.statements_count.try_into()?, buf);

let mut n_serialized_statements = 0usize;
let mut value_lists = self.values.batch_values_iter();
for statement in self.statements.clone() {
for (statement_num, statement) in self.statements.clone().enumerate() {
statement.serialize(buf)?;
value_lists.write_next_to_request(buf).ok_or_else(|| {
ParseError::BadDataToSerialize(
"Mismatch between statement counts for batch query".to_owned(),
)
})??;
n_serialized_statements += 1;
}
if n_serialized_statements != self.statements_count {
return Err(ParseError::BadDataToSerialize(
"Mismatch between statement counts for batch query".to_owned(),
));
self.values.write_nth_to_request(statement_num, buf)?;
}

// Serializing consistency
Expand Down
Loading

0 comments on commit 4aea075

Please sign in to comment.