Cairo query cancellation: does a hard timeout during shuffle guarantee intermediate state cleanup?
0 reputation · 15 Nov 2021, 11:14 UTC
0 reputation · 15 Nov 2021, 11:14 UTC
In Cairo’s distributed execution model, a cancellation request is propagated from the coordinator to all worker nodes via a de‑registration signal. While active scans typically stop immediately, long‑running transformation stages may continue until a checkpoint is reached. When a hard timeout is enforced by a client‑side or gateway configuration, it is unclear whether the execution engine guarantees the immediate release of intermediate shuffle data.
Given that timeouts are often set in application drivers or server‑side parameters, the consistency of resource cleanup during a mid‑shuffle timeout remains an open question. This uncertainty affects memory pressure on worker nodes and the predictability of query termination.
What is the documented behavior of Cairo when a hard timeout occurs mid‑shuffle? Is there an execution‑engine parameter that forces immediate cleanup of intermediate state, or does cleanup only happen at the next checkpoint? How does the current configuration transition from session‑based to query‑level timeouts influence this behavior?
35775 reputation · 15 Nov 2021, 12:51 UTC
No. A hard timeout during a shuffle stage in Cairo (QuestDB’s distributed SQL engine) is not documented to guarantee immediate release of intermediate shuffle state on worker nodes. Cancellation is cooperative: the coordinator signals workers, but a long-running transformation typically continues until the next checkpoint or batch boundary before its execution context is torn down and intermediate buffers are released.
Confirmed: Cairo does not publish a hard guarantee that a mid-shuffle timeout frees intermediate state at the instant the timeout fires. Client-side or gateway timeouts may abandon the query from the caller’s perspective while server-side execution continues until the engine notices the cancellation signal.
Likely, not confirmed: intermediate shuffle memory is owned by the per-query execution context on each worker and is released when that context closes. Under a timeout, that close may be deferred to the next checkpoint or query end rather than occurring at the timeout instant. Spilled shuffle artifacts, if any, may also persist until cleanup runs.
Timeout handling has moved from session/driver-level controls toward query-level and server-side parameters across releases. Specific parameter names are version-sensitive and cannot be confirmed from memory, so do not assume keys without checking the documentation for your deployed version. No documented execution-engine parameter is known to force immediate mid-stage cleanup of shuffle state.
Which QuestDB or Cairo version is deployed? Exact cancellation semantics, configuration keys, and cleanup timing vary by version, and this detail changes which documentation and parameters apply.
Treat this as a conservative draft for human review until the deployed version’s documentation and a controlled cancellation test confirm the behavior.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.