Repository navigation
fix(db): usize::MAX threshold suppresses the close-time save too (#476) - #526
Merged
Merged
Conversation
`wal_checkpoint_threshold(usize::MAX)` was documented to suppress the close-time checkpoint, and `Inner::drop` skipped it, but `PersistentFactStorage::drop` still saved whenever it was dirty. Closing the handle wrote every pending fact to the .graph file and left a WAL whose entries were all checkpointed. `Inner::drop` now discards the storage's dirty flag under the sentinel. The WAL holds every pending fact and the next open replays it. The v8 golden generator is pinned to 23aa57c and never re-run, so its `stale_wal` recipe, which relied on the old save, is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012wXxZguv7PgKQjMMH4yJ5h
Use get_mut() in Inner::drop (no lock needed with &mut self), dropping the untakeable poisoned-lock arm, and add a unit test for an in-memory handle under usize::MAX. src/db.rs branch coverage fell below its 87% floor without it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012wXxZguv7PgKQjMMH4yJ5h
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Oct 10, 2026
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.
Closes #476.
Decision
Took the first option in the issue: the sentinel now suppresses the save in
PersistentFactStorage::dropas documented, rather than changing the docs. TheSyncMode::Normaldocs, the benchmark helpers,tests/error_codes_wal_test.rsand several WAL tests all rely onusize::MAXmeaning "nothing written to the file on close". Nothing is lost: the WAL holds every pending fact and the next open replays it.Changes
Inner::drop: underwal_checkpoint_threshold == usize::MAX, discard the storage's dirty flag (file-backed, read-write only), so its drop saves nothing.OpenOptions::wal_checkpoint_thresholdfield docs: say whatusize::MAXdoes.test_max_threshold_drop_leaves_graph_file_untouched(tests/wal_test.rs): underFullandNormal, two transacts then drop leave the.graphfile byte for byte unchanged and keep the WAL; a reopen replays the entries.Not changed: the v8 golden generator's
stale_walrecipe relied on the old drop-save, but the generator is pinned to rev 23aa57c and never re-run, so the committed fixture and recipe stay as they are. The #385 model test'sCrashstep still copies files while the handle is open; it works as is. The docs site's tuning page already tells bulk loaders to callcheckpoint()explicitly, so nothing there contradicts this. Not backported to v2.x: no data-integrity impact.Verification
cargo test: 1415 passed, 0 failed, 10 ignored.cargo clippy --all-features -- -D warnings, pluswasm32-unknown-unknown --features browserandwasm32-wasip1: clean.🤖 Generated with Claude Code
https://claude.ai/code/session_012wXxZguv7PgKQjMMH4yJ5h