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
tempfileappends to the prefix.
Functionsยง
- hold ๐
- Locks
rootfor as long as the returned guard lives. - is_
cluster_ ๐name - is_
stale ๐ - Whether a cluster owned by
owneris 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
baseand returns those removed.