Wrap FR24 import in a transaction (audit M2) #6

Merged
ronnyandre merged 1 commit from perf/fr24-import-transaction into main 2026-06-02 23:49:52 +02:00
Owner

Stacks on #4. Continues docs/audit-2026-06.md at M2.

Wraps the per-row FR24 import loop in db.transaction():

  • Batches all inserts into a single commit — large speedup vs. per-row fsync.
  • Makes the import crash-atomic (no partial committed state on an unexpected failure).
  • Per-row try/catch still isolates bad rows, so partial-success semantics are preserved (a single bad row does not roll back the rest).
  • Dedup is unaffected: better-sqlite3 sees its own uncommitted writes on the same connection.

Known limitation (noted in the doc): the import still blocks the event loop synchronously — inherent to better-sqlite3; only worth revisiting for very large imports.

Verified: pnpm typecheck, pnpm lint, pnpm test (40/40) all pass.

Base is test/duration-distance-coverage; retarget down the stack as #3/#4 merge.

Stacks on #4. Continues `docs/audit-2026-06.md` at **M2**. Wraps the per-row FR24 import loop in `db.transaction()`: - Batches all inserts into a single commit — large speedup vs. per-row fsync. - Makes the import crash-atomic (no partial committed state on an unexpected failure). - Per-row `try/catch` still isolates bad rows, so **partial-success semantics are preserved** (a single bad row does not roll back the rest). - Dedup is unaffected: better-sqlite3 sees its own uncommitted writes on the same connection. Known limitation (noted in the doc): the import still blocks the event loop synchronously — inherent to better-sqlite3; only worth revisiting for very large imports. Verified: `pnpm typecheck`, `pnpm lint`, `pnpm test` (40/40) all pass. > Base is `test/duration-distance-coverage`; retarget down the stack as #3/#4 merge.
Wrap the per-row import loop in db.transaction(): batches all inserts into a
single commit (large speedup vs. per-row fsync) and makes the import
crash-atomic. The per-row try/catch still isolates bad rows, so partial-success
semantics are preserved (one bad row no longer leaves uncommitted partial state
on an unexpected failure). Dedup is unaffected — better-sqlite3 sees its own
uncommitted writes on the same connection.

Stacks on test/duration-distance-coverage (PR #4).
ronnyandre force-pushed perf/fr24-import-transaction from 73f61586df to 30665fd662 2026-06-02 23:48:51 +02:00 Compare
ronnyandre changed target branch from test/duration-distance-coverage to main 2026-06-02 23:49:00 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
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
ronnyandre/fliary!6
No description provided.