Skip to content

Commit 6fc711e

Browse files
committed
plan: slice 010 names its pragmas and reserves a second database file for receipts
Change 3 of the 2026-09-20 plan; waits on nothing. synchronous: :normal and the WAL checkpoint threshold are stated in config rather than inherited; the stress test reports checkpoint stalls and the -wal size. A Trinity.Repo.Receipts slot is declared and unused so that slice 024 can put its chain on synchronous: :full in its own file without moving the primary later. Two risk lines added. plan_check: PASS. Signed-off-by: Ayla Croft <aylacroft@proton.me>
1 parent 54b1546 commit 6fc711e

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

  • slices/010-core-domain-persistence

‎slices/010-core-domain-persistence/SLICE.md‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@ Data outlives processes. Everything later rehydrates from these tables.
1717

1818
## Scope
1919
**In:**
20-
- Repo config: SQLite path from `Trinity.Paths.data_dir/0`, `journal_mode: :wal`, `busy_timeout`, pool size 1 for the write pool; optional read pool.
20+
- Repo config: SQLite path from `Trinity.Paths.data_dir/0`, `journal_mode: :wal`, `synchronous: :normal` stated
21+
explicitly rather than inherited from the adapter's default, `busy_timeout`, a WAL checkpoint threshold set and
22+
named in config (the adapter's default is the starting value; the stress test below reports checkpoint stalls
23+
if any), pool size 1 for the write pool; optional read pool. (Amended 2026-09-20.)
24+
- **A slot for a second database file.** The Repo layout admits a second SQLite file for receipts later
25+
(`Trinity.Repo.Receipts`, declared and unused here) so that slice 024 can run its chain on `synchronous: :full`
26+
in its own file without moving the primary. One file at this slice; the slot is the whole change. (Amended
27+
2026-09-20.)
2128
- **Data-dir lock at boot.** The single-writer pool makes concurrent writes safe *within one BEAM node*. It does
2229
nothing about two OS processes on one database file, which is exactly the failure `docs/00-vision.md` claims to
2330
fix. Slice 061 ships a headless profile and slice 100 ships a desktop app; nothing today stops them sharing a
@@ -67,3 +74,7 @@ If that changes during the slice, the criterion is retagged and this section is
6774

6875
## Risks / open questions
6976
- `ecto_sqlite3` and Oban Lite both want the same file; confirm pool settings when Oban arrives (050).
77+
- WAL checkpoint starvation under a continuous writer: the stress test is the place it would show, as a
78+
growing `-wal` file or a stalled append; report the file size after the run either way.
79+
- `synchronous: :normal` under WAL can lose the last transaction on power loss and never corrupts. That is the
80+
right trade for sessions and messages; the receipts file (slice 024) decides its own setting.

0 commit comments

Comments
 (0)