4.x: Allow BatchStatements to be LWT#489
Merged
dkropachev merged 1 commit intoscylladb:scylla-4.xfrom Apr 5, 2025
Merged
Conversation
Author
|
Fixes #488 |
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. |
7de883d to
a0427e5
Compare
dkropachev
reviewed
Apr 3, 2025
core/src/main/java/com/datastax/oss/driver/api/core/cql/BatchStatementBuilder.java
Outdated
Show resolved
Hide resolved
Lorak-mmk
reviewed
Apr 3, 2025
core/src/test/java/com/datastax/oss/driver/internal/core/cql/DefaultBatchStatementTest.java
Show resolved
Hide resolved
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)`.
a0427e5 to
526519b
Compare
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. |
dkropachev
approved these changes
Apr 4, 2025
526519b to
2f81f24
Compare
|
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? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously all DefaultBatchStatements would always return
falsewhenisLWT()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