-
Notifications
You must be signed in to change notification settings - Fork 108
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
errors: replace RowsParseError
and narrow the return types after deserialization refactor
#1117
Commits on Nov 13, 2024
-
f_errors: introduce PreparedMetadataParseError
Previously, the `ResultMetadataParseError` error type was common for both Result and Prepared metadata. It does not make much sense, though. Obviously, some of the error variants are shared between these two types, but not all of them.
Configuration menu - View commit details
-
Copy full SHA for 52f0103 - Browse repository at this point
Copy the full SHA 52f0103View commit details -
f_errors: RawRowsAndPagingStateResponseParseError
An error that occurred during initial deserialization of `RESULT:Rows` response. Since the deserialization of rows is lazy, we initially only need to deserialize: - result metadata flags - column count (result metadata) - paging state response We ultimately want to get rid of current `RowsParseError` since its usage is abused in a lot of places throughout the scylla crate. We start by narrowing the return type of `deser_rows()` function.
Configuration menu - View commit details
-
Copy full SHA for 962ae50 - Browse repository at this point
Copy the full SHA 962ae50View commit details -
errors: IntoLegacyQueryResultError
An error returned by `QueryResult::into_legacy_result()`. Previously, the `QueryResult::into_legacy_result()` would return `RowsParseError`. Note that `RowsParseError` is (for now) included in new error type. This is because `RawMetadataAndRawRows::deserialize_metadata()` still returns `RowsParseError`. This will be adjusted in following commit once we introduce a new error type for `deserialize_metadata` method.
Configuration menu - View commit details
-
Copy full SHA for 256705d - Browse repository at this point
Copy the full SHA 256705dView commit details -
metadata: remove column count mismath check
This could only happen if there is a serious bug in the driver. `deser_col_specs_generic` takes `column_count` as argument and deserializes the col specs `column_count` times in a loop. Thus, this check does not make sense.
Configuration menu - View commit details
-
Copy full SHA for 9b625ef - Browse repository at this point
Copy the full SHA 9b625efView commit details -
metadata: return ResultMetadataAndRowsCountParseError in deserialize_…
…metadata Adjusted the error returned by `RawMetadataAndRawRows::deserialize_metadata()`. Again, to narrow the return error type of following methods: - RawMetadataAndRawRows::deserialize_metadata() - QueryResult::into_rows_result() Adjusted the callers of `QueryResult::into_rows_result` in topology.rs and session.rs and added corresponding variants for `TracingProtocolError` and `SchemaVersionFetchError` Temporarily, we need to introduce a corresponding variant to `QueryError` and `NewSessionError`. This is because internal API makes use of `into_rows_result()` in multiple places. The callers will be adjusted later in this PR, allowing us to remove the variant from `Query/NSError`.
Configuration menu - View commit details
-
Copy full SHA for b2d60b3 - Browse repository at this point
Copy the full SHA b2d60b3View commit details -
Configuration menu - View commit details
-
Copy full SHA for e0e27c0 - Browse repository at this point
Copy the full SHA e0e27c0View commit details -
NextRowError -> LegacyNextRowError
We will re-introduce `NewRowError` as an error type returned by current async iterator API.
Configuration menu - View commit details
-
Copy full SHA for 6a137fd - Browse repository at this point
Copy the full SHA 6a137fdView commit details -
errors: NextPageError and NextRowError
These are errors returned by async iterator API. Ultimately, we want them to be independent types returned by the public API. However, as of now, NextRowError needs to be wrapped in QueryError - to address that, further changes to iter API need to applied. These, however, are not in a scope of this PR. This partial change of iter API is introduced because we want to get rid of RowsParseError dependency in this module.
Configuration menu - View commit details
-
Copy full SHA for 4717ac1 - Browse repository at this point
Copy the full SHA 4717ac1View commit details -
errors: remove QueryError::ResultMetadataParseError variant
It's not used anymore after adjustments to iter API. It was introduced temporarily earlier, and can now be safely removed.
Configuration menu - View commit details
-
Copy full SHA for c2a700f - Browse repository at this point
Copy the full SHA c2a700fView commit details -
legacy: adjust LegacyNextRowError
So we do not depend on RowsParseError anymore, new variant is introduced that represents a row deserialization failure.
Configuration menu - View commit details
-
Copy full SHA for 827dcb5 - Browse repository at this point
Copy the full SHA 827dcb5View commit details -
Configuration menu - View commit details
-
Copy full SHA for e9c446c - Browse repository at this point
Copy the full SHA e9c446cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9f87616 - Browse repository at this point
Copy the full SHA 9f87616View commit details -
qr: flatten return type of QueryResult::into_rows_result to Result<...>
Instead of returning Result<Option<_>, _>, we will simply return a Result. IntoRowsResultError is introduced specifically for this method. Adjusted all of usages of this API. Most of the changes were simply to replace `unwrap().unwrap()` to single `unwrap()`. There are 4 places that require more focus during review: - print_result() method in `cql-sh.rs` example. - changes to SchemaVersionFetchError (and corresponding code in connection.rs) - changes to TracingProtocolError (and corresponding code in session.rs) - adjustment to `scylla_supports_tablets` in test_utils.rs
Configuration menu - View commit details
-
Copy full SHA for ed4a427 - Browse repository at this point
Copy the full SHA ed4a427View commit details -
qr: return self in into_rows_result if response is not Rows
Co-authored-by: Karol Baryła <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 2054163 - Browse repository at this point
Copy the full SHA 2054163View commit details