Repository navigation
Conversation
pingdotgg#24194 set temp_store = MEMORY so SQLite temp files stop blocking the server. That pragma runs only on the writer. The reader workers added for concurrent reads open their own connections and set only busy_timeout, so every read that sorts or builds a temp table spills to a file in the system temp directory. Each reader now sets temp_store = MEMORY when it opens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Problem
#24194 set
PRAGMA temp_store = MEMORYso SQLite temp files would stop blocking the server. That pragma runs only on the writer connection. The reader workers added later for concurrent reads (#27979) open their own connections and set onlybusy_timeout. So every read that sorts or builds a temp table still spills to a file in the system temp directory (SQLITE_TMPDIR,TMPDIRor/var/tmp).I found it on a Linux desktop whose temp directory sat on a slower disk than the T3 database. Under load, the server's
WorkerThreads, which are the SQLite reader workers, kept appearing in uninterruptible sleep inbalance_dirty_pages. In 13 of 84 stuck-thread samples, a worker was inpwrite64on a deleted/var/tmp/etilqs_*file. During that window the server's SQLite span p99 was 225 ms and the slowest span took 25.7 s. Moving/var/tmpto a fast disk cut that p99 to 86 ms, which points at these temp files.Change
nodeSqliteClient's worker source runsPRAGMA temp_store = MEMORYright afterbusy_timeoutwhen a worker opens its connection. Readers get no pragmas from callers, since callers configure the writer throughSqlClient, so this is the one place a reader's connection settings are made. A writer worker also runs it at open, and caller pragmas run afterwards and still override it.Scope
A small fix to a regression of #24194. It needs no separate issue.
Verification
keeps a reader's sorts and temp tables in memory, not in temp files. It readsPRAGMA temp_storeinsideSqliteClient.readOnly. Before the fix:expected +0 to equal 2. After: it passes. All 37 tests innodeSqliteClient.test.tspass.ELECTRON_RUN_AS_NODE=1), SQLite 3.53.4, compiled withTEMP_STORE=1. A read-only connection that sorts 200,000 rows of a 22 MB WAL database, with the worker's settings (busy_timeoutonly), opened one$SQLITE_TMPDIR/etilqs_*file (counted withstrace -e openat). Withtemp_store = MEMORYit opened none.pnpm run typecheckinpackages/sharedpasses. The commit hooks (vp fmt,vp lint,knip:check) pass.Not checked: the full server under load with this build. The evidence above comes from the installed release plus the isolated probe.
Created with Claude Opus 5.5 in Claude Code.