-
Notifications
You must be signed in to change notification settings - Fork 111
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: iterator API errors refactor #1160
Draft
muzarski
wants to merge
31
commits into
scylladb:main
Choose a base branch
from
muzarski:iterator-errors-refactor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains 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
The name is more fitting, because this function is generic over CQL request kinds. Query is a name for a specific CQL request. Updated the names of variables, and some types that are directly used by this function. Adjusted the documentation of the function.
Again, query would suggest that we want to execute a CQL QUERY request. New name also clearly tells the user that provided closure can be potentially executed multiple (based on plan and retry session). Documented the function. Renamed ExecuteQueryContext -> ExecuteRequestContext
This is to prevent some unwanted implicit conversions.
This is then converted to `ProtocolError` in UserRequestError::into_query_error().
Adjusted, so the callers now convert QueryResponse to QueryResult.
Notice that into_query_result returns QueryError, and not UserRequestError (as into_non_error_query_response). It's then converted to QueryResult later. This change is required to prepare for further changes (i.e. narrowing the return type of errors passed to LBP, retry policy etc.).
In the next commit, I want to narrow the error type of `do_query` closure to UserRequestError. `do_query` closure for `query` method serializes the values after preparation.
Thanks to that, we will be able to pass the narrower error type to LBP::on_query_failure. Currently, QueryError is passed, but not all of its variants could even be constructed at this stage.
This error will be passed to LoadBalancingPolicy::on_query_failure and to RetrySession::decide_should_retry.
This narrows the error type passed to this function. Thanks to that, we do not have to match against the variants that could not ever be passed there (which was the case for QueryError).
Request is a more fitting name here.
Same as for LBP::on_query_failure, it narrows the type.
Introduced new error type and adjusted session.rs, speculative_execution module and iterator module to this type.
Introduced: - RequestTimeout(std::time::Duration) - for requests that timed out with provided client timeout - SchemaAgreementTimeout(std::time::Duration) - for schema agreement timeouts
This represents either a request failure, or a request timeout. It's created to narrow the type passed to history listener.
- `log_attempt_error` will now accept an error representing a single request failure - namely `UserRequestError` - `log_query_error` will now accept an error representing a timeoutable request run failure. Compared to `UserRequestError`, it additionally can contain information about an empty plan error, timeout error etc.
I marked `PartitionKeyError` as non_exhaustive. Narrowed the return type of remaining funtions that returned `QueryError` to `PartitionKeyError`. Added an explicit conversion function PartitionKeyError -> QueryError.
The `RequestTimeout` can only be constructed in analogous session.rs code. Thus, to narrow the error type (later in this PR) even more in iterator API, we convert it safely back to RetriableRequestError (after it was passed to HistoryListener).
Narrowed the error types in multiple places in internal API of iterator module. Now the error type we manipulate on mainly is `NextPageError` (instead of `QueryError`). I did not change the return type of public methods yet. I want to do it in a separate commit.
See the following report for details: cargo semver-checks output
|
github-actions
bot
added
the
semver-checks-breaking
cargo-semver-checks reports that this PR introduces breaking API changes
label
Dec 27, 2024
muzarski
force-pushed
the
iterator-errors-refactor
branch
from
December 27, 2024 07:31
4a964ef
to
c4b17fe
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
semver-checks-breaking
cargo-semver-checks reports that this PR introduces breaking API changes
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.
Pre-review checklist
./docs/source/
.Fixes:
annotations to PR description.