Skip to main content

Module peek_offload

Module peek_offload 

Source
Expand description

Driving an index peekโ€™s walk away from the timely worker that owns it.

An offloaded walk steps its scan on the blocking pool, so neither the timely worker nor an async one carries it. It returns to its async task only to write a batch or to answer, and checks for cancellation every yield_granularity positions in between. The scan and the permit that admitted it travel together, and every way the walk ends, a panic included, drops the two together.

The permit bounds the walks that run, not the walks that exist: an unadmitted walk queues holding its scan, which pins the batches its cursors were opened over, so retained memory grows with offloaded walks rather than running ones.

This driver performs the only IO, so the scan stays free of async colouring. A walk whose rows outgrow an inline answer hands over a full batch, the driver writes it to the peek stash, and the walk carries on from where it stopped.

Structsยง

Bound ๐Ÿ”’
How many permits the semaphore has issued, and how many it should have.
OffloadConfig ๐Ÿ”’
The parameters an offloaded walk reads, each as a handle rather than a value.
OffloadedPeek
An index peek whose walk is running away from the worker that owns it.
PeekPermits
The bound on how many offloaded peek walks run at once.
WalkPermit ๐Ÿ”’
The permit an offloaded walk holds while it runs, released on drop.
WalkState ๐Ÿ”’
What an offloaded walk carries between its async task and the blocking pool.

Functionsยง

stashed_answer ๐Ÿ”’
Writes tail, the rows the walk still held when it ended, to upload, finishes it, and builds the response that names the stashed batch.