mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-10-17 01:12:27 +00:00
Without an explicit `SET statement_timeout`, HTTP SQL requests had no query-level timeout, so timed out EXPLAIN ANALYZE VERBOSE statements were never force-recorded to slow queries. - `src/servers/src/http/timeout.rs`: `DynamicTimeoutLayer` now inserts the resolved request deadline (honoring the `x-greptime-timeout` header override) into request extensions as `RequestDeadline`, and `ResponseFuture::poll` polls the inner future before the sleep so a response completing on the expiring tick (e.g. a query timeout error with diagnostics) wins over a bare timeout response. - `src/session/src/lib.rs`, `src/session/src/context.rs`: add `request_timeout` to the query context, injected by the protocol layer. - `src/servers/src/http/handler.rs`: the `/v1/sql` and `/v1/sql/analyze/stream` handlers propagate the remaining request budget into `QueryContext::request_timeout`. - `src/frontend/src/instance.rs`: `derive_timeout` and `derive_timeout_for_plan` use the tighter of the session statement timeout and the HTTP request timeout for the `HttpSql` channel. Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>