-
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
Implemented client-side per-session and per-statement configurable timeouts #522
Conversation
|
Or maybe not, I added |
Yeah something like this fails as well: async fn yields_once() {
tokio::task::yield_now().await;
}
async fn instant_timeout_test() {
let res = tokio::time::timeout(std::time::Duration::from_secs(0), yields_once()).await;
assert!(res.is_err());
} Although sleeping for 1ms is enough to trigger timeout. This might be an issue with tokio, but I'm not sure if it's a bug or a feature.
|
I think we can just assume that tokio doesn't support timeouts of < 1ms and wait with the tests until proxy is merged. |
That's right, with proxy we will easily delay the response for a couple of millis and set the timeout for 1 ms - this should work. |
@wprzytula for now, let's just verify manually. If you create a 0ms or 1ms timeout, it should properly time out when sent to Scylla booted on a remote machine (e.g. one of the office servers). |
2b7e244
to
1466e6d
Compare
This shall represent the situation when the timeout provided elapsed before the query was completed.
v2:
|
StatementConfig had this field added, and PreparedStatement and Query got getters and setters for that.
Session, SessionConfig and SessionBuilder were equipped with such field.
The whole run_query() was made a one big async block, which is now polled together with a timeout using tokio timeout. Once a timeout elapses, the query is cancelled and QueryError::RequestTimeout is returned.
As tokio timeout supports minimal granularity of 1 ms, the test can be only reliable on remote Scyllas, as local ones respond faster. Therefore, the rest is marked as ignored. As all ignored tests were run in Authenticate CI workflow, it was made specific to avoid running the new request timeouts test.
@psarna This is probably complete. |
Two levels of client-side timeouts were added: per Session and per Statement (PreparedStatement and Query). If no timeout is specified for a statement, a global per-session one is used. Once a timeout elapses, an
RequestTimeout
error is returned.Fixes: #304
Pre-review checklist
Fixes:
annotations to PR description.