Skip to content

4.x: Allow BatchStatements to be LWT #489

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

Merged

Conversation

Bouncheck
Copy link
Collaborator

@Bouncheck Bouncheck commented Apr 3, 2025

Previously all DefaultBatchStatements would always return false when isLWT() was called. This would cause the driver to route the batch based on the first non null routing information found in a batch but using regular rules rather than rules for LWT queries, even if a LWT query was inside the batch.

Now LWT routing will be used for DefaultBatchStatements if somewhere along the way an LWT query was added to the batch. This can also be controlled explicitly regardless of batch contents with
BatchStatementBuilder#setIsLWT(boolean).

Fixes: #488

@Bouncheck Bouncheck self-assigned this Apr 3, 2025
@Bouncheck
Copy link
Collaborator Author

Fixes #488

@Bouncheck
Copy link
Collaborator Author

When I've checked the current implementation of BatchStatement it turned out that it already infers the routing information from the first query in a batch that has routing information. I've left that part as is and just added LWT support for batches according to suggestions.

@Bouncheck Bouncheck requested a review from dkropachev April 3, 2025 15:32
@Bouncheck Bouncheck changed the title Allow BatchStatements to be LWT 4.x: Allow BatchStatements to be LWT Apr 3, 2025
@Bouncheck Bouncheck force-pushed the scylla-4.x-allow-lwt-batches branch 2 times, most recently from 7de883d to a0427e5 Compare April 3, 2025 15:36
Previously all DefaultBatchStatements would always return `false` when `isLWT()`
was called. This would cause the driver to route the batch based on the
first non null routing information found in a batch but using regular rules
rather than rules for LWT queries, even if a LWT query was inside the batch.

Now LWT routing will be used for DefaultBatchStatements if somewhere along
the way an LWT query was added to the batch. This can also be controlled
explicitly regardless of batch contents with
`BatchStatementBuilder#setIsLWT(boolean)`.
@Bouncheck Bouncheck force-pushed the scylla-4.x-allow-lwt-batches branch from a0427e5 to 526519b Compare April 4, 2025 10:39
@Bouncheck
Copy link
Collaborator Author

Adjusted integration test to have a batch with non-LWT and LWT query, added a few extra checks to unit test, adjusted docs and BatchStatement interface.

@Bouncheck Bouncheck force-pushed the scylla-4.x-allow-lwt-batches branch from 526519b to 2f81f24 Compare April 4, 2025 11:34
@dkropachev dkropachev merged commit e5cb7d6 into scylladb:scylla-4.x Apr 5, 2025
8 of 10 checks passed
@Lorak-mmk
Copy link

I unfortunately still don't see an integration test that executes a batch with LWT and non-LWT statements. Could you add it in a separate PR?
Right now there is only a test that has both prepared and unprepared LWT statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing LWT routing for batch statements
3 participants