Skip to content

moonpool-journal: Journal::open must make every created ancestor directory durable #293

Closed

Description

@PierreZ

Downstream: PierreZ/paros#176 (run every paros role on moonpool-journal stores under at least the in-memory world's chaos) and PierreZ/paros#202. References: moonpool 9ed1360, paros 29b23e3.

Downstream evidence. Journal::open calls create_dir_all(dir) and then sync_dir(parent_of(dir)), which
syncs only the immediate parent (crates/moonpool-journal/src/journal.rs:193-194, parent_of at :165).

paros opens nested journals:

  • the simulation uses paros/journals/<tenant>/<journal> (crates/paros-sim/src/process.rs:1112);
  • production (parosd) uses data_dir/journals/... (crates/parosd/src/stores.rs:43,107).

Per moonpool's own namespace model, a child does not survive a crash when its parent's name was never made
durable. So a power loss after the first open can drop paros/, journals/ or <tenant>/. The journal, its
meta (the promise and the format marker) and every accept then vanish, and the node boots amnesiac. paros refuses
to boot such a node (BootRefusal::Amnesia), but that turns a power loss into a permanently lost acceptor. This is
a production durability bug, not only a simulation one.

Smallest change. In open, sync every directory that create_dir_all created, from the deepest new one up
to the first one that already existed: sync each new directory's parent. Alternatively, document that the caller
must pre-create a durable dir, and have open refuse a non-durable path. The fix is preferred.

Determinism. No new draws beyond the sync_dir operations themselves.

Acceptance. A test in crates/moonpool-journal/tests/journal.rs:

  • open a/b/c/wal on a fresh disk with unsynced_dir_entry_loss_probability = 1.0;
  • append and sync, then simulate_crash_for_process;
  • reopen: the entry must be there.

Today it should be red.

Activity

  1. added a commit that references this issue on Oct 6, 2026
    91e3a52
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