Skip to main content

spawn_region_sweep

Function spawn_region_sweep 

Source
pub(crate) fn spawn_region_sweep(
    access_layer: AccessLayerRef,
    region_id: RegionId,
    older_than: Duration,
    sweep_limiter: Option<Arc<Semaphore>>,
)
Expand description

Sweeps the temporary files of region_id in the background.

The caller is on the path that makes the region its writable leader, so reclaiming leftovers must not slow it down or fail it: everything happens in a spawned task that only logs.

older_than is the margin the caller takes from GC’s unknown_file_lingering_time, which guards the same thing: a file this old is not one a writer is still filling.

A sweep waits for a permit of sweep_limiter, so a None means the datanode allows no concurrent GC job and there is no sweep.