Skip to main content

Module pruning

Module pruning 

Source
Expand description

Post-cycle responsibility pruning (Section 11).

On NeighborSyncCycleComplete: prune stored records and PaidForList entries that have been continuously out of range for at least PRUNE_HYSTERESIS_DURATION.

§Pressure-gated retention (ADR-0028)

Being a candidate makes a stored record eligible to be erased, never due. While the partition holding the record store has room, every candidate is retained and served, and no prune-confirmation audit is sent: none could lead to a deletion. Under disk pressure (see crate::replication::retention) candidates are audited and erased farthest from this node first, records whose proofs failed in the current spell of pressure last, and the pass measures free space again before each deletion and stops once the pressure has ended.

PaidForList entries are not part of this: a retained record keeps the entry that authorises its repair. They are evicted only once the list passes paid_list_evict_start_entries, whatever the disk, to make room for new keys. Entries far outside this node’s range go first, and neither entries near it nor those of records it still stores go at all.

§Stored-record prune lifecycle

Each stored record is classified per pass against the current local routing table:

  • InRange: self is within the storage-retention width (close_group_size + STORAGE_ADMISSION_MARGIN, 9 at production parameters); any out-of-range state is cleared once bootstrap has drained. Until then the routing table may still be filling, and a node that knows few peers looks in range for everything.
  • HysteresisPending: outside the retention width, but not yet for the full PRUNE_HYSTERESIS_DURATION. The first-seen timestamp is recorded immediately on leaving range — a retained commitment vetoes DELETION, never the start of this clock. The timestamp is saved after each pass, so a restart doesn’t restart the clock (see replication::out_of_range_clocks).
  • Candidate: continuously outside the retention width for the full hysteresis. Candidacy is unconditional: it never depends on repair-hint proofs, bootstrap state, audit budget, or prior neighbor-sync contact.
  • HeldByCommitment / BootstrapDeferred / Unauditable: candidate deferrals. They defer deletion, but never remove candidacy or restart the hysteresis clock. The request/candidate budget is a separate, later deferral applied after classification (not a disposition variant) so whole proof sets are either scheduled or deferred as a unit.
  • AuditFailed: an audited candidate whose current strict close group returned fewer than the required positive possession proofs (prune_proofs_needed, 6 of 7 at production parameters). The record and its first-seen timestamp are retained and retried on later passes.
  • Pruned: deleted after immediately re-passing the applicable checks against the then-current routing table.

Distance alone never authorises deletion. However far outside the group self has moved, a candidate is deleted only once the current strict close group proves possession: a local routing-table view says which peers are closer, not that any of them holds the bytes.

Prune-confirmation audits challenge the CURRENT strict closest close_group_size peers to the key, taken directly from the local routing table — never filtered through RepairProofs or prior neighbor-sync hints. The repair-proof maturity gate remains a prerequisite for the responsible-chunk storage audit (see audit_tick_with_repair_proofs), which is a different mechanism with a different threat model.

Structs§

PrunePassContext
Shared dependencies and switches for one prune pass.
PruneResult
Summary of a prune pass.

Functions§

run_prune_pass_with_context
Execute one prune pass (see the module docs for the record lifecycle).