Expand description
The timer that runs didbot_pds::Provisioner::sweep_stale_bounded.
A process that stops between storing an account and activating it — a
SIGKILL, a lost machine, an OOM kill — leaves a row behind that nothing
else comes back for. The sweep removes that row, whatever the account’s
kind, once it is older than DEFAULT_UNFINISHED_AGE, and its hostname
answers 404 from then on the way every name no account holds does. It
also finishes an erasure a crash left half done. Every other account
stays, whatever its age.
§Why a timer rather than a startup pass
Both, really — the first tick fires immediately, so a restart reaps without waiting an interval, and the ticks after it cover a process that stays up for weeks. A startup-only pass would leave a long-lived server accumulating stale rows until somebody restarted it, which is the opposite of what a deployment that must not be restarted wants.
§What one tick costs
Each deletion takes the write lock every request path takes.
SweepSchedule::limit is what keeps a deployment that has accumulated
a backlog from holding it for one tick of thousands of deletions back to
back; what a tick leaves behind is taken by the next one.
Structs§
- Stale
Sweeper - A running sweep, stopped by
StaleSweeper::stopor by dropping it. - Sweep
Schedule - When the sweep runs and how much it takes.
Constants§
- DEFAULT_
SWEEP_ INTERVAL - How often the sweep runs, absent configuration.
- DEFAULT_
SWEEP_ LIMIT - How many rows one tick takes, absent configuration.
- DEFAULT_
UNFINISHED_ AGE - How old a row that never became an account gets before the sweep removes it, absent configuration.
Functions§
- sweep_
once - One tick: sweep, say what it took.