prune_history_cohort

Function prune_history_cohort 

Source
pub fn prune_history_cohort(
    db: &Db,
    schema: &RpcStoreSchema,
    pruned_checkpoint_watermark: u64,
    pruned_tx_seq_exclusive: u64,
) -> Result<()>
Expand description

Prune the embedded fullnode’s history cohort up to a floor supplied by the validator’s perpetual-store pruner.

Unlike start_pruner, this is not epoch-driven and not a Service. The embedded deployment deactivates the raw chain-data CFs (transactions, effects, events, objects, checkpoint_*), so it can neither derive a retention floor nor walk effects to find the rows to delete. Instead the perpetual pruner — which owns the raw data — supplies the floor directly, and this prunes exactly the history-cohort CFs that grow without bound:

  • tx_metadata_by_seq — range-deleted over [old_tx_lo, pruned_tx_seq_exclusive).
  • tx_seq_by_digest — point-deleted; the digests are read from tx_metadata_by_seq (the only history CF that still carries them) over the pruned range, before that range is deleted.
  • transaction_bitmap / event_bitmap — evicted by advancing the shared tx_seq floor so their compaction filters drop fully-pruned buckets, then forcing a compaction.

The live cohort and the tiny epochs CF are never pruned.

pruned_checkpoint_watermark is the highest checkpoint the perpetual store has pruned (inclusive); pruned_tx_seq_exclusive is the first still-retained tx_seq. These mirror sui_core::rpc_index::RpcIndexStore::prune’s parameters so the embedded rpc-store and the legacy index prune in lockstep on the same floor. Idempotent: a re-run with the same or a lower floor is a no-op.