Notes: shutting down empties the list store's log #385

Closed
kayg wants to merge 0 commits from issue/44-clean-close into dev
Owner

Part of #44 (home.first_page p95 under 50 ms at 100k). Based on dev, independent.

Found: I timed the parts of the first request after a start on the perf VM: a probe build, the 100k harness, dropped caches. Of a 41 ms first page:

  • 27 ms opened the list store (list_db);
  • 6.7 ms ran the page query;
  • 5.5 ms opened the engine runtime.

After a run, the Home still had a 42 MB meta.db-wal. History and the journal store had logs left over too (2.2 MB and 4.2 MB). The list stores stay open until the process ends, so their logs are never checkpointed. The next start reads them all back before it can answer. Busier runs before a start leave bigger logs, which fits the 60–220 ms first pages seen in rounds 13 and 15.

Change: Notes::shutdown (already called on the way out, after saving open notes) now runs PRAGMA wal_checkpoint(TRUNCATE) on every list store it opened.

Not touched: history.db (that's #298's area) and the journal store. Their logs are smaller; I can do the same for them if wanted.

New test shutting_down_leaves_the_list_log_empty. cargo test -p calternal-notes (170) and clippy are clean. Perf-VM before/after on home.first_page will follow on #44.

🤖 Generated with Claude Code

Part of #44 (`home.first_page` p95 under 50 ms at 100k). Based on dev, independent. **Found:** I timed the parts of the first request after a start on the perf VM: a probe build, the 100k harness, dropped caches. Of a 41 ms first page: - 27 ms opened the list store (`list_db`); - 6.7 ms ran the page query; - 5.5 ms opened the engine runtime. After a run, the Home still had a **42 MB `meta.db-wal`**. History and the journal store had logs left over too (2.2 MB and 4.2 MB). The list stores stay open until the process ends, so their logs are never checkpointed. The next start reads them all back before it can answer. Busier runs before a start leave bigger logs, which fits the 60–220 ms first pages seen in rounds 13 and 15. **Change:** `Notes::shutdown` (already called on the way out, after saving open notes) now runs `PRAGMA wal_checkpoint(TRUNCATE)` on every list store it opened. Not touched: `history.db` (that's #298's area) and the journal store. Their logs are smaller; I can do the same for them if wanted. New test `shutting_down_leaves_the_list_log_empty`. `cargo test -p calternal-notes` (170) and clippy are clean. Perf-VM before/after on `home.first_page` will follow on #44. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Notes: shutting down empties the list store's log
Some checks failed
CI / server (pull_request) Successful in 18s
CI / rust (pull_request) Successful in 2m5s
CI / web (pull_request) Failing after 34m30s
a2224be561
The list stores stay open until the process ends, so their write-ahead
logs were never folded back in: after a harness run at 100,000 notes the
perf VM had a 42 MB meta.db-wal, and the next start read it all back
before the first page (opening the store took 27 ms of a 41 ms first
page on dropped caches; busier runs before it left more). Shutting down
now checkpoints each list store with TRUNCATE. (#44)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T
Author
Owner

Merged into dev via train j (#391).

Merged into dev via train j (#391).
kayg closed this pull request 2026-10-15 02:23:05 +00:00
Some checks failed
CI / server (pull_request) Successful in 18s
CI / rust (pull_request) Successful in 2m5s
CI / web (pull_request) Failing after 34m30s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal!385
No description provided.