Commit Graph

9917 Commits

Author SHA1 Message Date
Pekka Enberg
d5c49c17c7 perf/throughput: Delete database before benchmark run
Let's reduce variance between benchmark runs by starting with an empty
database.
2025-10-07 09:57:08 +03:00
Pekka Enberg
b52d6ab056 Merge 'core/mvcc: automatic logical log checkpointing on commit' from Pere Diaz Bou
On reaching 8 MiB checkpoint threshold we perform a blocking checkpoint
on the logical log. These changes modified how transaction_state is
tracked so that on a regular transaction we don't update it checkpoint's
state machine.
I wonder if checkpoint should stay inside commit's transaction locks or
like I did, where checkpoint happens right after committing transaction
but this happens on the same query during halt.

Closes #3565
2025-10-04 11:30:04 +03:00
Pekka Enberg
b063d0d41a Merge 'Don't panic if doing INSERT INTO ... SELECT rowid' from Jussi Saurio
Backport: 0.2
Closes #3567

Reviewed-by: Preston Thorpe <preston@turso.tech>

Closes #3572
2025-10-04 10:11:09 +03:00
Pekka Enberg
b81d45ae11 Merge 'remove dyn DatabaseStorage replace it with DatabaseFile' from Pedro Muniz
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #3566
2025-10-04 10:08:33 +03:00
Pekka Enberg
50607607fa Merge 'Actually enforce uniqueness in create unique index' from Jussi Saurio
we just weren't doing it 🤡
Backport: 0.2
Closes #3568

Reviewed-by: Preston Thorpe <preston@turso.tech>

Closes #3571
2025-10-04 10:07:44 +03:00
Pere Diaz Bou
e3f2bbf90b core/mvcc: remove unnecessary fields in CommitState::Checkpoint 2025-10-03 22:27:03 +02:00
Pere Diaz Bou
c612a51df7 fmt 2025-10-03 22:24:38 +02:00
Pere Diaz Bou
6c1983aadf core/vdbe: op_checkpoint set update_transaction_state logical log checkpoint to true 2025-10-03 22:24:38 +02:00
Pere Diaz Bou
8e80af7221 core/mvcc: checkpoint if needed after commit 2025-10-03 22:24:38 +02:00
Pere Diaz Bou
a30c95d988 core/mvcc/logical-log: add threshold for checkpoints in logical log 2025-10-03 22:24:33 +02:00
Jussi Saurio
81b437c690 Don't panic if doing INSERT INTO ... SELECT rowid
Closes #3567
2025-10-03 23:12:24 +03:00
Jussi Saurio
8dac1ba21a Fix: actually enforce uniqueness in CREATE UNIQUE INDEX
...we just didn't do it
2025-10-03 22:58:42 +03:00
Jussi Saurio
cb96c3e944 VDBE: implement SorterCompare
this is used for uniqueness enforcement in CREATE INDEX.
2025-10-03 22:58:42 +03:00
pedrocarlo
f3dc0bef5d remove some explicit Arc<dyn File> references 2025-10-03 16:39:57 -03:00
Pekka Enberg
1b42f77300 Merge 'Add short writes to unreliable-libc' from FamHaggs
Add short writes in the faulty_libc
As @PThorpe92 stated in #3209, this should be implemented here instead
of the memory io in the simulator. Running this in the stress test I
caught a logic bug in the try_pwritev_raw I will create a pr for that
small fix. I will close #3209 in favor of this pr.

Closes #3569
2025-10-03 21:52:47 +03:00
Pekka Enberg
c35896ab0f Merge 'core/io/unix: Fix short writes in try_pwritev_raw()' from FamHaggs
Fixes incorrect buffer length calculation in try_pwritev_raw when
handling the first slice of the I/O vector.
Why:
With the faulty libc tests, a short write was simulated and the code
incorrectly computed the length for the first buffer, leading to more
bytes being written than expected, leading to a panic inside the
completion.
How:
Adjusted the slice calculation to ensure only the intended range of
bytes is written.
Backport: 0.2

Reviewed-by: Preston Thorpe <preston@turso.tech>

Closes #3570
2025-10-03 20:50:58 +03:00
pedrocarlo
e93add6c80 remove dyn DatabaseStorage and replace it with DatabaseFile 2025-10-03 14:14:15 -03:00
FHaggs
af35f6534d Fix: Calculate right buff len in the case of the first buffer in
try_pwritev_raw.
2025-10-03 18:46:16 +02:00
FHaggs
dd6e092a5c Add short writes to pwritev in faulty_libc. 2025-10-03 18:35:03 +02:00
Pere Diaz Bou
55f5cd2ad7 core/mvcc/logical-log: test automatic checkpoint 2025-10-03 17:23:59 +02:00
Pere Diaz Bou
7db5a09005 core/mvcc/logical-log: checkpoint support not updating transaction_state if needed 2025-10-03 17:23:35 +02:00
Pekka Enberg
2efbb2d324 Merge 'add basic examples for database-wasm package' from Nikita Sivukhin
Closes #3558
2025-10-03 17:21:25 +03:00
Pekka Enberg
0dd8307ea2 Merge ' core/wal: introduce transaction_count, same as iChange in sqlite ' from Pere Diaz Bou
Depends on #3502
sqlite has a field in index header called `iChange` that is incremented
after every commit. This commit simply adds support for it.
```c
struct WalIndexHdr {
  u32 iVersion;       /* Wal-index version */
  u32 unused;         /* Unused (padding) field */
  u32 iChange;        /* Counter incremented each transaction */
```

Closes #3559
2025-10-03 16:53:35 +03:00
Pere Diaz Bou
9c9d4d147e core/btree: fuzz tests force page 1 allocation with a transaction 2025-10-03 13:28:28 +02:00
Pere Diaz Bou
8f103f7c35 core/wal: introduce transaction_count, same as iChange in sqlite 2025-10-03 13:02:47 +02:00
Pekka Enberg
c98bf9b593 Merge 'core/wal: check index header on begin_write_tx' from Pere Diaz Bou
Fixes a page cache staleness issue where connections could incorrectly
believe the database hasn't changed after checkpointing. This can happen
when writes following a checkpoint resulted in the same `max_frame
value`, causing connections to miss updates since they only checked
`max_frame` to detect changes.

Closes #3502
2025-10-03 13:51:22 +03:00
Nikita Sivukhin
f582744819 fix package jsons 2025-10-03 14:44:15 +04:00
Nikita Sivukhin
82d53f8d06 add sync-wasm-vite example 2025-10-03 14:43:23 +04:00
Nikita Sivukhin
d4373379cd remove wasm example 2025-10-03 14:20:18 +04:00
Nikita Sivukhin
17c99de34f accept libsql:// urls generated by the platform 2025-10-03 14:19:36 +04:00
Nikita Sivukhin
515ccfea76 small adjustment 2025-10-03 14:19:07 +04:00
Nikita Sivukhin
73049a0205 add sync node example 2025-10-03 14:18:52 +04:00
Pere Diaz Bou
b5a969933c core/wal: remove dbg! 2025-10-03 12:17:35 +02:00
Pekka Enberg
7d45253d03 Merge 'Disallow unexpected interop between WAL mode and MVCC mode' from Jussi Saurio
1. DB cannot be opened with MVCC if non-zero WAL file exists
2. DB cannot be opened without MVCC if non-zero logical log file exists

Closes #3557
2025-10-03 12:55:03 +03:00
Pekka Enberg
5c0b3313f2 Add encryption at rest feature to README 2025-10-03 12:32:01 +03:00
Nikita Sivukhin
b67ef8a7eb add basic examples for database-wasm package 2025-10-03 13:23:59 +04:00
Pekka Enberg
7905841990 Turso 0.2.0 2025-10-03 12:20:42 +03:00
Pekka Enberg
91983abaa5 Update CHANGELOG.md 2025-10-03 12:20:20 +03:00
Jussi Saurio
ec6731de0a Disallow unexpected interop between WAL mode and MVCC mode
1. DB cannot be opened with MVCC if non-zero WAL file exists
2. DB cannot be opened without MVCC if non-zero logical log file exists
2025-10-03 12:00:35 +03:00
Pekka Enberg
3867e5a60e Merge 'CI: run long fuzz tests and stress on every PR, use 2 threads for stress' from Jussi Saurio
Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #3556
2025-10-03 11:49:20 +03:00
Pekka Enberg
3b1d2535de Turso 0.2.0-pre.15 2025-10-03 11:29:43 +03:00
Pekka Enberg
d9e607082f Merge 'Disallow INDEXED BY / NOT INDEXED in select' from Jussi Saurio
Closes #3547

Closes #3551
2025-10-03 11:29:13 +03:00
Pekka Enberg
87a6a90fdf Merge 'core/mvcc: Rename "-lg" to "-log"' from Pekka Enberg
The "lg" name is just weird.

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #3554
2025-10-03 11:28:54 +03:00
Jussi Saurio
653f9323c3 Update .github/workflows/long_fuzz_tests_btree.yml
Co-authored-by: Pere Diaz Bou <30913090+pereman2@users.noreply.github.com>
2025-10-03 11:18:09 +03:00
Jussi Saurio
509486bc05 CI: run long fuzz tests and stress on every PR, use 2 threads for stress 2025-10-03 11:12:01 +03:00
Pekka Enberg
297aaf4887 core/mvcc: Rename "-lg" to "-log"
The "lg" name is just weird.
2025-10-03 10:08:02 +03:00
Pekka Enberg
ced8284fa0 Merge 'fix sync-engine bug when auth token is provided as dynamic function' from Nikita Sivukhin
Closes #3553
2025-10-03 09:53:23 +03:00
Pekka Enberg
dcbbd99d00 Merge 'docs: Document more CLI command line options' from Pekka Enberg
Closes #3550
2025-10-03 09:53:04 +03:00
Pekka Enberg
d93846c010 Merge 'Update man pages for encryption' from Avinash Sajjanshetty
Closes #3552
2025-10-03 09:52:06 +03:00
Nikita Sivukhin
9a82a9509f fix sync-engine bug when auth token is provided as dynamic function 2025-10-03 10:50:54 +04:00