-
Notifications
You must be signed in to change notification settings - Fork 11
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
bump rust-driver to 0.15 (with eager deserialization) #206
Conversation
Once we bump to 0.15, the error can occur during the conversion to QueryRowsResult. The returned error is not a QueryError, but a standalone type. This is why, we need to extend our `CassErrorResult` so it's an enum over possible error types returned during query execution and conversions. thiserror crate will come in handy, when defining such error type. It allows to quickly generate `From` implementations for corresponding variants and most importantly, it helps generating `std::fmt::Display` implementation.
Changing it to enum right now, to reduce the noise during the commit that actually bumps the version.
Partially fixes scylladb#177.
@Lorak-mmk / @wprzytula your prompt review is greatly appreciated . |
)) => CassConsistency::from(*consistency), | ||
_ => CassConsistency::CASS_CONSISTENCY_UNKNOWN, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that we should avoid this wildcard here for the same reasons as scylladb/scylla-rust-driver#1083. This is probably out of scope of this PR, though.
[dependencies] | ||
scylla = { git = "https://github.com/scylladb/scylla-rust-driver.git", rev = "64b4afcd", features = [ | ||
scylla = { git = "https://github.com/scylladb/scylla-rust-driver.git", rev = "v0.15.0", features = [ | ||
"ssl", | ||
] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be more idiomatic to use the pinned 0.15 version from crates.io? I.e., =0.15
selector.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, it would. The problem is that it does not work...
scylla
and scylla-proxy
need to point to the same commit id. Otherwise, we get following error thrown by cargo check --tests
:
cargo check --tests
Checking scylla-cpp-driver-rust v0.2.0 (/home/mikolajuzarski/proj/cpp-rust-driver/scylla-rust-wrapper)
error[E0308]: mismatched types
--> src/session.rs:1026:51
|
1026 | RequestReaction::forge_with_error(DbError:...
| _________________---------------------------------_^
| | |
| | arguments to this function are incorrect
1027 | | consistency: Consistency::All,
1028 | | received: 1,
1029 | | required: 1,
1030 | | data_present: false,
1031 | | }),
| |_________________^ expected `DbError`, found a different `DbError`
|
= note: `DbError` and `DbError` have similar names, but are actually distinct types
note: `DbError` is defined in crate `scylla_cql`
--> /home/mikolajuzarski/.cargo/registry/src/index.crates.io-6f17d22bba15001f/scylla-cql-0.4.0/src/frame/response/error.rs:154:1
|
154 | pub enum DbError {
| ^^^^^^^^^^^^^^^^
note: `DbError` is defined in crate `scylla_cql`
--> /home/mikolajuzarski/.cargo/git/checkouts/scylla-rust-driver-8578d68f45edd77e/f59908c/scylla-cql/src/frame/response/error.rs:154:1
|
154 | pub enum DbError {
| ^^^^^^^^^^^^^^^^
= note: perhaps two different versions of crate `scylla_cql` are being used?
note: associated function defined here
--> /home/mikolajuzarski/.cargo/git/checkouts/scylla-rust-driver-8578d68f45edd77e/f59908c/scylla-proxy/src/actions.rs:369:12
|
369 | pub fn forge_with_error(error: DbError) -> Self {
| ^^^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0308`.
error: could not compile `scylla-cpp-driver-rust` (lib test) due to 1 previous error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's enough to convince me. Let's leave this as-is.
The logic will become much more complex once we bump to 0.15. It introduces additional nesting, thus I prefer to extract it to separate functions (since cass_session_execute is already complex enough). I also moved the necessary utility functions to query_result module.
1. CassResult was refactored yet again. Now, we clearly distinguish betwen Rows and non-Rows result. `CassResultKind` and `CassRowsResult` are introduced. `CassRowsResult` holds information about the (for now, eagerly deserialized) rows and metadata. The usages of `CassResult` are adjusted throughout the codebase. 2. CassErrorResult was extended by two variants: - metadata deserialization error - happens during conversion from QueryResult to QueryRowsResult - deserialization error - happens during eager rows deserialization. 3. CassResult construction logic was adjusted to new QueryResult. As mentioned above, some errors can occur during conversion, thus `CassResult::from_result_payload` returns a StdResult now. For now, we eagerly deserialize the rows. This is equivalent to the version before this PR.
v1.1.1 addressed @wprzytula comments, and opened an issue in rust-driver, as pointed out by @Lorak-mmk |
First 4 commits are a bunch of preparations, to reduce the noise during the commit that actually bumps the version.
One of them fixes most of the occurrences of #177. There are still a few places to be addressed, that are non error related.
Bump to 0.15 commit
CassResult was refactored yet again.
Now, we clearly distinguish betwen Rows and non-Rows result.
CassResultKind
andCassRowsResult
are introduced.CassRowsResult
holds information about the (for now, eagerly deserialized) rows and metadata. The usages ofCassResult
are adjusted throughout the codebase.CassErrorResult was transformed to an enum:
to QueryRowsResult
CassResult construction logic was adjusted to new QueryResult.
As mentioned above, some errors can occur during conversion, thus
CassResult::from_result_payload
returns a StdResult now. For now, we eagerly deserialize the rows. This is equivalent to the version before this PR.Pre-review checklist
[ ] I have implemented Rust unit tests for the features/changes introduced.[ ] I have enabled appropriate tests in.github/workflows/build.yml
ingtest_filter
.[ ] I have enabled appropriate tests in.github/workflows/cassandra.yml
ingtest_filter
.