Commit Graph

198 Commits

Author SHA1 Message Date
pedrocarlo
7b8eec90bd edit state machine in Btree for freeing pages + Pager state machine for free_page 2025-07-17 12:24:43 -03:00
pedrocarlo
dc5f73887e refactor to require Arc<Completion> in file traits so that we can delay IO calls correctly 2025-07-17 12:24:43 -03:00
meteorgan
a6faab17e9 fix query page size 2025-07-15 16:34:07 +08:00
meteorgan
cf126824de Support set page size 2025-07-15 16:34:07 +08:00
Pekka Enberg
1a0d618a41 Merge 'Assert I/O read and write sizes' from Pere Diaz Bou
Let's assert **for now** that we do not read/write less bytes than
expected. This should be fixed to retrigger several reads/writes if we
couldn't read/write enough but for now let's assert.

Closes #2078
2025-07-14 12:22:18 +03:00
Pere Diaz Bou
340391538a io: change comment for assert 2025-07-14 10:36:06 +02:00
Pere Diaz Bou
88ff218810 io: assert small I/O
Let's assert **for now** that we do not read/write less bytes than
expected. This should be fixed to retrigger several reads/writes if we
couldn't read/write enough but for now let's assert.
2025-07-14 10:19:41 +02:00
Nikita Sivukhin
f61d733dd3 make new functions dependend on "json" Cargo feature 2025-07-14 11:26:51 +04:00
Nikita Sivukhin
c9e7271eaf properly pass subtype 2025-07-14 11:20:49 +04:00
Nikita Sivukhin
81cd04dd65 add bin_record_json_object and table_columns_json_array functions 2025-07-14 11:19:45 +04:00
Krishna Vishal
b1f27cad94 chore: fix clippy 2025-07-14 03:28:55 +05:30
Krishna Vishal
e7e5f28c0a chore: Clippy chill 2025-07-14 03:28:54 +05:30
Krishna Vishal
9b315d1d7e Manually inline the record deserialization code for performance.
This is done because the compiler is refusing to inline even after
adding inline hint.
- Get refvalues from directly from registers without using
`make_record`
2025-07-14 03:28:54 +05:30
Krishna Vishal
860de412d9 Add num_columns to BTreeCursor so we can initialize
`Vecs` inside `RecordCursor` to their appropriate to reduce
allocations.
2025-07-14 03:28:54 +05:30
Krishna Vishal
ef147181c2 Working version of the incremental column and "optimal" record
compare functions. Now we optimize them
2025-07-14 03:28:54 +05:30
Krishna Vishal
0b1ed44c1f Add optimized index record compare methods
compare_records_int
compare_records_string
compare_records_generic

comapre_records_generic will still be more efficient than compare-
_immutable because it deserializes the record column by column
2025-07-14 03:28:54 +05:30
Nils Koch
1a91966c7e fix clippy errors for rust 1.88.0 (manual fix) 2025-07-12 18:58:55 +03:00
Nils Koch
828d4f5016 fix clippy errors for rust 1.88.0 (auto fix) 2025-07-12 18:58:41 +03:00
Jussi Saurio
59b4f1310b sqlite3_ondisk: add some size constants 2025-07-10 15:16:37 +03:00
Pekka Enberg
7a259957ac Merge 'properly set last_checksum after recovering wal' from Pere Diaz Bou
We store `last_checksum` to do cumulative checksumming. After reading
wal for recovery, we didn't set last checksum properly in case there
were no frames so this cause us to not initialize last_checksum
properly.

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

Closes #2030
2025-07-10 13:54:15 +03:00
Pere Diaz Bou
9258d33d8b properly set last_checksum after recovering wal
We store `last_checksum` to do cumulative checksumming. After reading
wal for recovery, we didn't set last checksum properly in case there
were no frames so this cause us to not initialize last_checksum
properly.
2025-07-10 12:15:00 +02:00
Jussi Saurio
0eeabbb748 Merge 'btree/chore: remove unnecessary parameters to .cell_get()' from Jussi Saurio
we were providing the same damn arguments to `.cell_get()` and
`.cell_get_raw_region()` over and OVER and **OVER** and `O V E R`

Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #2021
2025-07-10 12:22:37 +03:00
Jussi Saurio
c2b699c356 btree: make cell field names consistent 2025-07-09 23:43:03 +03:00
Jussi Saurio
641df7d7e9 improve my mental health by finally refactoring .cell_get() 2025-07-09 19:15:05 +03:00
meteorgan
0001348158 Minor refactoring of btree 2025-07-09 22:01:54 +08:00
Jussi Saurio
c13b2d5d90 sqlite3_ondisk: generalize left-child-pointer reading function to both index/table btrees 2025-07-09 11:07:42 +03:00
Pere Diaz Bou
f7465f665d add checkpoint lock to wal 2025-07-08 17:53:04 +02:00
meteorgan
99e0cf0603 add a constant MINIMUM_CELL_SIZE 2025-07-08 22:57:20 +08:00
meteorgan
04575456a9 fix Minimum cell size must not be less than 4 2025-07-08 22:57:20 +08:00
pedrocarlo
b85687658d change instrumentation level to INFO 2025-07-07 11:53:45 -03:00
pedrocarlo
5559c45011 more instrumentation + write counter should decrement if pwrite fails 2025-07-07 11:50:21 -03:00
pedrocarlo
9632ab0a41 rollback transaction when we fail in step 2025-07-07 11:50:21 -03:00
pedrocarlo
897426a662 add error tracing to relevant functions + rollback transaction in step_end_write_txn + make move_to_root return result 2025-07-07 11:50:21 -03:00
pedrocarlo
d82b526a5c fix infinite loop with write counter 2025-07-07 11:50:21 -03:00
KaguraMilet
aca08238d8 fix buffer pool is not thread safe problem 2025-07-01 16:06:55 +08:00
Pere Diaz Bou
081f09ce20 fix read wal max frame 2025-06-30 10:16:44 +02:00
Pere Diaz Bou
486c4b69fb WAL record db_size frame on commit last frame
`db_size` is `>0` in case of last frame written of a transaction. This
is necessary as we need to know -- while recovering wal contents -- that
we have read a transaction fully instead of treating every frame as its
own transaction.
2025-06-27 16:21:48 +02:00
pedrocarlo
bac5e4b563 refactor File and Database Storage to remove Arc<Connection> and return Arc<Connection> for caller to wait for completion 2025-06-26 22:17:28 -03:00
pedrocarlo
64d9193e7b refactor Completion to have a type field and lift common is_complete property 2025-06-26 22:17:27 -03:00
Jussi Saurio
480f0a04b5 make clippy happy about mutating database_size immediately after default construction 2025-06-24 14:41:50 -03:00
Jussi Saurio
f21cde9501 post-rebase fixes 2025-06-24 14:41:50 -03:00
Jussi Saurio
133d498724 Implement a header_accessor module so that DatabaseHeader structs arent initialized on every access 2025-06-24 14:41:50 -03:00
Jussi Saurio
ba3bfa058d Delete unused stuff 2025-06-24 14:41:50 -03:00
Diego Reis
f0f9ad4844 core: Get rid of maybe_init_database_file
Initialization now only occurs in the first write transaction
2025-06-24 14:41:50 -03:00
Diego Reis
2f33c799e3 core: Set default database_size to 0 2025-06-24 14:41:49 -03:00
Jussi Saurio
cc2e14b11c Read page 1 from pager always, no separate db_header 2025-06-24 14:41:49 -03:00
Nils Koch
2827b86917 chore: fix clippy warnings 2025-06-23 19:52:13 +01:00
pedrocarlo
8dbf09bb42 betters instrumentation for btree operations 2025-06-11 23:34:32 -03:00
Jussi Saurio
d81f5f67bd insert spaghetti fixes 2025-06-10 14:16:26 +03:00
Pere Diaz Bou
77b6896eae implement lazy record and rowid in cursor
This also comments save_context for now
2025-06-10 14:16:26 +03:00