From b07eca0b74909bdc1ffefa7929cb7acf6c2fbf6b Mon Sep 17 00:00:00 2001 From: Christopher Berner Date: Tue, 3 Sep 2024 20:54:19 -0700 Subject: [PATCH] Fix potential panic in repair The freed tree referenced by a savepoint should not be accessed, because its pages are not versioned -- they are immediately freed after a durable commit --- src/db.rs | 12 ------------ src/tree_store/page_store/savepoint.rs | 4 ---- 2 files changed, 16 deletions(-) diff --git a/src/db.rs b/src/db.rs index 5452dd6d..483f40f8 100644 --- a/src/db.rs +++ b/src/db.rs @@ -504,18 +504,6 @@ impl Database { if let Some(header) = savepoint.get_user_root() { Self::check_pages_allocated_recursive(header.root, mem.clone())?; } - if let Some(header) = savepoint.get_freed_root() { - let freed_pages_iter = AllPageNumbersBtreeIter::new( - header.root, - FreedTableKey::fixed_width(), - FreedPageList::fixed_width(), - mem.clone(), - )?; - for page_number in freed_pages_iter { - let page = page_number?; - assert!(mem.is_allocated(page)); - } - } } } diff --git a/src/tree_store/page_store/savepoint.rs b/src/tree_store/page_store/savepoint.rs index 72e3e3a3..72a4b2e9 100644 --- a/src/tree_store/page_store/savepoint.rs +++ b/src/tree_store/page_store/savepoint.rs @@ -78,10 +78,6 @@ impl Savepoint { self.user_root } - pub(crate) fn get_freed_root(&self) -> Option { - self.freed_root - } - pub(crate) fn db_address(&self) -> *const TransactionTracker { self.transaction_tracker.as_ref() as *const _ }