Jussi Saurio
acb3c97fea
Merge 'When pwritev fails, clear the dirty pages' from Pedro Muniz
...
If we don't clear the dirty pages, we will initiate a rollback. In the
rollback, we will attempt to clear the whole page cache, but it will
then panic because there will still be dirty pages from the failed
writev
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com >
Closes #3189
2025-10-09 10:38:47 +03:00
Pere Diaz Bou
3e508a4b42
core/io: remove new_dummy in place of new_yield
...
Yield is a completion that does not allocate any inner state. By design
it is completed from the start and has no errors. This allows lightly
yield without allocating any locks nor heap allocate inner state.
2025-10-07 12:00:33 +02:00
Pekka Enberg
a72b07e949
Merge 'Fix VDBE program abort' from Nikita Sivukhin
...
This PR add proper program abort in case of unfinished statement reset
and interruption.
Also, this PR makes rollback methods non-failing because otherwise of
their callers usually unclear (if rollback failed - what is the state of
statement/connection/transaction?)
Reviewed-by: Preston Thorpe <preston@turso.tech >
Closes #3591
2025-10-07 09:07:07 +03:00
pedrocarlo
5a7390735d
rename Completion functions
2025-10-06 11:07:06 -03:00
Nikita Sivukhin
8dae601fac
make rollback non-failing method
2025-10-06 13:21:45 +04:00
Nikita Sivukhin
38d2630969
remove unnecessary SchemaLocked error
...
- lock() return error in case when another thread panicked while holding the same lock
- we better to just panic too in any such case
2025-10-06 12:15:15 +04:00
pedrocarlo
911b6791b9
when pwritev fails, clear the dirty pages
...
add flag to `clear_page_cache`
2025-10-05 20:02:21 -03:00
pedrocarlo
e93add6c80
remove dyn DatabaseStorage and replace it with DatabaseFile
2025-10-03 14:14:15 -03:00
Avinash Sajjanshetty
3653c1a853
clear page cache when the encryption context is set
2025-10-02 19:50:12 +05:30
pedrocarlo
65cd4d998d
page_size can be 0 when it is not initialized, so account for that
2025-09-30 15:58:38 -03:00
pedrocarlo
aa5055e563
fuzz tests for pending_byte
2025-09-30 13:52:40 -03:00
pedrocarlo
3d5978c718
add special hipp pending page that is supposed to be ignored
2025-09-30 13:43:10 -03:00
Avinash Sajjanshetty
c8111f9555
Put encryption behind an opt in (runtime) flag
2025-09-30 18:29:18 +05:30
Jussi Saurio
35b584f050
Merge 'core: change root_page to i64' from Pere Diaz Bou
...
Closes #3454
2025-09-30 12:50:23 +03:00
Pere Diaz Bou
2fff6bb119
core: page id to usize
2025-09-30 11:35:06 +02:00
Pere Diaz Bou
af98067ff1
fmt
2025-09-29 18:40:17 +02:00
Pere Diaz Bou
0f631101df
core: change page idx type from usize to i64
...
MVCC is like the annoying younger cousin (I know because I was him) that
needs to be treated differently. MVCC requires us to use root_pages that
might not be allocated yet, and the plan is to use negative root_pages
for that case. Therefore, we need i64 in order to fit this change.
2025-09-29 18:38:43 +02:00
Pekka Enberg
f247b1a2bb
core/storage: Wrap Pager::commit_info with RwLock
...
Also remove RefCells from CommitInfo because they're not only redundant,
but cause CommitInfo not to be Send.
2025-09-29 13:54:28 +03:00
Pekka Enberg
ce76aa11b2
core/storage: Mark Page as Send and Sync
2025-09-27 15:16:38 +03:00
Pekka Enberg
60e9d1a1c4
core: Wrap Connection::is_nested_stmt in AtomicBool
2025-09-24 19:30:31 +03:00
Pekka Enberg
042a8dd031
core: Wrap Connection::wal_auto_checkpoint_disabled with AtomicBool
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
b94aa22499
core: Wrap Connection::schema in RwLock
2025-09-23 10:31:20 +03:00
Pekka Enberg
372daef656
core: Wrap Pager::io_ctx in RwLock
2025-09-22 15:00:29 +03:00
Pekka Enberg
6f258b37d9
core/storage: Wrap Pager vacuum state in RwLock
2025-09-22 10:34:58 +03:00
Pekka Enberg
f053b76518
core/storage: Move vacuum state machines to VacuumState
2025-09-22 09:37:40 +03:00
Pekka Enberg
508858dac6
core/storage: Wrap Pager::header_ref_state in RwLock
2025-09-19 08:38:45 +03:00
Pekka Enberg
a011548aac
Merge 'core/storage: Wrap Pager::free_page_state with RwLock' from Pekka Enberg
...
Closes #3200
2025-09-18 17:17:53 +03:00
Pekka Enberg
beedb7a4aa
Merge 'core: Rename Connection::_db to db' from Pekka Enberg
...
Reviewed-by: Preston Thorpe <preston@turso.tech >
Closes #3196
2025-09-18 17:17:46 +03:00
Pekka Enberg
ecbe2c231f
core: Rename Connection::_db to db
2025-09-18 16:00:41 +03:00
Pekka Enberg
7ac2e49a83
core/storage: Wrap Pager::free_page_state with RwLock
2025-09-18 15:46:23 +03:00
Pekka Enberg
d69cdd92d2
Merge 'core/storage: Switch Pager::max_page_count to AtomicU32' from Pekka Enberg
...
Closes #3197
2025-09-18 15:45:39 +03:00
Pekka Enberg
19513fd9a7
core/storage: Switch Pager::max_page_count to AtomicU32
2025-09-18 14:46:22 +03:00
Pekka Enberg
6e9684c763
Merge 'core/storage: Use AtomicU16 for Pager::reserved_space' from Pekka Enberg
...
Closes #3195
2025-09-18 14:46:08 +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
50acebd88e
core/storage: Use AtomicU16 for Pager::reserved_space
2025-09-18 14:19:13 +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
Pekka Enberg
2a5284afb9
core/storage: Use AtomicU32 for Pager::page_size
2025-09-18 11:33:32 +03:00
Pekka Enberg
e6d994dee0
core/storage: Wrap Pager::allocate_page_state with RwLock
2025-09-18 10:55:55 +03:00
Pekka Enberg
365f606cce
core/storage: Use AtomicU8 for Pager::auto_vacuum_mode
2025-09-18 10:55:55 +03:00
Pekka Enberg
2215cccebb
core/storage: Wrap Pager::syncing in Arc<AtomicBool>
2025-09-18 10:55:54 +03:00
Nikita Sivukhin
93e4dfbd69
remove one more unnecessary io.block
2025-09-17 19:16:51 +04:00
Nikita Sivukhin
b5d12b79cd
reset commit_state when commit_dirty_pages is done
2025-09-17 19:09:55 +04:00
Nikita Sivukhin
5c4d8aa10b
fix bug after making checkpoint async
2025-09-17 19:09:54 +04:00
Nikita Sivukhin
2c09d17dfe
make checkpoint async
2025-09-17 19:06:07 +04:00
Nikita Sivukhin
9cc1d0fcc2
make append_frames fully async and non-blocking
2025-09-17 19:06:06 +04:00
Jussi Saurio
8bf52de94b
Merge 'Remove serialization of normal write/commit path' from Preston Thorpe
...
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com >
Closes #3089
2025-09-17 17:30:45 +03:00
Pekka Enberg
b98e1efb17
Merge 'core/storage: Wrap Pager::checkpoint_state in RwLock' from Pekka Enberg
...
Closes #3176
2025-09-17 14:41:18 +03:00
Pekka Enberg
d3185d2f72
core/storage: Wrap Pager::checkpoint_state in RwLock
2025-09-17 13:04:37 +03:00
Pekka Enberg
bede1229a9
core: Wrap Pager dirty_pages in RwLock
...
Make it Sync and Send.
2025-09-17 12:55:26 +03:00