Commit Graph

3005 Commits

Author SHA1 Message Date
Nikita Sivukhin
bc289d314a adjust test a bit 2025-02-09 19:20:48 +04:00
Nikita Sivukhin
e23ea35993 add simple B-tree validation func 2025-02-09 19:20:37 +04:00
Nikita Sivukhin
a59589844d fix insertion to the parent 2025-02-09 19:19:36 +04:00
Nikita Sivukhin
6c40f52fc8 separate fuzz tests in categories 2025-02-09 18:37:04 +04:00
Nikita Sivukhin
9049c91863 find cell in parent node 2025-02-09 18:36:37 +04:00
Nikita Sivukhin
9e4afd1d13 relax assertion 2025-02-09 18:36:26 +04:00
alpaylan
6f567bd2ef fix formatting 2025-02-09 09:34:32 -05:00
alpaylan
47420db16f - implement DROP TABLE support, toggled off from generation for now
- clean up the query generation/printing by separating it into different files and removing duplications
2025-02-09 09:28:33 -05:00
Nikita Sivukhin
8e6569434a add fuzz 2025-02-09 18:10:59 +04:00
Nikita Sivukhin
a62265eef4 hanle balancing cases when more than 1 level is affected 2025-02-09 18:10:19 +04:00
Nikita Sivukhin
d2251b1dd1 fix 2025-02-09 18:09:53 +04:00
Nikita Sivukhin
e8a585f87a adjust logging 2025-02-09 18:09:43 +04:00
김선우
2fa3a1e6ae Apply lint 2025-02-09 22:46:48 +09:00
Nikita Sivukhin
8659dbba8e fix pointer structure in case of root split 2025-02-09 17:31:39 +04:00
Nikita Sivukhin
d4bbad161b handle case when we can't balance all cells between current page and one new allocated page
- if we have page which is tightly packed with relatively big cells, we
  will be unable to balance its content if we will insert very big
  (~page size) cell in the middle (because nothing can't be merged with
  new cell - so we will need to split 1 page into 3)
2025-02-09 17:31:39 +04:00
Nikita Sivukhin
ea61f31843 clear overflow_cells 2025-02-09 17:31:39 +04:00
Nikita Sivukhin
6aa10701a4 fix comment 2025-02-09 17:31:39 +04:00
Nikita Sivukhin
eec0493c60 remove misleading comment 2025-02-09 17:31:39 +04:00
Nikita Sivukhin
fc502b86c7 fix defragmentation code a bit 2025-02-09 17:31:39 +04:00
Nikita Sivukhin
5ce3d12f75 fix typo 2025-02-09 17:31:39 +04:00
Nikita Sivukhin
62b4787d3d simplify write_varint_to_vec function 2025-02-09 17:31:39 +04:00
Nikita Sivukhin
3557c8aada adjust fuzz test 2025-02-09 17:31:39 +04:00
meteorgan
a99d9a8988 chore: remove unused dependencies 2025-02-09 21:05:06 +08:00
Jussi Saurio
a8685c8086 sqlite3-parser: box the Expr in Vacuum 2025-02-09 14:24:55 +02:00
Jussi Saurio
9b0997a60d sqlite3-parser: separate boxed CreateVirtualTable struct 2025-02-09 14:24:55 +02:00
Jussi Saurio
36a3cb1d5e sqlite3-parser: box AlterTable 2025-02-09 14:11:34 +02:00
Jussi Saurio
72a055e5fe sqlite3-parser: box Pragma 2025-02-09 13:10:52 +02:00
Jussi Saurio
23c4106433 sqlite3-parser: separate boxed Insert struct 2025-02-09 13:10:21 +02:00
Jussi Saurio
f0d7d82e1d sqlite3-parser: Box the Expr in Detach 2025-02-09 13:10:21 +02:00
Jussi Saurio
32887518ce sqlite3-parser: separate boxed Delete struct 2025-02-09 13:10:21 +02:00
Jussi Saurio
40a8dc14cd sqlite3-parser: separate boxed SelectInner struct 2025-02-09 12:54:30 +02:00
Jussi Saurio
f75aca67bb sqlite3-parser: separate boxed TriggerCmd struct variants 2025-02-09 12:53:12 +02:00
Jussi Saurio
af920a317c sqlite3-parser: separate boxed Update struct 2025-02-09 12:53:12 +02:00
Jussi Saurio
575b484740 sqlite3-parser: separate boxed CreateTrigger struct 2025-02-09 12:50:00 +02:00
Jussi Saurio
358fda2ec7 sqlite3-parser: box the create table body 2025-02-09 12:42:53 +02:00
Jussi Saurio
d177f6195b sqlite3-parser: box big members of createindex 2025-02-09 12:34:53 +02:00
김선우
e0b0a667bb Implement close 2025-02-09 18:40:50 +09:00
김선우
d51c1dc5b1 Remove AbstractDB and move those methods into LimboDB 2025-02-09 18:40:42 +09:00
김선우
d1789d1d6e Implement executeUpdate 2025-02-09 17:49:16 +09:00
김선우
ed9cf63c51 Implement abort 2025-02-09 17:37:19 +09:00
김선우
968ae74810 Implement isValid 2025-02-09 17:28:32 +09:00
김선우
4e067b2997 Throw exceptions on unsupported methods 2025-02-09 17:24:52 +09:00
김선우
1f3ddaeec6 Implement prepareStatement 2025-02-09 17:24:35 +09:00
김선우
79e2fba424 Implement minor methods/features in JDBC4Connection.java 2025-02-09 17:17:47 +09:00
Pekka Enberg
e406a030e6 Merge 'Rework io_uring feature' from Jorge López Tello
This makes io_uring the default in CLI, but makes it non-default in
core. Before, if one built CLI without io_uring, core still built with
it as it was a default feature. To accommodate for the change, all
bindings have been updated to select the feature, except for WASM which
has a separate fs implementation.
This also adds some #[cfg] and #[allow] to silence unused-* warnings,
which I discovered when testing with different features disabled.

Closes #942
2025-02-09 08:46:29 +02:00
Pekka Enberg
3178e975b9 Merge 'perf/prepare: box many less frequently used AST nodes' from Jussi Saurio
`sqlite3-parser` spends a lot of time in `yy_reduce` assigning different
`enum YYMINORTYPE` members, and it suffers from bad performance because
the stack size of the enum is very large, and the size of individual
members varies wildly. This PR reduces the `YYMINORTYPE` stack size from
496 to 264 bytes and has the following effect:
Preparing statement:
```sql
Prepare `SELECT 1`/Limbo/SELECT 1
                        time:   [620.37 ns 621.08 ns 621.79 ns]
                        change: [-17.811% -17.582% -17.380%] (p = 0.00 < 0.05)
                        Performance has improved.

Prepare `SELECT * FROM users LIMIT 1`/Limbo/SELECT * FROM users LIMIT 1
                        time:   [1.2215 µs 1.2231 µs 1.2248 µs]
                        change: [-12.926% -12.627% -12.272%] (p = 0.00 < 0.05)
                        Performance has improved.

Benchmarking Prepare `SELECT first_name, count(1) FROM users GROUP BY first_name HAVING count(1) > 1 ORDER BY cou...: Collecting 100 samples in estimated 5.0152 s (
Prepare `SELECT first_name, count(1) FROM users GROUP BY first_name HAVING count(1) > 1 ORDER BY cou...
                        time:   [3.1056 µs 3.1096 µs 3.1138 µs]
                        change: [-13.279% -12.995% -12.712%] (p = 0.00 < 0.05)
                        Performance has improved.

```
Execute (mainly to check for regressions):
```sql
Execute `SELECT * FROM users LIMIT ?`/Limbo/1
                        time:   [402.19 ns 402.75 ns 403.36 ns]
                        change: [-3.4845% -2.4003% -1.6539%] (p = 0.00 < 0.05)
                        Performance has improved.

Execute `SELECT * FROM users LIMIT ?`/Limbo/10
                        time:   [2.7920 µs 2.7977 µs 2.8036 µs]
                        change: [-1.3135% -1.0123% -0.7132%] (p = 0.00 < 0.05)
                        Change within noise threshold.

Execute `SELECT * FROM users LIMIT ?`/Limbo/50
                        time:   [13.577 µs 13.633 µs 13.690 µs]
                        change: [-1.7709% -1.3575% -0.9563%] (p = 0.00 < 0.05)
                        Change within noise threshold.
```

Closes #936
2025-02-09 08:45:42 +02:00
Pekka Enberg
55e873cf49 Merge 'cli: Improve pretty mode table' from wyhaya
This PR replace `cli-table` with [comfy-
table](https://github.com/nukesor/comfy-table), with the following
improvements:
* Limit value to 1 line, regardless of whether they contain line breaks
* Truncate excess content when the complete content cannot be displayed
* Adapt to terminal width
* Fix #928
```sql
limbo> .mode pretty

limbo> CREATE TABLE "test" ("id" text NOT NULL, "age" integer, "height" real, PRIMARY KEY ("id"));
-- No output

limbo> INSERT INTO "test" ("id", "age", "height")
VALUES
('8f67b3fa-ad9a-4b51-947f-778b80a0b350', 477557, 79.34657),
('1ee52440-ccc7-4a88-bb25-46f2da1f9f69', 5963124, 43.86521),
('bb1f6009-dbcb-4e61-b958-b3a7f5153bba', 6822724, 16.318216);
-- No output

limbo> SELECT * FROM test;
┌──────────────────────────────────────┬─────────┬───────────┐
│ id                                   │ age     │ height    │
├──────────────────────────────────────┼─────────┼───────────┤
│ 8f67b3fa-ad9a-4b51-947f-778b80a0b350 │  477557 │  79.34657 │
├──────────────────────────────────────┼─────────┼───────────┤
│ 1ee52440-ccc7-4a88-bb25-46f2da1f9f69 │ 5963124 │  43.86521 │
├──────────────────────────────────────┼─────────┼───────────┤
│ bb1f6009-dbcb-4e61-b958-b3a7f5153bba │ 6822724 │ 16.318216 │
└──────────────────────────────────────┴─────────┴───────────┘
-- Column names are left-aligned and bolded
-- Text is left-aligned
-- Numbers are right-aligned

limbo> CREATE TABLE empty(id text, age integer, data blob);
limbo> SELECT * FROM empty;
┌────┬─────┬──────┐
│ id │ age │ data │
├────┼─────┼──────┤
└────┴─────┴──────┘
-- No rows

limbo> select * from test;
┌───────────────┬─────────┬───────────┐
│ id            │ age     │ height    │
├───────────────┼─────────┼───────────┤
│ 8f67b3fa-ad9… │  477557 │  79.34657 │
├───────────────┼─────────┼───────────┤
│ 1ee52440-ccc… │ 5963124 │  43.86521 │
├───────────────┼─────────┼───────────┤
│ bb1f6009-dbc… │ 6822724 │ 16.318216 │
└───────────────┴─────────┴───────────┘
-- Content will be truncated if the terminal width is insufficient
```
https://github.com/user-
attachments/assets/84dca32d-315f-4991-ad24-b2cdf11bc086

Closes #937
2025-02-09 08:45:26 +02:00
Pekka Enberg
7f9d3f7648 Merge 'simulator: fix shrinking bug' from Alperen Keleş
Fixes https://github.com/tursodatabase/limbo/issues/924

Closes #935
2025-02-09 08:45:11 +02:00
Pekka Enberg
ebbb84bb70 Merge 'github.com/penberg/limbo was moved to github.com/tursodatabase/limbo' from Gustavo Sverzut Barbieri
Adjust all the references since they were broken

Reviewed-by: Preston Thorpe (@PThorpe92)
Reviewed-by: Ricardo Dalarme (@ricardodalarme)

Closes #933
2025-02-09 08:44:39 +02:00
김선우
8ec7b0b2be Add TODO in getTables 2025-02-09 14:10:55 +09:00