Skip to main content

wal_maintenance

Function wal_maintenance 

Source
async fn wal_maintenance(cfg: Arc<Config>)
Expand description

Sync the log to the device, and drop the segments every signal has published past.

Truncation is not on the sync period. It costs three readdirs of the block tree — block::wal_watermarks is the whole manifest, re-derived — and what it can reclaim is whole segments, which only become removable once every signal has published past them. At the rate a demo or a quiet service produces, that is minutes apart and four sweeps a second would be hundreds of scans finding nothing; at section 11’s measured 190.6 MiB/s a 64 MiB segment fills in a third of a second, and a minute of them is ~180 files that one readdir retires as cheaply as it retires one. The period is set by how much disk a minute of unreclaimed log is worth, which is the same answer at both ends.