Commit Graph

4950 Commits

Author SHA1 Message Date
Zaid Humayun
20e20b8a32 Larger compiler directive. Addresses https://github.com/tursodatabase/limbo/pull/1600#discussion_r2115820195
this commit places all pointer map functionality within a module called ptrmap guarded by a compiler directive
2025-06-06 23:14:25 +05:30
Zaid Humayun
33fc60232c removed unnecessary comment 2025-06-06 23:14:25 +05:30
Zaid Humayun
8e6fb1d28f addresses comments by @jussisaurio 2025-06-06 23:14:25 +05:30
Zaid Humayun
0b5338ec7e fixed off by one error 2025-06-06 23:14:25 +05:30
Zaid Humayun
51a1b01ed9 removed comment 2025-06-06 23:14:25 +05:30
Zaid Humayun
7c83086eed removed inferred types 2025-06-06 23:14:25 +05:30
Zaid Humayun
275548e991 adds comment 2025-06-06 23:14:25 +05:30
Zaid Humayun
b9ae5e7ce9 removed omit_autovacuum from flags and fixed tests 2025-06-06 23:14:25 +05:30
Zaid Humayun
4b9ab35012 fixed clippy warnings 2025-06-06 23:14:25 +05:30
Zaid Humayun
5827a33517 Beginnings of AUTOVACUUM
This commit introduces AUTOVACUUM to Limbo. It introduces the concept of ptrmap pages and also adds some additional instructions that are required to make AUTOVACUUM PRAGMA work
2025-06-06 23:14:22 +05:30
Pere Diaz Bou
a0d017c990 Merge 'Fix: ensure PRAGMA cache_size changes persist only for current session' from meteorgan
According to [the
document](https://www.sqlite.org/pragma.html#pragma_cache_size):
```
When you change the cache size using the cache_size pragma, the change only endures for the current session. The cache size reverts to the default value when the database is closed and reopened.
```
so, we shouldn't persist cache_size to database header.
this PR also addresses two minor issues:
1. Sets the default cache_size to -2000 to align with SQLite's default
2. Uses the actual page size to calculate the cache size.

Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #1672
2025-06-06 16:21:02 +02:00
Pekka Enberg
c7ec4a6270 Merge 'bindings/javascript: Add database property to Statement' from Anton Harniakou
Implements `.database` property on Statement object.
```js
let stmt = db.prepare("SELECT 1");
stmt.database == db // will return the database object the stmt was create with
```

Reviewed-by: Diego Reis (@el-yawd)

Closes #1671
2025-06-05 18:33:59 +03:00
Pekka Enberg
12876227c3 Limbo 0.0.22-pre.1 2025-06-05 18:26:33 +03:00
meteorgan
5da21fe275 add some tests for pragma cache_size 2025-06-05 17:17:21 +08:00
meteorgan
a242bac340 Fix: ensure PRAGMA cache_size changes persist only for current session 2025-06-05 16:55:41 +08:00
Anton Harniakou
90f34643c3 Implement .database property 2025-06-05 10:00:06 +03:00
Anton Harniakou
1adaa927e6 Add tests 2025-06-05 09:59:20 +03:00
Pekka Enberg
9f17be8162 Merge 'simulator: log the interaction about to be executed with INFO' from Jussi Saurio
I think this is useful to see, without having to drop down to DEBUG and
seeing all the other stuff.

Closes #1655
2025-06-04 10:20:54 +03:00
Pekka Enberg
7376284895 Merge 'simulator: add CREATE INDEX to interactions' from Jussi Saurio
Adds CREATE INDEX as a potential interaction.
Kudos to @alpaylan - I've been sleeping on the simulator a bit lately --
incredibly easy to add new stuff here

Closes #1656
2025-06-04 10:15:48 +03:00
Pekka Enberg
941ecdc75b Merge 'stress: Use temporary file unless one explicitly specified' from Jussi Saurio
Closes #1660
2025-06-04 10:12:31 +03:00
Jussi Saurio
7e875a44cb add limbostress.log to gitignore 2025-06-04 10:02:37 +03:00
Jussi Saurio
062469936d test/stress: use tempfile unless opts.db_file given 2025-06-04 10:02:27 +03:00
Jussi Saurio
2087393d22 Merge 'Write database header via normal pager route' from meteorgan
Closes: #1613

Closes #1634
2025-06-04 09:39:14 +03:00
Jussi Saurio
2d638e737c Merge 'sim/aws: fix sim timeout handling' from Jussi Saurio
code was trying to consume the same readablestream twice: once in the
timeouter's catch block, and a second time in the body of the try block
before postGithubIssue() could run.

Closes #1658
2025-06-04 09:38:31 +03:00
Jussi Saurio
8bc1e06964 add simulator.log to gitignore 2025-06-04 09:29:25 +03:00
Jussi Saurio
e53ac59532 Fix assertion failing on 100 != 99.99999999999999999999 2025-06-04 09:28:26 +03:00
Jussi Saurio
5680326881 sim: add CREATE INDEX to interactions 2025-06-04 09:21:59 +03:00
Jussi Saurio
ad8c9a4c15 Merge 'Fix WAL frame checksum mismatch' from Diego Reis
Closes #1622
I did an A/B test between SQLite and Limbo and they can restart the db
from each other, indicating that there isn't something very wrong with
our file format. Turns out it was with our reset logic without
truncating the file. I assumed it's safe to don't reset if we're in
`PASSIVE` mode, given the
[docs](https://www.sqlite.org/c3ref/wal_checkpoint_v2.html) and [source
code](https://github.com/sqlite/sqlite/blob/2bd9f69d40dd240c4122c6d02f1f
f447e7b5c098/src/wal.c#L2193).
It also does some small clean ups and fixes.

Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #1647
2025-06-04 09:14:45 +03:00
Jussi Saurio
e29b17ccbb Merge 'simulator: options to disable certain query types' from Pedro Muniz
Some additional cli options and some adjustments to determine if a query
statement is disabled for this run. This enables us to at least run the
simulator to completion when other parts of the system cause infinite
loops almost every time. I'm looking at you UPDATE

Closes #1657
2025-06-04 09:14:17 +03:00
Jussi Saurio
4fc04c8db3 sim/aws: fix sim timeout handling
code was trying to consume the same readablestream twice: once in
the timeouter's catch block, and a second time in the body of the
try block before postGithubIssue() could run.
2025-06-04 09:08:59 +03:00
Pekka Enberg
c6ef19396d Merge 'Add support for pragma table-valued functions' from Piotr Rżysko
This PR adds support for table-valued functions for PRAGMAs (see the
[PRAGMA functions section](https://www.sqlite.org/pragma.html)).
Additionally, it introduces built-in table-valued functions. I
considered using extensions for this, but there are several reasons in
favor of a dedicated mechanism:
* It simplifies the use of internal functions, structs, etc. For
example, when implementing `json_each` and `json_tree`, direct access to
internals was necessary:
https://github.com/tursodatabase/limbo/pull/1088
* It avoids FFI overhead. [Benchmarks](https://github.com/piotrrzysko/li
mbo/blob/pragma_vtabs_bench/core/benches/pragma_benchmarks.rs) on my
hardware show that `pragma_table_info()` implemented as an extension is
2.5× slower than the built-in version.

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

Closes #1642
2025-06-04 09:08:10 +03:00
Pekka Enberg
d2c5c4647f Limbo supports exact vector search
Make the roadmap item more explicit that it's about indexing.
2025-06-04 09:04:13 +03:00
Pekka Enberg
025714ce94 Merge 'bindings/javascript: Add proper exec() method and raw() mode' from Diego Reis
Now we can execute a sequence of statements from exec, it's similar to
`execute_batch()` from rusqlite
EDIT: It also add support for raw mode and do a small clean up to push
if statements outside loops

Closes #1620
2025-06-04 08:13:36 +03:00
pedrocarlo
1c424818aa simulator options to disable certain query types 2025-06-03 22:21:40 -03:00
Diego Reis
09f978b239 core: Tagging some comments as TODO 2025-06-03 15:09:16 -03:00
meteorgan
1554c54f2b restore comments 2025-06-03 22:06:08 +08:00
meteorgan
ab4eda59be close conn after executing limbo in cli 2025-06-03 22:06:08 +08:00
meteorgan
f2bf6251cd write database header via normal pager route 2025-06-03 22:06:08 +08:00
Pekka Enberg
e16b12b2f0 s/modern/next/g 2025-06-03 16:36:41 +03:00
Jussi Saurio
e260a72447 sim: log the interaction about to be executed with INFO
I think this is useful to see, without having to drop down to DEBUG
and seeing all the other stuff.
2025-06-03 15:50:34 +03:00
Pekka Enberg
e3e0208360 Merge 'Set maximum open simulator-created issues' from Jussi Saurio
Closes #1653
2025-06-03 15:40:52 +03:00
Jussi Saurio
3caf10d42f Set maximum open simulator-created issues 2025-06-03 15:39:00 +03:00
Jussi Saurio
a8106a0bbd Merge 'Fix cursors not being opened for indexes in DELETE' from Jussi Saurio
Closes #1648
Closes #1628

Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>
Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #1652
2025-06-03 15:37:44 +03:00
Jussi Saurio
31b37332d5 all index cursors must be opened when DELETE does an index seek too 2025-06-03 15:18:45 +03:00
Jussi Saurio
06626f72eb Fix cursors not being opened for indexes in DELETE 2025-06-03 14:45:01 +03:00
Jussi Saurio
c488c32d43 Merge 'Make cursor seek reentrant' from Pedro Muniz
Closes #1628.  Every function that calls `process_overflow_read` needs
to be reentrant. I did not change it here, but it would include
`get_prev_record` and `get_next_record`. Maybe `tablebtree_move_to` did
not need to use the state machine, but I included it as a safeguard.
Edit: Closes #1625 . When I implemented `restore_context`, I forgot to
add a `return_if_io` after calling it in `next` 🤦‍♂️
Edit: Closes #1617 . Just tested it and it also solves this bug.

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

Closes #1636
2025-06-03 14:24:40 +03:00
Pekka Enberg
6ffbc63ab4 Merge 'Add simulator-docker-runner for running limbo-sim in a loop on AWS' from Jussi Saurio
Closes #1645
2025-06-03 14:20:46 +03:00
Diego Reis
cf038b045d core/wal: Only reset the WAL if the file is truncated 2025-06-02 23:16:30 -03:00
Diego Reis
16c81f471b core/ondisk: Stop reading WAL file if a frame mismatch salt value with header
The salts values in the WAL header are (re)generated in every checkpoint (but in PASSIVE mode), so if we find a frame with mismatch it means it's a leftover from a previous checkpoint.
2025-06-02 23:14:51 -03:00
Diego Reis
ec4eb52734 core/wal: Refactor open_shared for readability 2025-06-02 19:21:13 -03:00