Skip to content

moonpool-journal: expose where an entry lives on disk, for targeted fault injection #289

Closed

Description

@PierreZ

Why

paros now runs every simulated node and matchmaker on moonpool-journal (PierreZ/paros#176). Its fault injector damages specific journal entries at boot: rot one accepted record, garble its identifier too, zero it (a lost write), overwrite its header (a misdirected write), tear the last batch. It must aim at an entry by its far identifier (index, epoch, tag).

The journal does not say where an entry lives. So the harness (crates/paros-sim/src/world/journal_files.rs) parses the on-disk format documented in the crate docs: segment names, the slot table at 8 KiB, the slot and entry header fields. That works, but it duplicates the layout outside the crate. It also breaks silently if the format version changes.

Smallest API asked for

A read-only locator, behind a feature or on Journal itself:

pub struct EntryLocation {
    pub path: String,          // the segment file
    pub slot: Range<u64>,      // the identifier's bytes in that file
    pub entry: Range<u64>,     // header + payload bytes
    pub id: EntryId,
    pub batch_start: bool,
}

impl<P: StorageProvider> Journal<P> {
    /// Where every live entry is on disk.
    pub fn locations(&self) -> Vec<EntryLocation>;
}

Or a free function that scans a closed journal directory without opening (and so without repairing) it. A closed scan is what an injector wants at boot: it damages the bytes before the store's own open reads them.

Determinism

Read-only, no randomness, no clock. Same I/O through the provider as a normal open.

Acceptance

  • The locator agrees with Recovery on which index a damaged entry is reported at.
  • A test damages each location's entry range and gets the entry in Recovery::corrupt. Damaging both ranges gets a DoubleFault.
  • paros deletes its own parser once the pin advances.

Also worth deciding (separate, smaller)

scan::decide refuses (bad entry, bad slot) as a double fault anywhere, the last batch included. Under the default crash model (a sector kept old or new) a 64-byte slot never tears, so this does not happen today. With shorn_write_probability or a garbage fill it could: a crash during the last batch's unsynced write would then leave a node that never boots again, although nothing was acknowledged. A torn identifier in the last batch could be treated as the end of the log.

Activity

  1. PierreZ commented on Oct 5, 2026

    @PierreZ
    OwnerAuthor

    The "also worth deciding" note (a torn identifier in the last batch refused as a DoubleFault) was not part of PR #291. It now has its own issue, together with the reserved-slot rule it depends on: #300.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions