diff --git a/core/storage/btree.rs b/core/storage/btree.rs index 05dacb53d..3f6822872 100644 --- a/core/storage/btree.rs +++ b/core/storage/btree.rs @@ -795,9 +795,12 @@ impl BTreeCursor { // if we clear space that is at the start of the cell content area, // we need to update the cell content area pointer forward to account for the removed space - // FIXME: is offset ever < cell_content_area? + // FIXME: is offset ever < cell_content_area? cell content area grows leftwards and the pointer + // is to the start of the last allocated cell. should we assert!(offset >= page.cell_content_area()) + // and change this to if offset == page.cell_content_area()? if offset <= page.cell_content_area() { - page.write_u16(PAGE_HEADER_OFFSET_FREEBLOCK, page.first_freeblock()); // why is this here? + // FIXME: remove the line directly below this, it does not change anything. + page.write_u16(PAGE_HEADER_OFFSET_FREEBLOCK, page.first_freeblock()); page.write_u16(PAGE_HEADER_OFFSET_CELL_CONTENT_AREA, offset + len); return; } diff --git a/core/storage/sqlite3_ondisk.rs b/core/storage/sqlite3_ondisk.rs index f6a7fbe2e..e92371e05 100644 --- a/core/storage/sqlite3_ondisk.rs +++ b/core/storage/sqlite3_ondisk.rs @@ -484,6 +484,8 @@ impl PageContent { } /// The start of the cell content area. + /// SQLite strives to place cells as far toward the end of the b-tree page as it can, + /// in order to leave space for future growth of the cell pointer array. pub fn cell_content_area(&self) -> u16 { self.read_u16(5) }