-
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: narrow error types accepted by HistoryListener
#1159
Open
muzarski
wants to merge
9
commits into
scylladb:main
Choose a base branch
from
muzarski:history-listener-errors
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.
+505
−354
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
github-actions
bot
added
the
semver-checks-breaking
cargo-semver-checks reports that this PR introduces breaking API changes
label
Dec 24, 2024
See the following report for details: cargo semver-checks output
|
muzarski
force-pushed
the
history-listener-errors
branch
from
December 24, 2024 07:13
6a52f4d
to
71539ec
Compare
muzarski
requested review from
Lorak-mmk and
wprzytula
and removed request for
Lorak-mmk
December 27, 2024 05:15
wprzytula
reviewed
Dec 29, 2024
muzarski
force-pushed
the
history-listener-errors
branch
from
December 30, 2024 12:18
71539ec
to
d7c8c96
Compare
v2:
|
wprzytula
previously approved these changes
Dec 31, 2024
7 tasks
muzarski
force-pushed
the
history-listener-errors
branch
from
January 13, 2025 11:09
d7c8c96
to
4311591
Compare
Rebased on latest #1157 (with modules refactor) |
muzarski
force-pushed
the
history-listener-errors
branch
4 times, most recently
from
January 15, 2025 14:45
bba3986
to
4088051
Compare
muzarski
force-pushed
the
history-listener-errors
branch
from
January 15, 2025 17:59
4088051
to
eeef129
Compare
v2.1: added a regression test for the scenario where the driver would unnecessarily wait for |
Previously, it would return `Option<Result<_, _>>`. This option was meant to represent an empty plan. This additional layer was unnecessary and introduced additional noise. In addition, notice that following part in speculative_execution::execute(): ``` res = async_tasks.select_next_some() => { if let Some(r) = res { if !can_be_ignored(&r) { return r; } else { last_error = Some(r) } } if async_tasks.is_empty() && retries_remaining == 0 { return last_error.unwrap_or({ Err(EMPTY_PLAN_ERROR) }); } } ``` would unnecessarily try to run remaining retries if `None` was returned. This means, we would do the retries (and sleep in between retries) with empty plan. Now, the empty plan error is returned instead of option, and can be handled accordinly in `can_be_ignoed` (we decide not to ignore such error - no point in retrying on another node - there is no other node). I also added a regression test case. The test's timeout is set to 5s. What we try to do, is to run a request with speculative execution policy (6s retry interval) and a LBP that always returns an empty plan. The expected behaviour is that the test completes in less than 5s (no timeout occurs). Otherwise, this would imply that driver was waiting 6s for speculative retry (which was the case before this commit). I've run the test before the change, and it indeed fails.
Introduced "new" error type and adjusted session.rs, speculative_execution module and iterator module to this type. This error represents a definite request failure (after potential retries).
Introduced: - RequestTimeout(std::time::Duration) - for requests that timed out with provided client timeout - SchemaAgreementTimeout(std::time::Duration) - for schema agreement timeouts
RequestError will be passed to HistoryListener when the request either fails or times out.
- `log_attempt_error` will now accept an error representing a single request failure - namely `RequestAttemptError` - `log_query_error` will now accept RequestError, which represents a definite request failure. This is a superset of RequestAttemptError, as it also contains information about potential timeout, empty plan etc.
muzarski
force-pushed
the
history-listener-errors
branch
from
January 16, 2025 14:06
eeef129
to
0f15e44
Compare
Rebased on main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
API-stability
Part of the effort to stabilize the API
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.
Ref: #519
New error types and variants
RequestError (reintroduced)
Error type returned by
run_request_spectulative_fiber
. It represents either a definite request failure - last attempt error, connection pool error, or an empty plan error.Replaced QueryError::RequestTimeout
This error variant was not good for 2 reasons:
I decoupled this variant into two separate variants that provide more context.
RequestError::RequestTimeout
After refactoring the timeout errors in
QueryError
, I added the corresponding variant toRequestError
(one introduced in this PR) as well.HistoryListener
Narrowed error types passed to log_query_error and log_attempt_error.
log_query_error
(or ratherlog_request_error
after rename) now acceptsRequestError
.log_attempt_error
now acceptsRequestAttemptError
(representing an error of a single attempt).Replaced "query" mentions with "request"
I did the replacement in trait methods, docstrings, tests etc. I tried to break the changes into multiple commits.
Pre-review checklist
[ ] I added relevant tests for new features and bug fixes.[ ] I have adjusted the documentation in./docs/source/
.Fixes:
annotations to PR description.