Files
turso/core
Pekka Enberg 90e035b6b0 Merge 'Rollback schema support' from Pere Diaz Bou
Fixes #1890
Once rollback was implement we quickly saw that it lacked support for
schema changes so we had to re-estructure things a bit.
## Example of failure:
```bash
turso> begin;
turso> create table t(x);
turso> rollback;
turso> pragma integrity_check;
thread 'main' panicked at core/storage/sqlite3_ondisk.rs:386:36:
called `Result::unwrap()` on an `Err` value: Corrupt("Invalid page type: 83")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
This happened because it thought table `t` existed because we didn't
rollback that schema.
## Changes:
* The most important change: now every connection has a private copy of
schema. On write txn commit we update a global schema shared between
connections in order for new connections to get updated version from
there. In case of rollback, we simply change connection's schema to
previous version. This change allowed us to remove locks for schema
private copy and keeping schema changes locally in case of concurrency.
 Sqlite does things differently, they lazily parse schema in case of
outdated schema, this many schema changes to trigger reading schema from
db file which is slow. If we are able to keep local copy in memory, even
when if we add multiprocessing, it will speed up schema reloading by a
bunch.
* `schema_cookie` is now update for every schema change
* `Insn::ParseSchema` had a nasty bug where it would commit all the
changes made in a query that changed a schema, we fixed that by setting
`auto_commit` to `false` before parsing schema, and setting it back to
previous value once schema is parsed.

Closes #1928
2025-07-03 14:18:00 +03:00
..
2025-06-30 10:29:34 +03:00
2025-06-23 19:52:13 +01:00
2025-06-29 12:14:08 +03:00
2025-06-23 19:52:13 +01:00
2025-06-23 19:52:13 +01:00
2025-06-23 19:52:13 +01:00
2025-06-30 10:01:03 +03:00
fmt
2025-07-03 12:36:48 +02:00
2025-06-23 19:52:13 +01:00
2025-01-28 14:55:38 -05:00
2025-06-23 19:52:13 +01:00
2025-01-28 14:55:38 -05:00
2025-07-03 12:36:48 +02:00
2025-06-23 19:52:13 +01:00
2024-12-24 18:04:30 +01:00
2025-07-03 12:53:15 +02:00
2025-06-30 10:29:34 +03:00
2025-06-30 09:54:13 +03:00