Files
greptimedb/src
Lei, HUANG 0196baa11c feat: derive query timeout from HTTP request timeout
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>
2026-08-19 22:15:33 +08:00
..
2026-08-12 08:15:12 +00:00