Skip to content
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

TableSpecDiffersAcrossColumns when preparing a batch #1134

Closed
Lorak-mmk opened this issue Dec 1, 2024 · 2 comments · Fixed by #1135
Closed

TableSpecDiffersAcrossColumns when preparing a batch #1134

Lorak-mmk opened this issue Dec 1, 2024 · 2 comments · Fixed by #1135
Assignees
Labels
area/deserialization bug Something isn't working
Milestone

Comments

@Lorak-mmk
Copy link
Collaborator

Batch statement can contain multiple statements, and they can possible target different tables. Those statements can contain bind markers. An example of such statement:

BEGIN BATCH
    INSERT INTO friends (account_id, friend_id) VALUES (?, ?);
    DELETE FROM enemies WHERE account_id = ? AND enemy_id = ?;
APPLY BATCH;

If such statement is prepared, the bind markers will have different table specs, which 0.15 driver doesn't consider a possibility, so it throws an error:

called `Result::unwrap()` on an `Err` value: CqlResultParseError(PreparedParseError(PreparedMetadataParseError(ColumnSpecParseError(ColumnSpecParseError { column_index: 2, kind: TableSpecDiffersAcrossColumns(TableSpec { ks_name: "ks", table_name: "friends" }, TableSpec { ks_name: "ks", table_name: "enemies" }) }))))

Credits to Johhny Bike from User Slack for reporting this!

@wprzytula
Copy link
Collaborator

This is a serious regression. I suggest releasing 0.15.1 containing the fix. WDYT @Lorak-mmk @dkropachev?

@Lorak-mmk
Copy link
Collaborator Author

I agree

wprzytula added a commit to wprzytula/scylla-rust-driver that referenced this issue Dec 2, 2024
As noted in scylladb#1134, when preparing batches containing requests to
multiple to different tables, the PreparedMetadata received upon
preparation contains differing TableSpecs (i.e., TableSpecs with more
than table mentioned).
This fails the check that we introduced with ResultMetadata in mind:
we've been assuming that all TableSpecs are the same, because ScyllaDB/
Cassandra has no support for JOINs.
Not to fail preparation of cross-table batches, the check is now only
turned on for ResultMetadata and turned off for PreparedMetadata.
wprzytula added a commit to wprzytula/scylla-rust-driver that referenced this issue Dec 2, 2024
As noted in scylladb#1134, when preparing batches containing requests to
multiple to different tables, the PreparedMetadata received upon
preparation contains differing TableSpecs (i.e., TableSpecs with more
than table mentioned).
This fails the check that we introduced with ResultMetadata in mind:
we've been assuming that all TableSpecs are the same, because ScyllaDB/
Cassandra has no support for JOINs.
Not to fail preparation of cross-table batches, the check is now only
turned on for ResultMetadata and turned off for PreparedMetadata.
wprzytula added a commit to wprzytula/scylla-rust-driver that referenced this issue Dec 2, 2024
The previous commit fixed the bug described in scylladb#1134. This commit adds
a regression test for that particular case, that is, for preparing a
batch that operates on multiple tables.
wprzytula added a commit to wprzytula/scylla-rust-driver that referenced this issue Dec 4, 2024
As noted in scylladb#1134, when preparing batches containing requests to
multiple to different tables, the PreparedMetadata received upon
preparation contains differing TableSpecs (i.e., TableSpecs with more
than table mentioned).
This fails the check that we introduced with ResultMetadata in mind:
we've been assuming that all TableSpecs are the same, because ScyllaDB/
Cassandra has no support for JOINs.
Not to fail preparation of cross-table batches, the check is disabled.
We decided that we should not rely on an assumption that is not
guaranteed by the CQL protocol.
wprzytula added a commit to wprzytula/scylla-rust-driver that referenced this issue Dec 4, 2024
The previous commit fixed the bug described in scylladb#1134. This commit adds
a regression test for that particular case, that is, for preparing a
batch that operates on multiple tables.
@wprzytula wprzytula added this to the 0.15.1 milestone Dec 4, 2024
wprzytula added a commit to wprzytula/scylla-rust-driver that referenced this issue Dec 5, 2024
As noted in scylladb#1134, when preparing batches containing requests to
multiple to different tables, the PreparedMetadata received upon
preparation contains differing TableSpecs (i.e., TableSpecs with more
than table mentioned).
This fails the check that we introduced with ResultMetadata in mind:
we've been assuming that all TableSpecs are the same, because ScyllaDB/
Cassandra has no support for JOINs.
Not to fail preparation of cross-table batches, the check is disabled.
We decided that we should not rely on an assumption that is not
guaranteed by the CQL protocol.
wprzytula added a commit to wprzytula/scylla-rust-driver that referenced this issue Dec 5, 2024
The previous commit fixed the bug described in scylladb#1134. This commit adds
a regression test for that particular case, that is, for preparing a
batch that operates on multiple tables.
wprzytula added a commit to wprzytula/scylla-rust-driver that referenced this issue Dec 5, 2024
As noted in scylladb#1134, when preparing batches containing requests to
multiple to different tables, the PreparedMetadata received upon
preparation contains differing TableSpecs (i.e., TableSpecs with more
than table mentioned).
This fails the check that we introduced with ResultMetadata in mind:
we've been assuming that all TableSpecs are the same, because ScyllaDB/
Cassandra has no support for JOINs.
Not to fail preparation of cross-table batches, the check is disabled.
We decided that we should not rely on an assumption that is not
guaranteed by the CQL protocol.
wprzytula added a commit to wprzytula/scylla-rust-driver that referenced this issue Dec 5, 2024
The previous commit fixed the bug described in scylladb#1134. This commit adds
a regression test for that particular case, that is, for preparing a
batch that operates on multiple tables.
wprzytula added a commit to wprzytula/scylla-rust-driver that referenced this issue Dec 5, 2024
As noted in scylladb#1134, when preparing batches containing requests to
multiple to different tables, the PreparedMetadata received upon
preparation contains differing TableSpecs (i.e., TableSpecs with more
than table mentioned).
This fails the check that we introduced with ResultMetadata in mind:
we've been assuming that all TableSpecs are the same, because ScyllaDB/
Cassandra has no support for JOINs.
Not to fail preparation of cross-table batches, the check is disabled.
We decided that we should not rely on an assumption that is not
guaranteed by the CQL protocol.
wprzytula added a commit to wprzytula/scylla-rust-driver that referenced this issue Dec 5, 2024
The previous commit fixed the bug described in scylladb#1134. This commit adds
a regression test for that particular case, that is, for preparing a
batch that operates on multiple tables.
wprzytula added a commit to wprzytula/scylla-rust-driver that referenced this issue Dec 5, 2024
The previous commit fixed the bug described in scylladb#1134. This commit adds
a regression test for that particular case, that is, for preparing a
batch that operates on multiple tables.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/deserialization bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants