Skip to main content

sweep_temporary_files

Function sweep_temporary_files 

Source
pub async fn sweep_temporary_files(
    store: &ObjectStore,
    dirs: &[String],
    older_than: Duration,
) -> SweepReport
Expand description

Deletes the temporary files in dirs that are older than older_than.

A non-append write goes to a temporary file next to its target and is renamed on close, so a writer that dies in between leaves the file behind with nothing to reclaim it: GC can’t parse the name, and the startup cleanup of ATOMIC_WRITE_DIR doesn’t reach it.

The caller runs this for a region that just became its writable leader, so a file that is old enough belongs to a writer that is gone. Failures are logged and don’t stop the sweep.