fix: sync on checksum - #105
Closed
Dodecahedr0x wants to merge 3 commits into
Closed
Conversation
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
3 tasks
Dodecahedr0x
force-pushed
the
dode/prepare-empty-writable
branch
from
August 28, 2026 09:21
596da51 to
8424cdd
Compare
Dodecahedr0x
force-pushed
the
dode/sync-on-checksum
branch
2 times, most recently
from
August 28, 2026 09:52
0847aa8 to
ec741da
Compare
Dodecahedr0x
force-pushed
the
dode/prepare-empty-writable
branch
2 times, most recently
from
August 28, 2026 09:52
596da51 to
ab148d3
Compare
Dodecahedr0x
force-pushed
the
dode/sync-on-checksum
branch
2 times, most recently
from
August 28, 2026 09:54
7f733d9 to
b797141
Compare
bmuddha
requested changes
Aug 28, 2026
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. |
Collaborator
There was a problem hiding this comment.
doc: remove the heavy defensive explanation
Dodecahedr0x
force-pushed
the
dode/sync-on-checksum
branch
from
August 31, 2026 08:17
a5c5a19 to
4ca9787
Compare
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.
What changed
PersistedStore::flushonly forces the LMDB index to disk on sync flushes. The env runs withNO_SYNC, soindex.flush()is a full fsync (F_FULLFSYNCon 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
AlreadyProcessedrejections 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.