Tiering: simplest split (v4 plan) #1069
Open
opened 2026-11-11 08:23:18 +00:00 by kayg
·
6 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#1069
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?
Intent
Keep the ADR 0062 layout: two real Home trees with the same relative folders, one on SSD and one on HDD, plus app state in
.calternal/on SSD. The trees contain ordinary files; the app presents their union. Tiering must not add work to dev's hot read, append, or list paths, or add a new cold-start database/backfill.Approaches
notes/ids.jsonland the existing list/search indexes. Add one location bit to the existing per-file record and select the configured root when opening that path. This preserves the current lookup and listing algorithms.Layout and request paths
The SSD and HDD roots share relative paths and folder names; each final file exists in its selected tree. The third root,
.calternal/, holds current app state, including the existing IDs log, metadata indexes, history, journal, and attachment index.Keep each existing identity record's logical path unchanged. Add an optional
hdd: truebit to records whose file is on HDD; absence means SSD after the explicit offline migration. At runtime, the existing ID lookup returns the same path and the existing in-memory slot carries that bit. File open/write selectsssd_home/pathorhdd_home/pathwith one root-prefix choice. Lists and searches continue using dev's current indexes and never merge directory scans. Existing index formats for other file owners stay in place; add the same bit only where an existing record points at a movable file. Do not create a shared current-file database.Use the existing content/plugin classifier for placement. A one-time explicit offline migration places current files and compacts existing ID records with their bit; it is not startup work. A later tier change is queued in background through the existing file/action worker. It records intent in the existing app journal, copies to a temporary file in the destination tree, fsyncs and verifies the bytes, then atomically renames the temp file within that tree. Under the existing per-file write guard, it rechecks the source version, durably appends the new location to
ids.jsonl, and only then removes and syncs the old copy. The room keeps accepting edits; if its current version changes during copy, the move retries or waits. A new location becomes visible to app readers at the durable index update. The existing history-before-file and one-second materialization rules still apply.Cost
O(N + L)replay, whereNis live files andLis log bytes; no second scan, sort, table, or backfillO(1); one stored bit selects one rootO(log N + page); no two-tree joinO(B)copy and verify for a file ofBbytes, plus a fixed number of journal, file, and directory syncsO(F + B)pass overFfiles and theirBbytes; never on cold request/startupThe bit is one logical bit per file. An HDD record adds about 11 JSON bytes for
,"hdd":true; 100k such records add about 1.1 MB to the log. A move needs at most one extra file-sized destination copy while it is staged; after cleanup only one final copy remains. The existing list indexes and app state add no new tables.Failure → effect → detection → recovery → test
What v4 drops from v3
Drop
files/current.db, its SQLite writer/commit syncs, projection watermark and backfill, the separate compact ID map and its cache cap, sidecar sort indexes/counts, per-request database lookup, and request-path yields/reconciliation. Keep the ADR 0062 three-root layout, ordinary files, the existingids.jsonlwriter/lookup, current list/search indexes, and the existing crash/recovery guards.Qualification
Use the same perf harness and fixtures as #970 at 1k, 10k, and 100k, with cold and warm paths, five ABAB rounds, and a dev-copy control in the same perf session. Every measured metric must be at or below its dev-copy bound. Also run the move-crash and kill-while-typing cases above. Stop the prototype at the first failed metric and report its exact name and cause.
Clarification: v4 preserves existing dev behavior, including the current startup yield in
Notes::initialize_home; it adds no new yield, reconciliation, or request-path work. “Yields/reconciliation” in the v3 drop list means v3-only additions. The optional tier bit is decoded as part of the existing identity record; there is no second log pass or new cold-start database.v4 prototype performance result: FAIL, stopping here
Head
c933a5222a51c362bce5e3581786671f58e36a5b; comparatororigin/dev437f9ec8923b3d380506f48a77eb11493ef66fb0. Release binary SHA-256 values: devcc0f469bdb4f40977981d018b1d535ef6e110a7e739b6da4c9694597cf66bafc, v4a4921c2a7d85ebea40a316fdde2bdbaf0ff6df206d935ef6d0936d0d357ba177. The #970 harness SHA-256 isb36826873bb855fec4796ffe949170786f3ad8faa87f348fc0cc7f5f202ae4a2.Method: five rounds of control A → v4 A → dev-copy control B → v4 B. Each arm used
--sizes 1000,10000,100000 --runs 1 --cold-runs 1 --seed 1 --idle-secs 0 --soak-secs 0 --hot-only, through~/bin/slot, underperf-turn tiering-v4-20261111and both perf locks. All 20 arms exited 0. Candidate UCB is the upper 95% percentile-bootstrap bound over five paired geometric-mean ratios. The dev-copy UCB is the upper bound for control B/control A. The gate is candidate UCB ≤ dev-copy UCB.cold.notes_per_sis inverted so higher ratios mean slower throughput.The exact #970 cold/warm Notes gate table follows. Thirteen of 30 size/metric rows fail.
Failure causes and scope
cold.first_pageis 1.064 UCB vs 0.988 control UCB;cold.indexand invertedcold.notes_per_sare 1.043 vs 1.000. Incrates/notes/src/index.rs,put_withnow callstier_of(id)beforeput_with_tier; that adds a hash lookup for each path update during cold identity updates and is consistent with the cold slowdown.Slot; this run does not distinguish a slot-layout/cache effect from run variation, so the measured upper-bound excess is the supported cause.cold.disk_writtenUCB is 1.006 vs a 1.000 dev-copy bound. SSD rows omithdd:falseduring serialization, so this run does not attribute the small write delta to longer identity records. The gate still fails.The prototype is not an end-to-end split-root implementation: the move primitive is not wired into Home reads/writes, and Notes still uses one
notes_dir. This run measured the identity-record change with the harness's single-root mode; it does not qualify SSD/HDD root selection or tiered moves.Correctness checks passed before measurement:
cargo fmt --all -- --check;cargo test -j4 -p calternal-notes(579 passed, 0 failed, 6 ignored);tier_move::tests::killed_tier_move_retries_from_copy_or_both_copies;storage_crash::kill9_after_ack_during_split_hdd_save_recovers_exact_text.Scope overlap: PR #1010 tracks adjacent dev-native Home identity and root-validation work. This v4 prototype stays limited to the Notes identity tier bit and crash-safe move primitive; it does not modify #1010.
v5 — split roots, no tier metadata
This supersedes v4. Each file has one relative path under
ssd_root(today's Notes/Home) and its mirror under optionalhdd_root. There is no tier field in the index, Slot, notes records, or per-row state. App state stays on SSD.Reads open SSD first and try HDD only on ENOENT. If both opens miss, retry SSD once to close a move/write ENOENT race, then return not found. Writes publish durably to SSD; duplicate HDD cleanup runs in background after SSD durability, with startup cleanup retrying any duplicate. The mover is background-only and rate-limited: copy to an HDD-side
.tmp, fsync it, rename within HDD, fsync that directory, then unlink SSD and fsync its directory. Listing and watching cover the union; SSD wins duplicates. A singlehdd_nonemptyflag skips the HDD walk when empty. Withhdd_rootunset, dispatch stays on dev's existing code path.Gates: crash-test each write/move boundary plus ENOENT/EXDEV; unit-test union, precedence, cleanup, and single-root behavior. On perf VMs, run five ABAB rounds with dev-copy controls at 1k/10k/100k for cold first_page/index, home.page_big, open.api_get, warm open, save p50/p95/p99, and disk_written. Run both single-root and split with 0% HDD; candidate bounds must stay within dev-copy bounds. If control spread exceeds ~5%, add rounds until it tightens. Report only for 80% HDD: cold HDD open and mover cost while saving. Build/test on dev-01 through Nix/slot; measure only through perf-turn (each turn ≤90 min). No PR unless every gate passes.
v5 implementation scope
PR #1010 is open and also touches Notes Home/scan/watcher roots. This branch stays based on the requested
origin/devhead and does not pull in its unmerged Files identity/index layer; the v5 gate requires the existing Notes index to remain byte-for-byte unchanged. I will keep v5 limited to Notes root I/O, union discovery, and the background move/duplicate cleanup path. This leaves possible merge conflicts in shared Notes files if #1010 lands first; I will not edit that branch.Planned boundaries: a new Notes split-root helper owns SSD-first reads, safe relative paths, copy/fsync/publish/unlink, and crash hooks; Home/Notes carries only the optional HDD root and one non-empty flag; scan/watch/meta call the helper for union behavior; the server exposes the optional root for the prototype; tests cover every durable boundary and single-root dispatch. Then remote correctness gates, the requested perf matrix, and a PR only if every gate passes.
v5 recovery status
72b600edefa154a7e4f611fb884545fdc802177aon pushedfeat/tiering-v5, based onorigin/devbe968d9df0c759d4200c50d8d8396990cd43338f.calternal-perf.