Repository navigation
perf(build): write the database in one transaction - #950
Merged
Merged
Conversation
Every INSERT was an fsynced autocommit, on every PR and release: 43 s to 23 s on the full corpus. Also `git add -f` on the weekly URL cache, which is gitignored and so has never been committed. Part of AUREO-1470 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013X2d8vEWjRnkZydpXo94JF
|
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of AUREO-1470
Summary
scripts/build-sqlite.ts:populateDatabaseruns inside onedb.transaction(...)()withsynchronous = OFF, afterschema.sqlhas switched the file to WAL. VACUUM and ANALYZE move tobuildDatabaseafter the commit (they cannot run inside a transaction). On error the handle is closed, the partial file is removed and the error rethrown, so a failed build never leaves a database that looks complete..github/workflows/url-health.yml:git add -fon.github/url-cache.json. The file is in.gitignorefor localpnpm validate-urlsruns, sogit addwithout-fexited 1 underset -eand the weekly cache has never been committed; every Monday rechecked about 28k URLs cold inside the 60-minute timeout.CLAUDE.md: a bullet under Catalog Schema Compatibility recording why the schema runs before the transaction and whyjournal_mode = OFFis not an option (better-sqlite3's defensive mode answers it withdelete).Measured
Full corpus, 21,164 entries, 17,075 products,
time pnpm build:The remaining time is YAML parsing and markdown rendering, not SQLite.
Verified against a build from the original code:
sqlite_masteridentical (187 objects), every table count equal, FTS queries identical,integrity_checkok. Onlycreated_at/updated_atdefaults and FTS5 internal segment tables differ. The WAL flag in the file header (bytes 18 and 19) is unchanged, so Studio reads the file as before. No schema change, noschema_versionbump.Test plan
pnpm build,pnpm test(37 files, 761 tests),pnpm typecheck,pnpm validate,pnpm format:checkpass locallychore: update URL cacheFrom the 2026-10-16 import pipeline review (racks session).
🤖 Generated with Claude Code
https://claude.ai/code/session_013X2d8vEWjRnkZydpXo94JF
Generated by Claude Code
Summary by CodeRabbit