mirror of
https://github.com/lancedb/lancedb.git
synced 2026-12-03 07:45:17 +00:00
test(rust): isolate deferred SQL read timeout from submission latency (#5372)
The macOS 15 Rust job on `main` (`c3f005f7`) failed in `sql_read_timeout_is_per_query_and_cancels_deferred_execution`. The query's 100 ms read timeout expired during Flight submission with `SQL query submission timed out`, before result consumption began. [Failing job](https://github.com/lancedb/lancedb/actions/runs/46756444853/job/143033346699) Use a blocking task to keep paused Tokio time fixed while the real loopback submission completes. Resume the clock before reading results so the test still checks the 100 ms result timeout, deferred Flight cancellation, and a successful second query with the connection defaults. [Related reader fixture](https://github.com/lancedb/lancedb/pull/5000) On Linux, a temporary 300 ms wall-clock delay in the initial Flight `DoGet` reproduced the submission timeout on the original path. The repaired fixture passed the same result-read and cancellation assertions with the delay in place.
This commit is contained in:
@@ -5668,7 +5668,19 @@ async fn sql_read_timeout_is_per_query_and_cancels_deferred_execution() {
|
||||
let (client, _shutdown) = start_sql_service(service, ClientConfig::default()).await;
|
||||
let mut request = ExecuteQueryRequest::new("SELECT slow get");
|
||||
request.options.read_timeout = Some(Duration::from_millis(100));
|
||||
let query = client.execute(request).await.unwrap();
|
||||
|
||||
// A blocking task keeps Tokio's paused clock from auto-advancing while
|
||||
// Flight submission waits on loopback I/O.
|
||||
tokio::time::pause();
|
||||
let submission_client = client.clone();
|
||||
let query = tokio::task::spawn_blocking(move || {
|
||||
tokio::runtime::Handle::current().block_on(submission_client.execute(request))
|
||||
})
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
tokio::time::resume();
|
||||
|
||||
let error = collect_result(&query).await.unwrap_err();
|
||||
assert!(
|
||||
error.to_string().contains("SQL result read timed out"),
|
||||
|
||||
Reference in New Issue
Block a user