Skip to main content

needs_size_check

Function needs_size_check 

Source
pub fn needs_size_check(
    last_measured_bytes: usize,
    delta_bytes_since: usize,
) -> bool
Expand description

Whether the document is close enough to the warning threshold that its true compacted size has to be measured before the next commit is accepted.

Measuring means encoding a shallow snapshot, which is far too expensive to do on every commit. Estimating from the last real measurement plus the bytes written since it is always an over-estimate of the compacted size (history compacts, it does not expand), so a document can never cross the cap without this answering true first. That is the property that keeps the check from lagging the truth by more than a single flush.