Repository navigation
id(world): selectable journal ack modes — sync default, batched, async (#557) - #12746
Merged
Merged
Conversation
#557) Implements Drewry's 2026-11-22 decision: async/batched input acknowledgement as selectable modes, not a default flip. - JournalAckMode (world/journal.rs): Sync (default, the original durability-before-ack contract, byte-for-byte), Batched (one sync per JOURNAL_ACK_BATCH_SIZE=64 appends; loss bounded to the unsynced tail), Async (no sync on the ack path; durability only at sync points). The tradeoff text for all three levers — ack timing, the fdatasync primitive, and the measured-and-rejected syncfs/fdatasync group commit — lives on the enum where the modes are defined. - WorldJournal gains ack_mode() and sync() with Sync/no-op defaults, so every existing journal keeps the old contract. - FileJournal implements the modes: appends write through append_write, unsynced_appends() exposes exactly the acknowledged history an OS crash could still lose, and compaction/transactions remain full sync points in every mode. The journal format and recovery scan are unchanged, so a mode switch on reopen replays identically. - Config surface: WorldLimits::journal_ack_mode (default Sync), plumbed through open_world to FileJournal::open_with_ack_mode. - Design record per the pkgs/id documentation protocol: doc/2026-11-23T00-24-00Z_design_journal_ack_modes. - Tests: default-mode byte-for-byte disk image, async ack-before-sync + sync-point flush, batched sync exactly at the batch bound across append/append_batch, cross-mode reopen replay identity, compaction as a sync point, WorldLimits default. No new dependencies. No performance claim: the unloaded laptop re-run remains the outstanding #557 baseline.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Open
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements Drewry's 2026-11-22 decision on #557 (comment 7087900634): async/batched input acknowledgement as selectable modes — not a default flip. The documented durability contract stays the default.
Design
Design record (pkgs/id documentation protocol, written before the code):
doc/2026-11-23T00-24-00Z_design_journal_ack_modes/.JournalAckMode(world/journal.rs, re-exported fromcrate::world):Sync(default — acknowledged ⇒ durable, byte-for-byte the old behaviour),Batched(write on ack, one sync perJOURNAL_ACK_BATCH_SIZE= 64 appends; loss bounded to the unsynced tail),Async(no sync on the ack path; durability only at sync points). The tradeoff text for all three durability levers sits on the enum where the modes are defined: ack timing (this change), thefdatasyncprimitive (unchanged), and group commit —syncfssharing measured-and-rejected on three filesystems (runner ~2.5×, btrfs ~1.26×, laptop ext4 1.07× median / 1.44× p99 vsfdatasync) andfdatasyncgroup commit measured at zero queueing headroom. The fsync/syncfs axis is discussed in the same pass, per the decision.WorldJournalgainsack_mode()andsync()with Sync/no-op defaults — every existing journal (including all test doubles) keeps the old contract without code changes.FileJournal: appends route throughappend_writeper mode;unsynced_appends()exposes exactly the acknowledged history an OS crash could still lose (always 0 in Sync). Transactions and compaction remain full sync points in every mode. The journal format and recovery scan are untouched, so reopening under a different mode replays identically — a mode changes what future acks promise, never what existing bytes mean.WorldLimits::journal_ack_mode(defaultSync), plumbed throughopen_worldtoFileJournal::open_with_ack_mode. Existingopen/open_with_max_bytesdelegate withSync.Tests (laptop venue, under
fleet-build-lock)Fail-before: the six new tests applied alone to pristine
origin/mainfail to compile — 26 errors (noJournalAckMode,open_with_ack_mode,unsynced_appends,JOURNAL_ACK_BATCH_SIZE, traitack_mode/sync).Pass-after (this branch):
cargo test -p id-worlds --lib journal_— 66 passed, 0 failed, including the five new mode tests: default mode writes the exact pre-change byte image and never leavesunsynced_appendsat zero unobserved; async acks before any sync and an explicitsync()flushes; batched syncs exactly at the 64-append bound counted acrossappend/append_batch; a journal written async replays identically under sync/batched (and vice versa); compaction is a sync point in async mode.cargo test -p id-worlds --lib world_store::— 51 passed, 0 failed (the whole store module, incl. theopen_worldpath).cargo test -p id-worlds --lib world_limits_default— 1 passed (WorldLimitsdefault isSync).cargo fmt -p id-worlds -- --checkclean (one assert reflowed).Not in this PR
BASELINES.mdsection rather than substituted with a loaded number.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.