Skip to content

fix: sync on checksum - #105

Draft
Dodecahedr0x wants to merge 1 commit into
dode/prepare-empty-writablefrom
dode/sync-on-checksum
Draft

fix: sync on checksum#105
Dodecahedr0x wants to merge 1 commit into
dode/prepare-empty-writablefrom
dode/sync-on-checksum

Conversation

@Dodecahedr0x

@Dodecahedr0x Dodecahedr0x commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

What changed

PersistedStore::flush only forces the LMDB index to disk on sync flushes. The env runs with NO_SYNC, so index.flush() is a full fsync (F_FULLFSYNC on macOS) whose latency grows with the dirty set; running it on every slot boundary stalled block production under write-heavy load. Async flushes now flush only the storage mmap; the index fsync and checksum update happen together at checksum boundaries.

Closes #102

Impact

Removes the per-slot fsync stall that froze block production (and cascaded into AlreadyProcessed rejections for every retried transaction) during large bursts. Durability semantics move to checksum boundaries: a crash between sync flushes can lose recent index writes, which store validation already detects on startup, same as for the storage mmap.

Reviewer notes

The invariant to check is that the checksum is only stored after the index fsync succeeds, so a persisted checksum always covers a durable index. This sits on top of #103, which touches the same file.

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 6 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e1635703-9c57-436a-ae3b-e300cae77375

📥 Commits

Reviewing files that changed from the base of the PR and between d71c8b2 and b797141.

📒 Files selected for processing (1)
  • accountsdb/src/store/mod.rs

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Dodecahedr0x
Dodecahedr0x force-pushed the dode/sync-on-checksum branch from 7f733d9 to b797141 Compare August 28, 2026 09:54
Comment on lines +150 to +156
///
/// Only a `sync` flush forces the LMDB index to disk: the env runs with
/// `NO_SYNC`, so `index.flush()` is a full fsync whose latency grows with
/// the dirty set. Doing that on every slot boundary stalls block
/// production under write-heavy load; durability is instead established
/// at checksum boundaries, and a torn async flush is caught by
/// [`Self::validate`] on startup.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc: remove the heavy defensive explanation

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Per-slot LMDB fsync stalls block production under write-heavy load

2 participants