npx skills add smithery/tursodatabase --skill transaction-correctness
tursodatabase/turso
transaction-correctness
How WAL mechanics, checkpointing, concurrency rules, recovery work in tursodb
Installation
npx skills add tursodatabase/turso --skill transaction-correctness
Similar popular skills
Related neighbors and high-traction skills in the same topics — useful to compare before installing.
Azure Storage Services including Blob Storage, File Shares, Queue Storage, Table Storage, and D…
567.1K installsQuery and analyze data in Azure Data Explorer (Kusto/ADX) using KQL for log analytics, telemetr…
566.2K installsPostgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill …
391.6K installsGuides for configuring Prisma with different database providers (PostgreSQL, MySQL, SQLite, Mon…
269.8K installsPrisma Client API reference covering model queries, filters, operators, and client methods. Use…
269.3K installsPrisma ORM CLI commands reference covering init, generate, migrate, db, dev, complete, studio, …
267K installsAlso in this package
Other skills from tursodatabase/turso · top by installs.
npx skills add tursodatabase/turso
More details
Agent compatibility
Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.
Also listed on
Alternate registries and mirrors of this skill.
Repository health
main
Package contents
Files included with this skill beyond the listing page.
-
skill md
SKILL.md3,066 B -
docs
SUMMARY.md196 B
History
- First seen on skills.sh
- First recorded snapshot · 1,128 installs
SKILL.md
Transaction Correctness Guide
Turso uses WAL (Write-Ahead Logging) mode exclusively.
Files: .db, .db-wal (no .db-shm - Turso uses in-memory WAL index)
WAL Mechanics
Write Path
- Writer appends frames (page data) to WAL file (sequential I/O)
- COMMIT = frame with non-zero db_size in header (marks transaction end)
- Original DB unchanged until checkpoint
Read Path
- Reader acquires read mark (mxFrame = last valid commit frame)
- For each page: check WAL up to mxFrame, fall back to main DB
- Reader sees consistent snapshot at its read mark
Checkpointing
Transfers WAL content back to main DB.
WAL grows → checkpoint triggered (default: 1000 pages) → pages copied to DB → WAL reused
Checkpoint types:
- PASSIVE: Non-blocking, stops at pages needed by active readers
- FULL: Waits for readers, checkpoints everything
- RESTART: Like FULL, also resets WAL to beginning
- TRUNCATE: Like RESTART, also truncates WAL file to zero length
WAL-Index
SQLite uses a shared memory file (-shm) for WAL index. Turso does not - it uses in-memory data structures (frame_cache hashmap, atomic read marks) since multi-process access is not supported.
Concurrency Rules
- One writer at a time
- Readers don't block writer, writer doesn't block readers
- Checkpoint must stop at pages needed by active readers
Recovery
On crash:
- First connection acquires exclusive lock
- Replays valid commits from WAL
- Releases lock, normal operation resumes
Turso Implementation
Key files:
- [WAL implementation](../../../core/storage/wal.rs) - WAL implementation
- [Page management, transactions](../../../core/storage/pager.rs)
Connection-Private vs Shared
Per-Connection (private):
Pager- page cache, dirty pages, savepoints, commit stateWalFile- connection's snapshot view:
- maxframe / minframe - frame range for this connection's snapshot - maxframereadlockindex - which read lock slot this connection holds - last_checksum - rolling checksum state
Shared across connections:
WalFileShared- global WAL state:
- framecache - page-to-frame index (replaces .shm file) - maxframe / nbackfills - global WAL progress - readlocks[5] - read mark slots (TursoRwLock with embedded frame values) - writelock - exclusive writer lock - checkpoint_lock - checkpoint serialization - file - WAL file handle
DatabaseStorage- main.dbfileBufferPool- shared memory allocation
Correctness Invariants
- Durability: COMMIT record must be fsynced before returning success
- Atomicity: Partial transactions never visible to readers
- Isolation: Each reader sees consistent snapshot
- No lost updates: Checkpoint can't overwrite uncommitted changes