Repository navigation
Description
Downstream: PierreZ/paros#202 (checkpoint write amplification) and PierreZ/paros#176. A proposal: it moves the plan #202 keeps in paros into the journal, so it is the owner's call. References: moonpool 9ed1360, paros f2b2502.
Downstream evidence. A journal of operations folded at boot needs periodic compaction: re-emit the folded state, then drop the history before it. moonpool-journal offers only truncate_prefix at segment granularity, so both paros stores built the rest themselves, and both the same way (crates/paros/src/journal/{node,matchmaker}.rs::maybe_checkpoint, journal/plan.rs, the Begin/End/Sealed/Install record kinds in journal/frame.rs):
- the image is appended as one bracketed batch
Begin … End, thentruncate_prefix(begin); - at boot a plan decides where the fold starts: an open bracket at the tail is a crash-cut append and is removed with
truncate_suffix; the newest bracket whose every entry verified is the start; a damaged bracket is skipped while the history before it is still on disk; only when the prefix is gone and no bracket is intact is the oldest trusted record by record; no prefix and no bracket is a lost store.
Every one of those rules is a rule about batches, and the journal already knows its batches: a batch-start flag on every entry and slot, Recovery::ambiguous_batch for the last one, JournalAtlas::starts_batch. paros re-derives the same boundaries from payload kinds. The trigger is also where #202's write amplification lives: checkpoint_after is a count of entries, so a whole image is re-emitted every few entries once it is large.
Smallest API.
impl<P: StorageProvider> Journal<P> {
/// Append `records` as one batch flagged as a checkpoint: once durable it
/// supersedes every entry before it. Returns the indexes they got.
pub async fn append_checkpoint(&mut self, records: &[Record<'_>]) -> Result<Range<u64>, JournalError>;
}
pub struct Recovery {
/// The newest intact checkpoint batch, if any: where a replay starts.
pub checkpoint: Option<Range<u64>>,
…
}- A
checkpointflag beside the batch-start flag in slot and entry, so the far identifier alone says "this entry opens a checkpoint". open: a checkpoint batch cut by a crash is the last batch and is handled as today; the newest checkpoint whose entries all verified is reported; a damaged one is reported inRecovery::corruptlike any damaged batch, andcheckpointnames the newest intact one before it, orNone.read_rangeis unchanged; a caller replayscheckpoint.start..next_index()and prepends nothing.- Prefix drop stays the caller's
truncate_prefix(checkpoint.start), so a crash between the two is harmless (the old history is still there). With moonpool-journal:truncate_prefixunlinks before the new start is durable; a segment gap deletes the live log or panics on open #301 the start is durable before the unlinks. - The trigger stays the caller's (paros amortizes it to
k ×the image size); the journal only exposesnext_index() - start_index()and the checkpoint's length.
paros then deletes plan.rs, the Begin/End/Sealed/Install kinds and the matchmaker twin, and both stores share one implementation. The sim example's writer can checkpoint too, which puts the fold-from-checkpoint-equals-fold-from-history oracle in moonpool, where every journal user needs it.
Determinism. No new draws.
Acceptance (crates/moonpool-journal/tests/journal.rs):
- append, checkpoint, append, crash loop under the
Papermodel: a replay fromRecovery::checkpointequals the replay from the start, for every boot; - damage the newest checkpoint's entries through the atlas:
checkpointnames the previous intact one, orNonewith the whole history still live; - crash mid-checkpoint: it is the last batch, truncated or kept per
AmbiguousTail, andcheckpointnames the one before it.
Activity
feat(moonpool-journal): checkpoint batches, a batch that supersedes t…
feat(moonpool-journal): checkpoint batches, a batch that supersedes t…
feat(moonpool-journal): checkpoint batches, a batch that supersedes t…
PierreZ commentedon Oct 6, 2026
Superseded by #306. On 2026-10-06 the owner decided that checkpoints belong to the caller, not the journal: moonpool-journal's API is append, read and truncate. Nothing uses
append_checkpoint, so #306 removes it and the checkpoint count from the format.Generated by Claude Code