-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BTree delete
implementation
#661
Conversation
a2ec67e
to
b825a26
Compare
Added Check the SQLite docs for more info: https://www.sqlite.org/pragma.html#pragma_freelist_count |
COMPAT.md
Outdated
@@ -45,6 +45,7 @@ This document describes the SQLite compatibility status of Limbo: | |||
| ON CONFLICT clause | No | | | |||
| PRAGMA | Partial | | | |||
| PRAGMA cache_size | Yes | | | |||
| PRAGMA freelist_count | Yes | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we rebase with main and update the PRAGMA in another section?
in main we re-org the pragma statements in db3fa25
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are some changes in main that can cause conflict. can we rebase.
|
||
#[test] | ||
fn test_simple_delete() -> anyhow::Result<()> { | ||
let _ = env_logger::try_init(); | ||
let tmp_db = TempDatabase::new("CREATE TABLE test (x INTEGER PRIMARY KEY);"); | ||
let conn = tmp_db.connect_limbo(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in main we also refactor this integration tests module a bit. can we rebase to avoid conflict here.
delete
implementationdelete
implementation
… found`. This removes the problem with wrong cell_indices being fed to `delete()`.
…fter `if found`. This removes the problem with wrong cell_indices" This reverts commit 6d077cc.
…ntly deletes the cell we want
Now we can add dropped pages to free list, so pages can be reused in allocate_page.
… use `clear_overflow_cells` to remove any overflow pages it has and then add them to free list.
…ion is called on cell with no overflow pages.
Check SQLite docs for more info about this PRAGMA: https://www.sqlite.org/pragma.html#pragma_freelist_count
Track page fragmentation in free_cell_range. Update page offsets in drop_cell and update cell pointer array after dropping a cell.
bced702
to
43093b7
Compare
Get
cell_idx
from stack and drops the pageCurrently the
cell_idx
we are getting is wrong (1
instead of0
for a 1 page Btree). I suspect the problem is withseek
which is advancing the stack's cell_indices[0] beforedelete
is called. Checktest/src/lib.rs::test_simple_delete()
unit test.self.stack.advance
to afterif found
block then delete works and test passes.@pereman2 need some guidance on this.
Core delete tasks:
Auxiliary tasks to make delete work properly:
free_cell_range
to reduce fragmentation.free_cell_range
.drop_cell
and update cell pointer array after dropping a cell.