-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When N of batch of statements is smaller than N of values, session.batch()
silently drops extra values.
#1114
Comments
I think I see the problem. scylla-rust-driver/scylla-cql/src/frame/request/batch.rs Lines 139 to 144 in 64b4afc
The problem is that in connection code here scylla-rust-driver/scylla/src/transport/connection.rs Lines 1252 to 1268 in 64b4afc
RawBatchValuesAdapter from values (with length N) and contexts (with length equal to amount of statements, so < N).RawBatchValuesIteratorAdapter ( scylla-rust-driver/scylla-cql/src/types/serialize/raw_batch.rs Lines 145 to 161 in 64b4afc
let ctx = self.contexts.next()?; - effectively limiting the length of the iterator to the amount of statements.
Possible fix: |
It's a bit sad that we don't have a test for that :( |
Yep, looks good enough. Nice catch! |
I was trying to bulk ingest with the same statement. So I went like this:
My understanding is you need to duplicate the prepared statement 100 times in a batch, even if they are identical. And the N of values need to match N of statements in a batch. So I had to take care of the last batch being not rounded to the step size.
When I tried to play around and have more statements than values in the batch:
I am seeing
That's good. However, when I commented out the initial, basically having an empty batch of statements:
This was when
N statements
<N values
, it's silently going through. I looked at the count throughcqlsh
, and the ingested count was 0. If I only had 1 statement in the batch, and 100 values, it would just ingest 1 single entry. So maybe the client was doing an iterator zip, and trimmed the extra values silently. I would like the client to error on the inequality ofN statements
andN values
.The text was updated successfully, but these errors were encountered: