Files
turso/sql_generation
Glauber Costa e6f0981b43 simulator: correct MVCC rowid assumptions and validation
Under MVCC, implicit rowid allocation behaves like a sequence: the next
value comes from a high-water mark that a rollback does not lower, so an
aborted insert consumes its rowid for good and the next insert skips
past it. This is deliberate — we do not guarantee that a rolled-back
allocation is handed back, matching PostgreSQL sequences, where nextval
is never rolled back and aborted transactions leave permanent gaps.
(AUTOINCREMENT already behaved this way; the same rule now covers plain
INTEGER PRIMARY KEY rowids.) WAL mode, like SQLite, reuses the freed
value.

The simulator makes exact-row assertions, and it cannot predict a
post-rollback rowid without modeling that watermark. Rather than model
it, generate explicit integer primary keys in MVCC INSERT and UPSERT
workloads, so the assertions no longer assume rolled-back allocations
come back. WAL mode keeps generating implicit keys.

Check MVCC integrity with Turso, which can read the logical-log state
SQLite cannot, and keep the SQLite integrity check for WAL. Export the
logical log from the in-memory I/O so a retained failure artifact
includes committed state.

Tests: 21 generator tests, the MVCC profile regression, and
deterministic integrity and export regressions pass.
2026-10-12 19:56:09 -05:00
..
…