Storage: SQLite WAL auto-checkpoints run inside saves (meta.db every 100th save, history, journal) #1051
Open
opened 2026-11-10 05:11:52 +00:00 by kayg
·
19 comments
No Branch/Tag specified
main
port/tasks-float-2
fix/train-1116-2
fix/train-1116-3
fix/train-1116-1
fix/flake-1134
fix/server-1182
dev
port/notes-float-3c
docs/auto-update-ig
feat/dav-transport
port/tasks-float-1
wip/mail1011-sv-order-1116
fix/flake-1179
fix/flake-1178
fix/guards-1153-fsio-split
fix/guards-1153-notes-split-we
fix/guards-1153-notes-lib
fix/guards-1153-notes-home
fix/guards-1153-ui-primitives
fix/guards-1153-primitives-e2e
fix/guards-1153-visibility-doc
feat/paper-grey-1116
fix/flake-1165
fix/flake-1119
docs/imap-766-plan-v2
fix/e2e-unique-ports
t3/paged-search-reconcile-final
wip/mail1011-final-1115
docs/tasks-float-port
perf/editor-first-paint-1c
feat/imap-notes-fetch
feat/imap-notes-projection
feat/imap-notes-readonly
feat/imap-notes-auth
feat/imap-notes-server-foundation
wip/mail1011-txn-ownvocab-1115
wip/mail1011-txn-novocab-1115
perf/p1117-final-harness
perf/single-shot-repeats
port/tasks-matrix
wip/mail1011-txn-1115
fix/static-gates-1155
feat/files-s1-identity-r7
fix/files-r7-idle-loop
fix/daily-train-1152
port/notes-float
fix/editor-tables-test-types
port/notes-float-listscript
feat/tasks-actions
port/notes-float-phone-preload
perf/sound-comparator
port/notes-float-listscroll
port/notes-float-budgets
port/notes-float-suite-fix-b
port/notes-float-sidebar-fix
port/notes-float-trim
port/notes-float-3-lists
fix/attachments-meta-capability
docs/carddav-writes-v2-plan
feat/contacts-companion-pure
issue/carddav-read-perf-fix-r2
issue/carddav-read-r2
port/notes-float-devsync2
review/calendar-2
review/switcher-a-pills
port/notes-float-switcher-a
port/port-tables-2
review/switcher-ends
wip/whiteboard-s1-1114
port/port-tables
wip/mail1011-perfneutral
review/photo-tint
port/notes-float-shell
wip/local/collections-db
wip/local/mail-p1
wip/local/cold-growth-on-tiering
wip/local/tiering-v3-s1
wip/local/wal1051-cap
wip/local/tiering-v3-s1-resume
wip/local/index-position-startup-scan
port/notes-float-flat
port/notes-float-promote
wip/handover/mail1011-candidate
wip/handover/files-s1-candidate
port/notes-float-shell-only
port/notes-float-perf
feat/whiteboard-s1
feat/tiering-v5
fix/app-switch-hitch
wip/local/files-s1-dev-v4-final
feat/files-s1-dev-v4
fix/c2-glass-shared
feat/flat-lists
wip/handover/whiteboard-s1-resume
wip/att-lazy-861
feat/switcher-browse
wip/att-lazy-860
feat/tasks-float
recovered/flat-backup-candidate
perf/stalls-1054-kc
land/ai-toolbar
feat/collections-db
feat/collections-db-fixes
codex/mail-1011-redesign-20261111
fix/ai-toolbar
backup/macos-vm/st3-head
perf/trim-candidate-phonestack
feat/switcher-three
fix/1051-index-idle-checkpoint
perf/stalls-1054-kb
perf/stalls-1054-k
perf/stalls-1054-r3
fix/c2-contrast-tail
perf/stalls-1054-r3-preview
feat/collections-before
feat/tiering-v4
fix/timelog-caret
wip/local/tasks-actions
docs/tasks-writes-v2-plan
st3-r3
feat/pass8
review/calendar-2-before-1111
wip/tiering-v3-cold4
perf/stalls-1054-r2
fix/suite-A4
fix/suite-A5-probe
fix/suite-A6
fix/suite-A3
fix/suite-A2
fix/suite-A5
fix/suite-A1
wip/local/attachments-861-fix
feat/contrast
wip/local/ports-861
storage/wal-checkpoint-off-save-1051
wip/local/mail-1011-reconcile-20261110
feat/style-sheet-fixes
feat/money-round
perf/stalls-1054
wip/tiering-v3-cold5
t3/mail-1011-liveness
feat/iphone-fixes
feat/notes-approve
wip/local/shrow-work
feat/files-s1-identity
feat/quickfix
wip/tiering-v3-cold
wip/local/shared-row-swipes
backup/macos-vm/pfx-B
backup/macos-vm/pfx-C
backup/macos-vm/pfx-D
feat/contrast-r1
feat/tiering-v3-s2-tags
feat/folder-drop
t3/photos-s1
feat/tiering-v3-s1-namespace
wip/local/photos-s1
t3/photos-plan-slice-one
recovered/backup/p1b-61505
t3/paged-search-reconcile
t3/smooth-pane-transitions
t3/index-position-startup-scan
fix/private-staging-759b-r2
backup/macos-vm/hk/hk1009/pr877
backup/macos-vm/hk/hk1009/pr878
docs/undo-block-ids-plan
fix/undo-768
backup/macos-vm/hk/hk1009/pr875
backup/macos-vm/hk/hk1009/pr904
proto/block-identity-v7d
backup/macos-vm/hk/hk1009/pr846
backup/macos-vm/hk/hk1009/pr860
backup/macos-vm/hk/hk1009/pr861
backup/macos-vm/hk/hk1009/pr849
backup/macos-vm/hk/hk1009/pr848
backup/macos-vm/hk/hk1009/pr853
backup/macos-vm/hk/hk1009/pr957
backup/macos-vm/hk/hk1009/pr893
backup/macos-vm/hk/hk1009/pr889
backup/macos-vm/hk/hk1009/pr902
docs/imap-notes-plan
docs/quota-plan-2
fix/parallel-test-flakes
docs/calendar-backend-v2-plan
feat/calendar-ical-converter
backup/macos-vm/hk/hk1009/pr808
docs/contacts-import-v2-plan
issue/610-pm-midnight
feat/calendar-v2-s1-containment
backup/macos-vm/hk/hk1009/pr854
backup/macos-vm/hk/hk1009/pr845
backup/macos-vm/hk/hk1009/pr917
docs/dav-recorder-v2-plan
plan/previews-865
plan/save-log-durable-entry
backup/macos-vm/hk/hk1009/pr934
fix/e2e-data-on-ram
backup/macos-vm/hk/hk1009/pr888
feat/appwindow3
feat/appwindow2
feat/appwindow
feat/money-p1
feat/keys-sheet
review/calendar-2-themes
feat/smooth-cursor
fix/float-style
review/calendar-2-float
release/2026-11-06-hotfix
archive/port/rows-drop-code
archive/port/rows-actions
archive/port/rows
scratch/tasks-894-ui-gates
review/calendar-2-night-wip
recovered/flaky/toast-reduced
release/2026-11-05
archive/flaky/rows-drop-fixed
archive/flaky/rows-actions
archive/flaky/rows
sim/bm15-final
sim/bm15-bis-932
sim/bm15-bis-909
sim/bm15
sim/bm15-bis-887
perf/tiering-option-b
fix/sw-lazy-precache
archive/plan/save-log-durable-entry
mock/money-fix2
archive/fix/e2e-data-on-ram
mock/appearance-all
mock/pill-press
mock/pill-press-mac
backup/macos-vm/appearance-after
mock/auto-swipes
mock/mail-actions
backup/macos-vm/mock/mail-actions
mock/money-static
archive/review/standards-917
perf/tiering-761-fix
mock/type-audit
mock/third-pane
feat/contacts-import-v2-s1
perf/executor-hot-path
archive/port/hidden-blocks
archive/port/devices
scratch/executor-on-894
scratch/executor-spans2
scratch/executor-spans
archive/port/rows-drop
feat/tiering-761-d-scale
feat/tiering-761-c-index
feat/tiering-761-b-reader
archive/review/sharing-pr3-review-9fec3d1f
perf/ports-lazy-budgets
feat/tiering-761-a-migration
archive/review/sharing-pr3-review
archive/review/sharing-pr3-review-code
archive/plan/previews-865
archive/port/port-attachments-3
archive/port/contacts-merge
fix/motion-audit-859
fix/motion-audit-859-mac
archive/port/port-pickers
archive/port/port-tables-2
archive/port/port-tables
recovered/local/sharing-s1-pr2-room-snapshot-candidate
archive/fix/parallel-test-flakes-code-minipc01
docs/imap-766-readonly-slice
feat/dav-recorder-v3
research/788-diagnosis
archive/fix/parallel-test-flakes
archive/perf/pr792-cold-index-edit
docs/sharing-slice-1
recovered/feat/dav-recorder-v2
recovered/feat/dav-recorder-v2-edd7bbb
spike/imap-766-s0-cases
archive/fix/undo-768
recovered/feat/dav-recorder
recovered/feat/dav-recorder-901acd4
feat/contacts-import
perf/cold-growth-on-764
perf/cold-growth-on-tiering
recovered/feat/tasks-set-status
feat/tasks-move-reorder
feat/tasks-delete-promote-duplicate
feat/carddav-writes
perf/quota-on-tiering
perf/quota-simple
perf/cold-growth-on-quota-stack
recovered/perf/cold-growth-on-tiering
feat/calendar-identity
feat/calendar-event-parser
feat/calendar-props-maps
port/glass-when-ring
recovered/feat/tiering-761-s1-wip-8132a84
recovered/feat/tiering-761-s1-wip-9da4094
recovered/feat/tiering-761-s1-wip-724512c
recovered/feat/tiering-761-s1-wip-66e667e
recovered/feat/tiering-761-s1
wip/6by32-01-tier-761-s1-pause-20261030
spike/imap-766-s0
wip/6by32-02-calternal-pause-20261030
wip/8by64-01-review-688-pause-20261030
wip/6by32-01-verify-744-pause-20261030
wip/6by32-01-verify-742-pause-20261030
fix/private-staging-759b
wip/6by32-01-review-748-pause-20261030
wip/6by32-01-review-733c-pause-20261030
wip/6by32-01-review-733b-pause-20261030
review/calendar-month
wip/local/bm15-trash
plan/759b-staging
review/767b-tests
review/preview-2026-10-29
docs/tiering-731-plan
wip/c6b02-review-733d
wip/c6b02-bm1-full-a
docs/deploy-plan
fix/storage-owner-liveness-642
fix/storage-fix-7
feat/tiering-731
wip/tiering-731-first-attempt
perf/idle-honest-2
fix/storage-private-tmp-642-dev
fix/storage-exact-file-quarantine-642
perf/one-flush-save
review/calendar-static
review/indexing-ring
review/when-field-2
proto/block-identity-2-review
proto/block-identity-review
review/when-field
issue/tasks-create-ids
issue/tasks-create
review/combined
review/task-polish
review/top-buttons
review/q1-q5
archive/integ325-293
archive/integ325-ci
issue/calendar-adr
archive/old/train/2026-10-23bk2
archive/old/train/2026-10-23bk
issue/469-mockup-9a
issue/smart-tasks-mockup
issue/469-menus
issue/652-signout-flake
issue/652-history-fix7
issue/652-history-fix6
archive/old/issue/spring-check-perf
issue/spring-check-perf
issue/659-rename-fast
archive/old/train/2026-10-21ar
issue/search-hardening-3
issue/652-history-fix5
issue/660-port-sheets-glass
issue/652-history-fix4
issue/652-history-fix3
issue/652-history-fix2
issue/652-history-flake
train/2026-10-21an
issue/settings-admin-port
issue/search-port
train/2026-10-20am
issue/storage-split-fix2
issue/storage-split
archive/old/issue/folder-ids-fix
train/2026-10-20al
archive/old/issue/folder-ids
train/2026-10-20ak
issue/tables-mockup
train/2026-10-19aj
train/2026-10-19ai
issue/469-merge-fixes
issue/sidebar-band
archive/old/issue/608-settings-spec
train/2026-10-19ah
issue/swipe-offscreen
train/2026-10-19ag
archive/old/issue/590-nlp-adr
archive/old/issue/587-event-after-write-2
train/2026-10-19af
archive/old/issue/587-event-after-write
issue/469-pill-room-c
issue/469-pill-room
train/2026-10-19ae
issue/469-narrow-handle
issue/397-ios-swipe-2
issue/469-desk-fixes
archive/old/issue/auto-update-adr
issue/469-filter-gap
issue/469-port-1b
issue/442-opacity-flake
issue/327-web-fast-3
archive/old/issue/469-port-1
issue/469-port-1
issue/327-web-fast-2
archive/old/issue/327-web-fast
archive/old/issue/425-stt-bench-vq1
archive/old/issue/445-no-bleed
archive/old/issue/400-swipe-mockup-2
issue/426-client-review
issue/426-client-2
issue/426-client
archive/old/issue/476-safe-area-lab
archive/old/issue/445-top-light
issue/471-blocks-mockup
archive/old/issue/448-links-app-2
archive/old/issue/448-links-app
archive/old/issue/398-cold-links
issue/434-442-small-2
issue/434-442-small
archive/old/issue/398-unload
archive/old/issue/445-bottom-band
issue/445-bottom-band
issue/351-rem-3
issue/351-rem-2
issue/351-rem
archive/old/issue/327-first-note
issue/395-width-phone
archive/old/issue/327-typing
issue/396-ios-edges
issue/397-ios-swipe
archive/old/issue/327-notes-index
issue/345-347-contrast-empty-2
archive/old/issue/44-arenas
issue/44-arenas
archive/integ325
archive/old/issue/327-perf-harness
archive/old/issue/44-thp
issue/44-thp
archive/old/issue/285-sticky-pills
archive/old/issue/44-trim-3
issue/44-trim-3
archive/old/issue/165-cards
archive/old/issue/165-picker-2
archive/old/issue/212-multi-select
No results found.
Labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
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#1051
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
SQLite's WAL auto-checkpoint runs inside saves, on dev.
meta.db,history.dband the journal'sindex.dball keep SQLite's defaultwal_autocheckpoint(1,000 pages, about 4 MB). So whichever write crosses that size also pays for the checkpoint: a WALfdatasyncplus a database-filefdatasync, in the middle of someone's save. Only search (crates/search/src/index.rs) setswal_autocheckpoint = 0with a backgroundPASSIVEcheckpoint. #298 moved history commit tails off the hot path but left these auto-checkpoints in place.Found during the #928 soak diagnosis (comment 89399 there). It is the same on dev and on #928.
Evidence
The perf-01 FIFO turn of 2026-11-10 04:43–05:01 UTC had four interleaved 180 s save-soak arms: dev A, #928 candidate, dev B, candidate. Each arm types into one note and calls
notes.saveevery 200 ms (900 saves). The server ran underperf/vm/strace-server.sh(seccomp-filtered strace: fsync, fdatasync, openat, with file names; #1050). A main-database sync is a checkpoint writing its WAL back. This table places each one against the save windows:notes/meta.db(synchronous=NORMAL)notes.save93, 193, 293 … 893: every 100th save, in all four armsnotes/history.db(synchronous=FULL)notes.save743, 892 (dev B: all 6 in typing saves)notes.save29–38 msindex.db(journal)notes.save471/472The other checkpoints in each row ran at startup, outside any save. Each in-save checkpoint costs its WAL
fdatasync(4–18 ms for meta) plus the database-filefdatasync(3–10 ms) on top of the save's own four syncs. That's about 16 in-save checkpoints per 900 saves (~1.8%), more than the 1% that sets p99, so at this cadence they largely are thenotes_savep99 and part of thesave_acktail.Raw data is attached below: every save's start, end and typing-ACK times with WAL sizes, and the strace of each arm. Re-run with
python3 checkpoints.py saves-<arm>.jsonl strace-<arm>.txtorperf/vm/sync-overlap.py … --watch 'notes/meta.db$'(exits 1 on these).Proposal
Move checkpoints off the save path, the way search already does:
meta.db,history.dband the journal store withPRAGMA wal_autocheckpoint = 0, so no write ever checkpoints.PRAGMA wal_checkpoint(PASSIVE)from its own connection:TRUNCATEwhen fully idle, asmeta.rs::checkpointalready does at close.journal_size_limit(8 MB on meta) so a truncated WAL doesn't stay large.Expected effect: about 16 fewer sync pairs inside saves per 900 saves at this cadence.
notes_savep99 and thesave_acktail should drop by roughly the checkpoint cost (about 10–25 ms on those saves); p50 is unchanged. Measure with the #1050 method: ≥3 interleaved arms per side, plus the sync-overlap check showing 0 checkpoint syncs inside saves.Risks:
PASSIVEcheckpoint from finishing, so the WAL grows until it does. That's bounded by the size trigger plusjournal_size_limit; add a test that the WAL stays under the cap under a held reader.synchronous=FULL); checkpoints only move pages into the main file. Crash recovery replays a longer WAL, bounded by the cap.home.*andopen.*against the budgets.Not part of #928; that PR's numbers don't depend on this.
Raw evidence for the table above (four soak arms, per-save logs and strace): p928-soak-diagnostic-20261110.tar.gz (697612 bytes). Contents:
out/saves-*.jsonl,out/strace-*.txt,out/summary-*.json, and theanalyze.py,checkpoints.pyandsync-overlap.pyscripts used.Handoff to Codex (Claude stopped on its usage limit)
Branch
storage/wal-checkpoint-off-save-1051, head898d7f865, rebased onto dev4274dafb4(rusqlite 0.41). No PR yet. No perf locks or tickets are held.Done
calternal_core::walis a pure checkpoint policy:PASSIVEafter 100 ms quiet once ≥100 commits,PASSIVEafter 1 s idle,TRUNCATEafter 10 s idle. Auto-checkpoint is raised to a 4,096-page (16 MiB) backstop rather than 0, becausemeta.dbhas no writer loop to wake during a cold scan.journal_size_limitis 8 MiB.history.db: the writer thread runs the policy between jobs. It also checkpoints the Home'smeta.db(Sibling) on its own connection.meta.dbcounts commits withcommit_hook; rusqlite 0.41 needs&mutthere, fixed in46469500c.index.db: the store writer runsPASSIVEafter every 100 commits when its queue is empty (no timer; it waits on an async channel).history/checkpoint_tests.rs(5), storethe_journal_checkpoints_after_enough_commits_never_inside_one.898d7f865:-D warnings, and the new tests pass.calternal --test attachments_crash::kill_nine_mid_upload_leaves_nothing_half_written:NotFoundatattachments_crash.rs:129, where a file disappears between the test's ownread_dirandmetadata. It looks like a test race unrelated to SQLite, but it has not been rerun.~/wal1051-build.sJl1/bin(server/probe for dev and branch, withSHA256SUMS). The probe crate neededrusqlite = "0.41".Left
Rerun the failing test with
--repeat-each-style loops (×10) on the branch and on dev. If it's flaky on both, open a stability issue; if it only fails on the branch, investigate.Measure by the #1050 method (
docs/perf/comparing.md), in one plain~/bin/perf-turnturn (perf-01 lock, then perf-02):save_ack,notes_savep50/p95/p99, pluscommitandcatch_upbecause the store writer changed);perf/vm/strace-server.sh, thenperf/vm/sync-overlap.py saves.jsonl strace.txt --watch 'notes/meta.db$|history.db$|index.db$'.Expected: 0 main-database syncs inside saves (dev showed about 16 per 900 saves), with
notes_savep99 and thesave_acktail lower and p50 flat. Nothing may regress.Open the PR to dev. A drafted description (design, sizes, failure table, tests) is at
/tmp/p928tk.RrRE/pr1051.mdon the control hostcode. Put the evidence in the PR.Runner and scripts used for #928/#1050 measurements: perf-01
~/p928-tk/runner.py(phasesmatrix,soak= six arms,startup,boot) and~/p928-tk/diag/(diag-soak.shtraced pair,strace-static). They are not yet updated for these binaries; stage the newbin/and hashes first.Qualification resumed from comment 89593. Attachment crash repetitions: branch
898d7f865failed 1/10, dev4274dafb4passed its first 10; expanded dev diagnostics reproduced the identical NotFound at run 15 (1/30 overall). Filed #1060 and pushed test-only fixda8e35728: scan metadata once and ignore vanished .calternal-tmp-* entries only. Real-file errors still fail. Final fmt/clippy, 20 fixed repetitions, and workspace rerun are queued on dev-01.The staged 898d7f865/dev release binaries match the original SHA256SUMS. Test-only commit
da8e35728does not change those binaries. Measurement is running in one plain~/bin/perf-turn wal1051 …turn with perf-02 held too: controls and ABAB journal/startup/room, cold boot, list/open smoke probes built on dev-01, twelve interleaved 180 s soak arms (six per side), then a traced pair with the repository strace wrapper and sync-overlap checker. No measurements run on the control host.The first session was stopped and both perf locks released after partial results identified an immediate journal-checkpoint tail (commit p99 0.065→0.188 ms) and a runner configuration mismatch: the reused #928 runner passed --secrets only to the branch server. Those startup/room results are rejected as unequal configuration.
Added a stronger store regression test: the main index.db must stay untouched across an active stream beyond 100 commits. It fails on the handoff implementation and passes after
591284889, which uses the shared quiet/idle policy for the store writer too. fmt passes. Rebuilding on dev-01 before a fresh plain FIFO turn, with identical --secrets arguments on both sides and tracing first.Workspace results so far: initial rerun at
898d7f865passed; the next full run (after only the temporary-file test fix) failed six calternal-notes tests with pending/unable-to-open-database errors. Logs retained; the next full run uses a fresh disk-backed TMPDIR and four test threads. 20/20 fixed attachment crash repetitions and clippy passed.The corrected-configuration traced pair at
591284889found dev 12 and branch 7 main-db syncs overlapping explicit saves; all seven branch overlaps were meta.db at roughly every 101st save. Root cause: SiblingWal::observe timestamped observation, not the meta commit, delaying its 100 ms quiet window into the next save.b8e599e5brecords count/time together in the commit hook and preserves the original deadline. A deterministic delayed-observation test failed before the fix and passes after it.The same session showed journal commit p50 +12.2% (0.02663→0.02989 ms, dev control +1.3%) from entering Tokio timer machinery per empty-queue commit; p99 was -6.1%.
86209c68bnow registers a standard thread waker with the existing channel and parks until work or the quiet deadline, avoiding per-commit async timers. Truncation uses zero busy timeout and restores the normal 5 s write timeout; a held-reader test verifies retry and timeout restoration. All 75 store tests and the six history checkpoint tests pass. fmt passes on86209c68b. Rebuilding before a fresh FIFO session; both perf locks remain released during this work.Further trace qualification at
86209c68bfound that an overdue meta checkpoint can run just after a typing ACK, before that caller writes meta in its explicit save.d9a1f96e9now requires a quiet history writer as well as the meta policy deadline. Its deterministic overdue-meta/recent-ACK case and all seven history checkpoint tests pass.Journal p50 remained about +12% with a parked timed receive, so
7ff88807erestores the original blocking_recv for ordinary jobs. After 100 commits, one async task observes the count until quiet and queues an internal checkpoint message. The writer checks the observed count and empty queue before any I/O, rescheduling stale messages. Normal commits no longer enter a timed receive. fmt and all 75 store tests pass; full workspace/clippy are running. A journal-only FIFO check is queued behind shared-row and tiering before final measurements. No perf lock is held by this lane while waiting or building.Rust gates are now green on
7ff88807e:cargo fmt --check,cargo clippy -j4 --workspace --all-targets -- -D warnings, andcargo test -j4 --workspace --no-fail-fast -- --test-threads=4, all through ~/bin/slot and nix develop on dev-01. Workspace used a dedicated /tmp/wal1051-tests.* TMPDIR. Exact script markers: FMT_R5=0, CLIPPY_R5=0, WORKSPACE_R5=0.The journal-only check remains a failing performance gate: commit p50 0.026404→0.029250 ms (+10.78%; paired +11.59%; dev control +0.38%, control pair range -2.81% to +7.80%); p95 +5.56%, p99 -5.49%. The timed-receive explanations did not account for this, so no success claim is made. An isolated diagnostic changes only BACKSTOP_PAGES from 4096 to 1000 to test the WAL-size hypothesis. It and the final server rebuild are waiting behind train-1110c on dev-01. All perf locks are released.
Attached: pre-final diagnostic evidence, including per-save traces, sync-overlap output, journal controls/ABAB results, runners and binary hashes. These are rejected qualification attempts, not a passing performance report.
r2-partial:591284889, before original meta timestamps.r3-artifacts:86209c68b, before the recent-history-ACK guard.journal-artifacts:7ff88807e, showing that restoring blocking_recv did not eliminate the +10.78% commit p50 difference. The production-equivalent head93ae82ba0additionally isolates the test fixtures; its production code is unchanged from7ff88807e. The latest full Rust gates passed at7ff88807e(1745 passed, 0 failed, 22 ignored).Next diagnostic compares the same implementation with only the backstop changed from 4096 to 1000 pages. It and the final server build are still queued behind dev-01 train-1110c; no perf locks are held by this lane.
index-only implementation plan (new branch from current origin/dev). meta.db and history.db remain unchanged. no merge and no delegates.
index writer: quiet PASSIVE after at least 100 writer commands and 100 ms without a queued write (chosen to fit between the corrected soak’s 200 ms saves); native 1000-page auto-checkpoint remains the emergency inline backstop. idle admission budget is 1000 WAL pages, not a claim of partial checkpoints: SQLite PASSIVE cannot stop after N pages. journal_size_limit bounds retained allocation after WAL restart, not active WAL growth. above 16 MiB the next writer command first attempts TRUNCATE without waiting (zero busy timeout, original timeout restored), and returns retryable NotSavedYet before starting a new transaction if a reader still prevents WAL reuse. PASSIVE completion does not prove reuse is possible. the bound allows one transaction of overshoot; existing API batch size is unchanged.
cost: O(1) metadata admission per queued write, one weak timer per dirty writer, O(WAL pages) PASSIVE only within admission budget or emergency path. tests/builds only dev-01 via slot/Nix. perf reproduces corrected collector: identical-dev controls then ABABAB, 3 x 900 saves per side, per-arm quantiles/MAX, list p50/p95, database-specific overlap, WAL timeline. any MAX regression triggers retained slowest-20 phase analysis, no speculative patch. every measured metric must qualify before ready PR; otherwise draft.
pre-measurement cost review: retain #1064’s index-only 100-command minimum before scheduling the 100 ms quiet timer. this amortizes checkpoint sync pairs rather than adding one after every individual save. native 1000-page emergency backstop, idle page admission budget and pinned-reader size refusal remain as planned. draft #1080, current head
5a203fa05; tests queued behind existing dev-01 slot jobs, no performance qualification or held perf locks.size-backstop correction from source review, before any measurement: PASSIVE can fully backfill a WAL while an active reader still prevents reset. above 16 MiB the writer now attempts nonblocking TRUNCATE, restores its original busy timeout on every path, and rejects the next transaction if reuse is still blocked. idle passes remain PASSIVE, and SQLite retains its native 1000-page inline backstop. the retained allocation limit follows the actual page size, so small-page databases do not permanently exceed the idle admission budget. new tests cover fully backfilled reader pins and 1024-byte page reuse. crash coverage now exercises the actual emergency checkpoint after a durable journal+receipt commit, with a reader pin preventing the native backstop from consuming the crash target first. draft #1080 head
557f4b02e. all Rust checks and perf remain pending behind train-1111b; no perf locks held.The reused corrected-soak probe had a remaining observer-cost bug: it read WAL sizes and wrote its JSONL trace after the response, then stopped the timer used for
notes_save_ms. Both fresh probes now stop that timer immediately at the response, before WAL enumeration. The syscall/phase window already ended there. Workload is unchanged: 200 ms cadence, 900 saves per 180-second arm, ABABAB with identical-dev controls. This is a measurement correction, not a production optimization; older numbers will not be pooled with this run.Builds and regression tests are still queued behind the daily train. Collector completeness is checked on the build VM before requesting the perf turn. No new performance result is claimed.
functional validation on dev-02 (aarch64), under
~/bin/slot nix develop, head82ecc5a1e:cargo fmt --all -- --check: pass.node ci/check-file-docs.mjs: pass.node ci/check-layers.mjs: pass.cargo test -j4 -p calternal-store -- --test-threads=4: 83 passed, including the real child-process crash while checkpoint main-file writes were observed, integrity check, payload and receipt recovery.node ci/check-size-budgets.mjs: fails identically on dev and candidate. Unchanged files: NoteList.svelte 569 vs ceiling 567, fsio/src/lib.rs 576 vs 551, notes/src/home.rs 905 vs 902. No ceiling raised and no unrelated code changed.The first candidate compile exposed unsupported u64 rusqlite conversions;
82ecc5a1efixes only those SQL integer boundaries. The successful store run uses that fix. The temporary build target and Nix scratch were removed by the job's EXIT trap. x86 workspace/clippy/release and both diagnostic binaries are still queued behind the daily train. Perf gates remain pending, no locks held, PR #1080 remains draft.raw commands and validation logs
cargo clippy -j4 -p calternal-store --all-targets -- -D warningsalso passed on the same head under dev-02 slot/Nix. raw clippy command and log.measurement gates declared before the new perf run:
The workload remains the corrected #1064 soak: two 60-second identical-dev controls, then ABABAB with 900 saves in each 180-second arm, 5,400 comparison saves total. One current-epoch turn, both perf locks, binaries staged and hash-checked first. All results remain pending.
head
82ecc5a1e95c6febe2eb8241c69db800ac791a00, baseline437f9ec8923b3d380506f48a77eb11493ef66fb0. overall performance gate: FAIL; #1080 remains draft, #1064 unchanged.Same-turn corrected workload: 3 alternating 900-save arms per side (5,400 comparison saves) plus two 300-save identical-dev controls, 40 continuous-journal observations, and 80 controlled list/open/startup observations. Binary hashes, boot IDs, raw traces, every WAL sample, probe sources, instrumentation patches and the predeclared gate policy are retained. Both own hold units were released before final analysis.
Save MAX gates pass: median per-arm MAX 69.884 → 61.731 ms (−11.67%); worst MAX 125.594 → 77.871 ms (−38.00%). The dev/dev MAX allowance is 30.41%; all adjacent MAX pairs pass within it. The two higher adjacent candidate maxima were still attributed in the attached slowest-20 evidence.
Five declared metrics fail:
Index main-DB sync overlaps fall 3 → 0; meta stays 27 → 27; history rises 0 → 6. Total main-DB overlaps therefore rise 30 → 33. Meta/history production code is unchanged; the observed history overlap miss is still a failed gate. Index peak WAL allocation falls 4,120,032 → 931,152 bytes; meta/history peaks are equal. Full size-over-time samples are in the archive. No budget raised, no sub-ms miss waived, and no speculative policy patch.
Functional state so far: all 83 store tests, including crash recovery, pass on both build VMs. Workspace clippy passes with
-D warnings. The fresh x86 workspace test/release job is still running; final result will be appended. File-size lint fails identically on unchanged dev and candidate as already recorded. An invalid shared debug-cache result was discarded; current x86 tests use a fresh target and include all 83 cases.measurement gates, predeclared in #1051 comment 91768. positive deltas above the measured control allowance fail. static/workspace gate state is reported separately.
save arms:
gate table:
WAL peaks and main-database checkpoint sync overlaps (ordinary WAL durability syncs excluded):
Nested phase and fsync intervals are attributed separately in slowest20-per-arm.json/.md. Raw WAL samples are in wal-timeline.csv. No measurement from #1064 is pooled here.
MAX attribution, including the two candidate arm maxima that exceed their adjacent dev arm within the declared control spread:
The candidate maximum in arm 3 is 11.43% above its adjacent dev maximum, within the predeclared 30.41% MAX control allowance. Its measured delay is filesystem durability: temporary-note fsync 40.394 ms, directory fsync 22.879 ms, and history-WAL flushes 28.760/11.694 ms, which overlap. The union covers 74.967 of 77.871 ms (96.3%). Index write is 0.383 ms; no traced SQLite busy-handler sleep or blocking file-lock wait, and no index checkpoint overlaps the request. These timings identify where the save stalled; they do not establish the host-level reason for those flush latencies or exclude indirect storage effects.
The last candidate arm's maximum is 0.71% above its adjacent dev arm, also within control bounds. It includes 35.395 ms of meta refresh, with meta-WAL fsync 29.388 ms and main meta DB fsync 4.689 ms. That is the unchanged native meta checkpoint policy. The worst dev save instead spends 111.809 ms in temporary-note fsync.
No median-arm or worst-MAX regression was observed. MAX controls vary by 30.41%, so the raw reductions are observations, not proof that the policy caused all of them. All 20 slowest saves per arm, including the controls and saves below 100 ms, are retained in slowest20-per-arm.json/.md. Spans nest; do not add phase totals or individual overlapping flush durations. Lock timings cover traced SQLite file locks and busy-handler sleeps, not every possible runtime/mutex delay.
Remaining failures are not waived: continuous-journal commit p50/p95, cold first-page p95/p99, and six history checkpoint sync overlaps versus zero on dev. The per-command WAL-size metadata preflight is a plausible contributor to the journal cost, but these measurements do not isolate it. The cause of the cold first-page tail regression remains unresolved. No production policy patch followed these failures.
raw measurements, full analysis, WAL CSV, probe sources, diagnostic patches and comparison chart (SHA-256
43fba64d9efe45ed41f730a1d4f48025061d65001e2a7fe6fe786c2a76e13738).final x86 functional validation, head
82ecc5a1e95c6febe2eb8241c69db800ac791a00, completed 00:18 IST on 12 november. all build/test commands ran on dev-01 through~/bin/slot nix develop, with a fresh isolated target and-j4.cargo fmt --all -- --checknode ci/check-file-docs.mjsnode ci/check-layers.mjscargo test -j4 -p calternal-store -- --test-threads=4cargo clippy -j4 --workspace --all-targets -- -D warningscargo test -j4 --workspace -- --test-threads=4cargo build -j4 --release --bin calternalnode ci/check-size-budgets.mjsThe 22 ignored cases are retained by name in the evidence; these include perf/stress/internet cases and a child helper. They were not run by the workspace command. The controlled perf workload and its failures remain recorded separately in the full gate report.
Baseline size failures: NoteList.svelte 569/567, fsio/src/lib.rs 576/551, notes/src/home.rs 905/902. No ceilings raised. Dev plus the two new behavior tests fails as intended; both pass on the candidate. The first shared-target verification attempt used a stale dev executable and is explicitly discarded, with its log retained for audit; all candidate claims above use the fresh target.
The job exited 0, its temporary target/Nix scratch were removed, the collector fixture was removed, and no own index1051 build services remain active. The build VM worktree is clean. Both perf holds were already released.
Overall outcome is unchanged: performance gate FAIL, #1080 remains draft; #1064 unchanged. No speculative production patch after the misses. No merge.
raw commands, logs, ignored-case list and cleanup proof, SHA-256
dd91ef61c847a83fe10bae257684a0a1a8c362e960eabfe8ab1f1954b3c83921.round 2 of the index-only design: testing the orchestrator’s disk-contention hypothesis before any production patch. correlate explicit background index checkpoint start/end against the cold first-page request, direct journal API commits, SQL journal/history commits, and the six history main-DB sync overlaps. inspect the slowest cold invocations and slowest 20 commits, retaining all intervals and nearest-checkpoint distances.
Existing candidate soak traces contain 27 explicit background index checkpoints across the three arms. Initial correlation finds no overlap with any SQL journal/history commit. Cold/direct-journal phase logs were not retained in round 1, so collect a diagnostic-only controlled run with timestamps and the same fixtures. Diagnostic logging can perturb durations; no new performance gate or causal improvement claim will be based on those times. Retain the unchanged round-1 gate result.
Only if the traces support the contention hypothesis will production scheduling change. Otherwise report disproval/limitations and stop as requested. No delegates, no merge.
round 2 of the index-only design, unchanged production head
82ecc5a1e95c6febe2eb8241c69db800ac791a00: the concurrent background-checkpoint hypothesis is disproved for the traced workload. stopping without a production patch, as requested. #1080 stays draft; the five round-1 perf failures remain blockers. no qualification soak was rerun after this disproval.The retained soak has 27 explicit background PASSIVE checkpoint intervals. Every start/end was joined with request and commit windows; the evidence includes all intervals, not just the slowest. The slowest 20 SQL journal and history commits are retained both per arm and globally, with nearest-checkpoint timestamps/distances. Across each arm’s slowest 20, the closest gaps are 53.658 ms (journal) and 124.673 ms (history); the global slowest-20 journal set’s closest gap is 62.023 ms. The fresh run retains the slowest 20 journal API commits per invocation and across all candidate invocations, plus every cold invocation.
The only background checkpoint in the fresh diagnostics is in
journal-4-3-cand: start1794426291868453, end1794426291883945Unix µs. The final measured API commit ended at1794426291767287, 101.166 ms earlier. It cannot account for those preceding measured commits. Other fresh candidate journal invocations contain no background checkpoint.The six history main-DB fsyncs that overlapped save requests in round 1 are separate from index checkpoint work:
Protocol: both original server binaries match round 1’s SHA-256 hashes. Diagnostic probes add request/API timestamps and a tracing subscriber for the direct journal path; no production checkpoint policy changes. Probe sources and lockfiles are retained. Build command:
~/bin/slot nix developon dev-01, thencargo build -j4 --release --offline --features candidate --manifest-path <own-probe>/Cargo.tomlfor each side. Both succeed. Same fixtures, 40 journal observations and 80 cold/list observations, bracketed dev/dev + ABAB order (candidate 10 journal/20 cold; dev including controls 30 journal/60 cold). All 120 invocations exit successfully and all expected windows are present. Phase coverage is positive on the candidate; the retained soak and the single fresh checkpoint also confirm checkpoint logging works.The original cold and direct-journal invocations did not retain phase logs, so their precise historical tail events cannot be reconstructed. The fresh diagnostics fill that coverage gap; diagnostic logging changes timing and these durations are not replacement perf gates. These traces rule out the proposed direct overlap for the captured workloads. They do not establish the causes of the five regressions or exclude longer-lived indirect storage effects. No cause is invented, and no warmup/shared-busy-gate/page-policy patch is made without supporting evidence.
FIFO grant 01:11:58 IST on 12 november; both-lock measurement go 01:13:08; completed by 01:20:10; both own units stopped/inactive by 01:20:24. Own PIDs/cgroups are gone. Both fresh perf roots and the fresh build scratch were removed after collection. No own jobs or holds remain. No delegates, no merge. #1064 unchanged.
The round-1 gate table and functional gates remain unchanged. The max-save win does not waive journal commit p50/p95, cold first-page p95/p99 or history overlap failures.
index1051-round2-analysis.tar.gz, SHA-256
77962f0b8100c38498416226c72134624cef9a8654de5682c45a725392137fd8.raw-diagnostics.tar.gz, SHA-256
7744211b66a920d206a3e21a789cf77688e3af882db1bc9ae067d0cb2e7dcce2.Parked (kayg 11-12): both designs (#1064, #1080) cut the worst save ~38% but regress cold first-page / journal commit for unexplained reasons. Revisit with a deeper profiling pass after the Notes Float release. Drafts #1064 and #1080 kept for reference.