Commit Graph

10673 Commits

Author SHA1 Message Date
Ihor Andrianov
103c9bcb66 inital impl of json parsing 2025-03-12 15:02:49 +02:00
Pekka Enberg
c660ac5c68 tests/integration: Ignore failing overflow tests
...let's add them back when the bugs are fixed.
2025-03-12 13:31:33 +02:00
Pekka Enberg
e2f26e79c5 Merge 'bindings/rust: Fix rust bindings so example runs' from yirt grek
Fixes the rust bindings so that `example.rs` is runnable

Closes #1113
2025-03-12 13:28:23 +02:00
Yirt Grek
bb68fbdd67 bindings/rust: Fix bindings so example runs 2025-03-12 00:54:18 -07:00
krishvishal
6093994bd2 Changed from using raw byte access methods to PageContent read/write methods
Added comments
2025-03-11 22:49:18 +05:30
krishvishal
91fa6a5fa3 Remove debug prints and make clippy happy 2025-03-11 20:30:09 +05:30
krishvishal
a56be0a2af Silence overflow page tests for now 2025-03-11 20:30:09 +05:30
krishvishal
a1a63f621e Add a method that can help while debugging freelist blocks 2025-03-11 20:30:09 +05:30
krishvishal
d8210d79aa Add unit test to demonstrate that https://github.com/tursodatabase/limbo/issues/1085 is
fixed.
2025-03-11 20:30:09 +05:30
krishvishal
0f0d56b0e7 Refactor find_free_cell logic to make sure a freeblock with size 4 is not deleted.
Previously any block that has a size 4 is deleted resulting in the issue of computed free space
is less than 4 bytes when compared to expected free space.
2025-03-11 20:30:09 +05:30
krishvishal
77aeb889ae Add loop termination condition when pc = 0 in find_free_cell.
The issue is caused by the function try to read from non-existent free blocks.
2025-03-11 20:30:09 +05:30
Pekka Enberg
cb68b2ec1b sqlite3: cargo fmt 2025-03-10 12:22:01 +02:00
Pekka Enberg
bc30ca57e8 Merge 'sqlite3: Add Rust tests for SQLite3 API implementation' from Karan Janthe
This PR introduces test for SQLite3 API implementation, adding both unit
tests in Rust and maintaining existing C compatibility tests.
## Changes
- Added unit tests for core SQLite3 operations in `lib.rs`:
  - Database initialization and shutdown
  - Memory database operations
  - Error code handling and messages
  - Statement preparation and execution
  - Version information verification

Closes #1108
2025-03-08 09:03:18 +02:00
karan
58a12d0a51 Merge branch 'main' into sqlite3-tests 2025-03-08 09:58:27 +05:30
karan
34876c4711 fixing erro code for sqlite open
Signed-off-by: karan <karanjanthe@gmail.com>
2025-03-08 09:52:43 +05:30
karan
eba5e74a2c Cargo fmt
Signed-off-by: karan <karanjanthe@gmail.com>
2025-03-07 19:12:44 +05:30
karan
d7939f05c2 Added tests in sqlite3
Signed-off-by: karan <karanjanthe@gmail.com>
2025-03-07 19:09:58 +05:30
pedrocarlo
8c5b631baf nu_ansi_term to facilitate stylizing strings 2025-03-06 21:44:23 -03:00
pedrocarlo
5168afa8b0 highlight candidate 2025-03-06 16:33:23 -03:00
pedrocarlo
ffc2e12a83 lock anarchist generator dependecy to 0.12 2025-03-06 15:52:20 -03:00
pedrocarlo
e77953ad7f color remainder fix 2025-03-06 15:52:20 -03:00
pedrocarlo
942c65224d changing table colors and adding history hinter 2025-03-06 15:52:20 -03:00
pedrocarlo
e73cad387f adding table colors 2025-03-06 15:52:20 -03:00
pedrocarlo
74ddf40330 add color to headers, see how to make it configurable 2025-03-06 15:52:20 -03:00
pedrocarlo
b123321692 build script for syntax set dump 2025-03-06 15:52:20 -03:00
pedrocarlo
2f38740b27 generated syntax dump 2025-03-06 15:52:20 -03:00
pedrocarlo
f631706ea4 simple highlighting for prompt 2025-03-06 15:52:20 -03:00
Pekka Enberg
051d879db2 core: Fix btree test compilation 2025-03-06 19:14:48 +02:00
Pekka Enberg
b0636e4494 Merge 'Adds Drop Table' from Zaid Humayun
This PR adds support for `DROP TABLE` and addresses issue
https://github.com/tursodatabase/limbo/issues/894
It depends on https://github.com/tursodatabase/limbo/pull/785 being
merged in because it requires the implementation of `free_page`.
EDIT: The PR above has been merged.
It adds the following:
* an implementation for the `DropTable` AST instruction via a method
called `translate_drop_table`
* a couple of new instructions - `Destroy` and `DropTable`. The former
is to modify physical b-tree pages and the latter is to modify in-memory
structures like the schema hash table.
* `btree_destroy` on `BTreeCursor` to walk the tree of pages for this
table and place it in free list.
* state machine traversal for both `btree_destroy` and
`clear_overflow_pages` to ensure performant, correct code.
* unit & tcl tests
* modifies the `Null` instruction to follow SQLite semantics and accept
a second register. It will set all registers in this range to null. This
is required for `DROP TABLE`.
The screenshots below have a comparison of the bytecodes generated via
SQLite & Limbo.
Limbo has the same instruction set except for the subroutines which
involve opening an ephemeral table, copying over the triggers from the
`sqlite_schema` table and then re-inserting them back into the
`sqlite_schema` table.
This is because `OpenEphemeral` is still a WIP and is being tracked at
https://github.com/tursodatabase/limbo/pull/768
![Screenshot 2025-02-09 at 7 05 03 PM](https://github.com/user-
attachments/assets/1d597001-a60c-4a76-89fd-8b90881c77c9)
![Screenshot 2025-02-09 at 7 05 35 PM](https://github.com/user-
attachments/assets/ecfd2a7a-2edc-49cd-a8d1-7b4db8657444)

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

Closes #897
2025-03-06 18:27:41 +02:00
Pekka Enberg
869bd5b363 Fix installer script URL
Fixes #1103
2025-03-06 14:34:51 +02:00
Pekka Enberg
ab8161c357 Merge 'Integrate MVCC' from Pekka Enberg
This pull request integrates MVCC with the VDBE.

The long term plan is to implement SQLite `BEGIN CONCURRENT` by
introducing a "MV store" abstraction (that implements the Hekaton in-
memory MVCC index) above the pager. Traditional SQLite transactions use
the pager and the WAL, but MV store has its own transaction path that
updates the in-memory multi-versioned index. If a key does not exist in
the MVCC index, we read records from the pager. When a MVCC transaction
commits, we emit WAL entries.

In this pull request, we wire up the MVCC transaction machinery to VDBE
and multi-version cursor to the b-tree cursor. Currently, the database
either runs in normal b-tree mode or in in-memory MVCC, but we need to
explore if we can make it a hybrid solution where you can read from both
MVCC index and B-Tree. Note that this pull request also does not add
logical logging to a file, which is something we'll defer for later.

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

Closes #917
2025-03-06 13:00:40 +02:00
Pekka Enberg
ef180fa1cb core/mvcc: Improve tracing format
Suggested by Pere
2025-03-06 12:58:41 +02:00
Pekka Enberg
2c9d30cef4 core/vdbe: Don't commit MVCC on Halt if no autocommit
Spotted by Pere.
2025-03-06 12:52:03 +02:00
Pekka Enberg
d6c514c8d1 core: Integrate MVCC to B-Tree cursor 2025-03-06 10:16:42 +02:00
Pekka Enberg
bf3163c7fe core: Fix parse_schema() to use existing MVCC TX 2025-03-06 10:16:42 +02:00
Pekka Enberg
ef32a82941 core/vdbe: Integrate MVCC transactions 2025-03-06 10:16:42 +02:00
Pekka Enberg
461be0dc87 core: Add multi-version store to Database 2025-03-06 10:16:42 +02:00
Pekka Enberg
96175cccf7 cli: Add --experimental-mvcc option to enable MVCC 2025-03-06 10:16:42 +02:00
Pekka Enberg
5d0982f5db core/mvcc: Add RowID::new() and Row::new() helpers 2025-03-06 09:59:40 +02:00
Pekka Enberg
4247974f95 core/mvcc: Add insert() helper to Cursor 2025-03-06 09:32:48 +02:00
Pekka Enberg
b7382ffab1 core/mvcc: Switch Cursor to use Rc instead of lifetimes 2025-03-06 09:31:34 +02:00
Pekka Enberg
ff6d9465eb core/mvcc: Improve trace logging 2025-03-06 09:31:04 +02:00
Pekka Enberg
92863c0d6b Merge 'Transaction finish lock fixes' from Pere Diaz Bou
While adding logs to our locks in `Wal` I noticed we weren't cleaning up
connection's transaction state. This PR set to `TransactionState::None`
once commited and calls `end_read_txn` and `end_tx` in case of write.
Fixes #1004

Reviewed-by: Pekka Enberg <penberg@iki.fi>

Closes #1099
2025-03-06 07:51:27 +02:00
Pere Diaz Bou
aa7391da50 fix halt return 2025-03-05 22:32:59 +01:00
Pere Diaz Bou
e4d22a22df ignore test again :) 2025-03-05 22:32:59 +01:00
Pere Diaz Bou
b555561aeb make Program::halt reentrant 2025-03-05 22:32:59 +01:00
Pere Diaz Bou
3492ed4641 remove unused import Add 2025-03-05 22:32:59 +01:00
Pere Diaz Bou
7aae885af4 add logs to wal locks 2025-03-05 22:32:59 +01:00
Pere Diaz Bou
7b1e2093e8 add multi threaded test for simple writer/reader test 2025-03-05 22:32:59 +01:00
Pere Diaz Bou
feeb398e73 finish transaction and reset transaction state 2025-03-05 22:32:59 +01:00