Turso MVCC Sequences
Add MVCC-safe sequences and AUTOINCREMENT to the Turso database engine so concurrent transactions get consistent, gap-tolerant ids.
Results
Each square represents one run. Score is the percentage of runs that pass: 0, 25, 50, 75, or 100 for four runs.
| # | Model | Rollouts | Pass@1 | Score | Time |
|---|---|---|---|---|---|
| 1 | GPT-6.1 Sol max | 3/4 | 7.1h | ||
| 2 | Claude Sonnet 5.5 max | 3/4 | 6.8h | ||
| 3 | GPT-6 Astra xhigh | 2/4 | 5.8h | ||
| 4 | Claude Opus 5.5 max | 2/4 | 4.4h | ||
| 5 | GPT-5.6 Sol max | 0/4 | 2.9h | ||
| 6 | Gemini 3.8 Flash high | 0/4 | 1.8h | ||
| 7 | Qwen3.8 Max xhigh | 0/4 | 5.3h | ||
| 8 | GLM 5.3 Flash max | 0/4 | 7.5h | ||
| 9 | Muse Spark 1.3 max | 0/4 | 4.9h | ||
| 10 | Kimi K3 max | 0/4 | 5.4h | ||
| 11 | Grok 4.7 xhigh | 0/4 | 2.9h |
Background
Turso rewrites SQLite in Rust, keeping its file format while adding an experimental MVCC engine with BEGIN CONCURRENT transactions. Applications ported from PostgreSQL expect named sequences (CREATE SEQUENCE, nextval, currval, setval), which Turso lacks, and in MVCC mode AUTOINCREMENT is refused because SQLite's sqlite_sequence row is a hot spot every concurrent writer conflicts on. The agent adds both, matching upstream #7137. Both are persistent counters shared by many connections and processes: they must never hand the same value to two committed transactions, must not cause MVCC conflicts, and must survive checkpoints, restarts, crashes and journal-mode switches.
Task
The agent implements CREATE SEQUENCE and DROP SEQUENCE with a pinned grammar, and nextval, currval and setval as scalar functions usable anywhere including column defaults. Semantics follow PostgreSQL (option defaults, CYCLE wrap-around, exhaustion errors, per-connection currval) with stated exceptions. Values are 64-bit integers that never overflow silently. Inside BEGIN CONCURRENT, nextval does not conflict and its value stays consumed on rollback. AUTOINCREMENT keeps SQLite's documented guarantees in every journal mode, works in MVCC mode including on tables created before MVCC was enabled, and concurrent inserts never conflict on its bookkeeping. Only the committed HEAD is graded.
Workspace
The offline sandbox (4 CPUs, 8 GB, 8 hours) holds a Turso checkout at the parent of the upstream merge, the pinned Rust toolchain with locked crates offline, and a prebuilt debug target for incremental rebuilds. Test runners work in both WAL and MVCC modes, with example tests provided. The hidden scenarios are held out.
Verification
The committed tree is built from a clean checkout with the verifier's test files. Every existing test suite in WAL and MVCC mode must still pass, and upstream's feature tests must pass with error messages relaxed to 'is an error'. Four scripted families compare statement by statement with the upstream build: sequence arithmetic, multi-connection MVCC use, and AUTOINCREMENT across deletes, renames, VACUUM, checkpoints and journal-mode switches. Five families run concurrent races and killed processes, judged on invariants. Every family must pass all draws, except the most contended MVCC race, which may fail one.
Environment
- Toolchain
- Rust
- Compute
- 4 CPUs · 8 GB RAM
- Network
- Offline
- Time limit
- 8 hours
References
- Turso: The database engine the agent extends; #7137 added sequences and MVCC-safe AUTOINCREMENT upstream.
- PostgreSQL documentation: CREATE SEQUENCE: The governing standard for sequence options, defaults and behavior.
- SQLite: The AUTOINCREMENT Keyword: The guarantees AUTOINCREMENT must keep in every journal mode.