Skip to main content

SETTLED

Constant SETTLED 

Source
const SETTLED: Duration;
Expand description

How old a file’s mtime must be before a verification of it is worth remembering.

Without this the cache has a real hole, and it is not hypothetical — it is corrupt_body_is_caught_not_returned_as_data in lib.rs, which opens a table, flips one bit of the body, and reopens expecting BadChecksum. The flip does not change the length, so if both writes land inside one mtime tick the identity is unchanged and a corrupt block reads as already verified.

A settle window closes it by construction rather than by hoping the clock is fine-grained. An entry is only recorded once the file has been untouched for longer than any filesystem’s mtime granularity, so a subsequent write is necessarily in a later tick and necessarily misses. Two seconds is rsync’s quick-check window and for the same reason: 1 s is the worst granularity in the wild, and doubling it costs nothing here. A published block is renamed into place and never written again, so by the second query that reads it, it is hours old — the window only ever excludes a block being written right now, which is the one that should be re-read anyway.