debugging
glommer/pgmicro/.claude/skills/debugging/SKILL.md
How to debug tursodb using Bytecode comparison, logging, ThreadSanitizer, deterministic simulation, and corruption analysis tools
Skill1.2k starsChanged 6 months ago
What's in it
- Debugging Guide
- Bytecode Comparison Flow
- Example
- Manual Query Inspection
- Logging
- Threading Issues
- Deterministic Simulation
- Architecture Reference
- Corruption Debugging
--- name: debugging description: How to debug tursodb using Bytecode comparison, logging, ThreadSanitizer, deterministic simulation, and corruption analysis tools --- # Debugging Guide ## Bytecode Comparison Flow Turso aims for SQLite compatibility. When behavior differs: ``` 1. EXPLAIN query in sqlite3 2. EXPLAIN query in tursodb 3. Compare bytecode ├─ Different → bug in code generation └─ Same but results differ → bug in VM or storage layer ``` ### Example ```bash # SQLite sqlite3 :memory: "EXPLAIN SELECT 1 + 1;" # Turso cargo run --bin tursodb :memory: "EXPLAIN SELECT 1 + 1;" ``` ## Manual Query Inspection ```bash cargo run --bin tursodb :memory: 'SELECT * FROM foo;' cargo run --bin tursodb :memory: 'EXPLAIN SELECT * FROM foo;' ``` ## Logging ```bash # Trace core during tests RUST_LOG=none,turso_core=trace make test # Output goes to testing/test.log # Warning: can be megabytes per test run ``` ## Threading Issues Use stress tests with ThreadSanitizer: ```bash rustup toolchain install nightly rustup override set nightly cargo run -Zbuild-std --target x86_64-unknown-linux-gnu \ -p turso_stress -- --vfs syscall --nr-threads 4 --nr-iterations 1000 ``` ## Deterministic Simulation Reproduce bugs with seed. Note: simulator uses legacy "limbo" naming. ```bash # Simulator RUST_LOG=limbo_sim=debug cargo run --bin limbo_sim -- -s <seed> # Whopper (concurrent DST) SEED=1234 ./testing/concurrent-simulator/bin/run ``` ## Architecture Reference - **Parser** → AST from SQL strings - **Code generator** → bytecode from AST - **Virtual machine** → executes SQLite-compatible bytecode - **Storage layer** → B-tree operations, paging ## Corruption Debugging For WAL corruption and database integrity issues, use the corruption debug tools in [scripts](./scripts). See [references/CORRUPTION-TOOLS.md](./references/CORRUPTION-TOOLS.md) for detailed usage.
More agent context in glommer/pgmicro
13 other files this repository gives its agents.
AGENTS.md
CLAUDE.md
Skill
- async-io-model.claude/skills/async-io-model/SKILL.md
- cdc.claude/skills/cdc/SKILL.md
- code-quality.claude/skills/code-quality/SKILL.md
- differential-fuzzer.claude/skills/differential-fuzzer/SKILL.md
- index-knowledge.claude/skills/index-knowledge/SKILL.md
- memory-benchmark.claude/skills/memory-benchmark/SKILL.md
- mvcc.claude/skills/mvcc/SKILL.md
- pr-workflow.claude/skills/pr-workflow/SKILL.md
- storage-format.claude/skills/storage-format/SKILL.md
- testing.claude/skills/testing/SKILL.md
- transaction-correctness.claude/skills/transaction-correctness/SKILL.md
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
No reports yet. Be the first to say whether it worked.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool registry_write, action report. How to connect one.

