diff --git a/core/storage/pager.rs b/core/storage/pager.rs index eb1962a80..3f75331a4 100644 --- a/core/storage/pager.rs +++ b/core/storage/pager.rs @@ -1501,7 +1501,7 @@ impl Pager { // Providing a page is optional, if provided it will be used to avoid reading the page from disk. // This is implemented in accordance with sqlite freepage2() function. #[instrument(skip_all, level = Level::DEBUG)] - pub fn free_page(&self, page: Option, page_id: usize) -> Result> { + pub fn free_page(&self, mut page: Option, page_id: usize) -> Result> { tracing::trace!("free_page(page_id={})", page_id); const TRUNK_PAGE_HEADER_SIZE: usize = 8; const LEAF_ENTRY_SIZE: usize = 4; @@ -1524,7 +1524,7 @@ impl Pager { ))); } - let (page, _c) = match page.clone() { + let (page, _c) = match page.take() { Some(page) => { assert_eq!( page.get().id, @@ -1563,6 +1563,7 @@ impl Pager { // Add as leaf to current trunk let (page, _c) = self.read_page(trunk_page_id as usize)?; trunk_page.replace(page); + return Ok(IOResult::IO); } let trunk_page = trunk_page.as_ref().unwrap(); if trunk_page.is_locked() || !trunk_page.is_loaded() { @@ -1766,7 +1767,7 @@ impl Pager { trunk_page, current_db_size: new_db_size, }; - continue; + return Ok(IOResult::IO); } AllocatePageState::SearchAvailableFreeListLeaf { trunk_page,