Commit Graph

633 Commits

Author SHA1 Message Date
Pekka Enberg
f8130d051f Merge 'Fix JavaScript bindings' from Nikita Sivukhin
This PR makes all JS db packages to have uniform interface: `new
Database(...)` constructor with explicit `connect()` and `close()`
methods.
Also, this PR adds docstrings in the code and properly support few
better-sqlite options (readonly, fileMustExist, timeout)

Closes #3334
2025-09-25 17:24:03 +03:00
Nikita Sivukhin
a938bdcf09 fix exec to run over multiple statements in the string 2025-09-25 12:03:52 +04:00
Pekka Enberg
f8f23a2a15 core: Wrap Connection::attached_databases with RwLock 2025-09-24 20:15:58 +03:00
Pekka Enberg
03263a9977 core: Wrap Connection::data_sync_retry with AtomicBool 2025-09-24 19:30:31 +03:00
Pekka Enberg
60e9d1a1c4 core: Wrap Connection::is_nested_stmt in AtomicBool 2025-09-24 19:30:31 +03:00
Pekka Enberg
a50771fe38 core: Wrap Connection::query_only with AtomicBool 2025-09-24 19:23:13 +03:00
Pekka Enberg
465dba573d core: Wrap Connection::closed with AtomicBool 2025-09-24 19:15:13 +03:00
Pekka Enberg
41d26d807b core: Wrap Connection::capture_data_changes in RwLock 2025-09-24 11:32:05 +03:00
Pekka Enberg
042a8dd031 core: Wrap Connection::wal_auto_checkpoint_disabled with AtomicBool 2025-09-24 09:12:46 +03:00
Pekka Enberg
aa95cb24ea core: Wrap Connection::page_size with AtomicU16 2025-09-24 09:12:46 +03:00
Pekka Enberg
60d3a837b7 core: Wrap Connection::cache_size with AtomicI32 2025-09-24 09:12:46 +03:00
Pekka Enberg
0b6f535f4a core: Wrap Connection fields with AtomicI64 2025-09-24 09:12:46 +03:00
Pekka Enberg
f5d3962459 core: Wrap Connection::transaction_state with RwLock 2025-09-23 14:01:31 +03:00
Pekka Enberg
fa8065ca52 core: Wrap Connection::autocommit in AtomicBool 2025-09-23 13:18:49 +03:00
Pekka Enberg
1b6050338d core: Wrap Connection::database_schemas in RwLock 2025-09-23 11:50:43 +03:00
Pekka Enberg
b94aa22499 core: Wrap Connection::schema in RwLock 2025-09-23 10:31:20 +03:00
Pekka Enberg
b857f94fe4 Merge 'core: Wrap Connection::pager in RwLock' from Pekka Enberg
Closes #3247
2025-09-23 07:29:09 +03:00
PThorpe92
4ac4aff30c Add a flag to DatabaseOpts, only for cli_only feature to enable rt extension loading 2025-09-22 11:28:19 -04:00
Pekka Enberg
aa454a6637 core: Wrap Connection::pager in RwLock 2025-09-22 17:02:08 +03:00
TcMits
17c91c1fe2 resolve conflicts 2025-09-22 16:03:52 +07:00
Nikita Sivukhin
c63c820bb7 add busy_timeout pragma 2025-09-19 16:48:12 +04:00
Pekka Enberg
3f35267b7c core/mvcc: Kill noop storage
We don't need it for anything.
2025-09-19 08:52:57 +03:00
Pekka Enberg
0ce6469a4b Merge 'Fix some Rust compilation warnings' from Samuel Marks
Nothing fancy yet, assuming you merge this I'll do this one next:
```
warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique
   --> core/types.rs:403:5
    |
398 | #[derive(Debug, Clone, PartialEq)]
    |                        --------- in this derive macro expansion
...
402 |     pub step_fn: StepFunction,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
403 |     pub finalize_fn: FinalizeFunction,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: the address of the same function can vary between different codegen units
    = note: furthermore, different functions could have the same address after being merged together
    = note: for more information visit <https://doc.rust-lang.org/nightly/core/ptr/fn.fn_addr_eq.html>
```
And fix a test failure that I resolved in Python (specific to macOS
hosts). Basically this PR is putting my toe in the water to see how open
you are to contribs!

Closes #3211
2025-09-19 08:28:53 +03:00
Samuel Marks
e333f151ba [*.rs] Resolve warnings (mostly "hiding a lifetime that's elided elsewhere is confusing") 2025-09-18 22:47:43 -05:00
Pere Diaz Bou
ef341338dc core/mvcc: rebase fix 2025-09-18 18:24:55 +02:00
Pere Diaz Bou
ff3c79d5d7 remove mvvmode and set logical log as default 2025-09-18 18:22:25 +02:00
Pere Diaz Bou
d53c64e84b core/schema: parse schema rows for MVCC transactions 2025-09-18 18:22:06 +02:00
Pere Diaz Bou
de8a975a0b core/mvcc: introduce MvccMode Logical Log 2025-09-18 18:21:04 +02:00
Pekka Enberg
ecbe2c231f core: Rename Connection::_db to db 2025-09-18 16:00:41 +03:00
Pekka Enberg
6c48cb7043 Merge 'core: Use sequential consistency for atomics by default' from Pekka Enberg
We use relaxed ordering in a lot of places where we really need to
ensure all CPUs see the write. Switch to sequential consistency, unless
acquire/release is explicitly used. If there are places that can be
optimized, we can switch to relaxed case-by-case, but have a comment
explaning *why* it is safe.

Closes #3193
2025-09-18 14:19:54 +03:00
Pekka Enberg
f731efdc35 Merge 'core/storage: Use AtomicU32 for Pager::page_size' from Pekka Enberg
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #3191
2025-09-18 13:40:57 +03:00
Pekka Enberg
8337e86794 core: Use sequential consistency for atomics by default
We use relaxed ordering in a lot of places where we really need to
ensure all CPUs see the write. Switch to sequential consistency, unless
acquire/release is explicitly used. If there are places that can be
optimized, we can switch to relaxed case-by-case, but have a comment
explaning *why* it is safe.
2025-09-18 13:38:13 +03:00
andreatp
4c74ab10f4 fix c compat tests and add a minimal CI 2025-09-18 10:13:31 +01:00
Pekka Enberg
2a5284afb9 core/storage: Use AtomicU32 for Pager::page_size 2025-09-18 11:33:32 +03:00
Avinash Sajjanshetty
f9a6cde79a Make encryption::CipherMode public 2025-09-17 21:55:23 +05:30
Jussi Saurio
9a2797963a Merge 'Remove LimboResult enum and InsnFunctionStepResult::Busy variant' from Jussi Saurio
We can just use `LimboError::Busy` for both of these.

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

Closes #3170
2025-09-17 12:06:54 +03:00
Pekka Enberg
6472a71ae7 Merge 'core: Wrap symbol table with RwLock' from Pekka Enberg
Make it Send.

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

Closes #3168
2025-09-17 11:47:40 +03:00
Jussi Saurio
dc103da2ed Remove LimboResult
this is only used for returning LimboResult::Busy, and we already
have LimboError::Busy, so it only adds confusion.

Moreover, the current busy handler was not handling LimboError::Busy,
because it's returned as an error, not as Ok. So this may fix the
"busy handler not working" issue in the perf thrpt benchmark.
2025-09-17 11:04:44 +03:00
Pekka Enberg
50653258cf core: Wrap symbol table with RwLock
Make it Send.
2025-09-17 10:58:32 +03:00
Pekka Enberg
06d869ea5e core/ext: Switch vtab_modules from Rc to Arc 2025-09-17 10:36:12 +03:00
Pekka Enberg
17e9f05ea4 core: Convert Rc<Pager> to Arc<Pager> 2025-09-17 09:32:49 +03:00
rajajisai
e605aff31b Merge branch 'main' into enc-page-1 2025-09-16 10:06:00 -04:00
rajajisai
89caa868f9 Encryption support for database header page 2025-09-16 10:04:30 -04:00
TcMits
226dd5cbe0 add commet 2025-09-16 20:00:04 +07:00
TcMits
597314f1cf perf 2025-09-16 19:21:04 +07:00
TcMits
96e4c5d241 fix issue 3144 2025-09-16 18:39:45 +07:00
pedrocarlo
3d265489dc modify semantics of busy_timeout to be more on par with sqlite 2025-09-15 02:20:32 -03:00
pedrocarlo
0586b75fbe expose function to set busy timeout duration 2025-09-15 02:20:32 -03:00
pedrocarlo
a56680f79e implement Busy Handler in Turso statements 2025-09-15 02:16:18 -03:00
Jussi Saurio
396091044e store tx_mode in conn.mv_tx
otherwise op_transaction works completely wrong because each separate
insert statement overrides the tx_mode to Write
2025-09-14 21:59:08 +03:00