Skip to main content

Module cancel

Module cancel 

Source
Expand description

Query cancellation support.

A CancellationToken is a cheap-to-clone, thread-safe one-shot flag stored on Engine and propagated into every PhysicalOperator / Operator hot loop. Operators call CancellationToken::check at chunk boundaries; if the flag has been set from another thread, check returns QueryCancelled which surfaces to the SQL layer as PostgreSQL SQLSTATE 57014 (query_canceled).

use uqa_core::cancel::{CancellationToken, QueryCancelled};

let tok = CancellationToken::new();
let probe = tok.clone();
tok.cancel();
assert!(probe.is_cancelled());
assert!(matches!(probe.check(), Err(QueryCancelled)));

The token is a Clone-by-Arc handle: every clone speaks to the same underlying flag, so issuing engine.cancel() from one thread is immediately visible to any operator that received a clone of the token before the cancellation.

Structs§

CancellationToken
Thread-safe cancellation token for query execution.
QueryCancelled
Raised when a query is cancelled by user request. Matches PostgreSQL SQLSTATE 57014 (query_canceled); its Display payload stays stable for log processing.

Constants§

SQLSTATE_QUERY_CANCELED
PostgreSQL SQLSTATE for QueryCancelled.