Skip to main content

Module sweep

Module sweep 

Source
Expand description

Removal of throwaway clusters a killed xtask postgres left in RAM.

A SIGKILLed run never drops its TempDir, and /dev/shm is not cleared until reboot. Parallel sessions run clusters on the same machine, so a directory is removed only when no xtask holds its lock: the kernel drops the lock when the holder dies, however it dies.

Constantsยง

GRACE ๐Ÿ”’
Covers the instant between creating a cluster directory and locking it, and directories of builds that took no lock.
LOCK_FILE ๐Ÿ”’
SUFFIX_LEN ๐Ÿ”’
What tempfile appends to the prefix.

Functionsยง

hold ๐Ÿ”’
Locks root for as long as the returned guard lives.
is_cluster_name ๐Ÿ”’
is_stale ๐Ÿ”’
Whether a cluster owned by owner is abandoned: ours, past the grace period, and held by nobody.
is_stale_dir ๐Ÿ”’
is_unlocked ๐Ÿ”’
A directory without a lock file belongs to no live xtask that locks.
stale_clusters ๐Ÿ”’
sweep_stale_clusters ๐Ÿ”’
Removes the abandoned clusters under base and returns those removed.