From 58f5b9c01895da0490b8281c36fe37cafdb1f15f Mon Sep 17 00:00:00 2001 From: Pere Diaz Bou Date: Wed, 5 Nov 2025 13:05:51 +0100 Subject: [PATCH] core/mvcc: is_btree_allocated fix --- core/mvcc/cursor.rs | 4 ++-- core/mvcc/database/mod.rs | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/core/mvcc/cursor.rs b/core/mvcc/cursor.rs index e024d454f..124b0ca49 100644 --- a/core/mvcc/cursor.rs +++ b/core/mvcc/cursor.rs @@ -220,9 +220,9 @@ impl MvccLazyCursor { new_position } - /// If page id is negative, it means the btree is not allocated. fn is_btree_allocated(&self) -> bool { - self.table_id.is_btree_allocated() + let maybe_root_page = self.db.table_id_to_rootpage.get(&self.table_id); + maybe_root_page.is_some_and(|entry| entry.value().is_some()) } } diff --git a/core/mvcc/database/mod.rs b/core/mvcc/database/mod.rs index c249811b0..0057e56d8 100644 --- a/core/mvcc/database/mod.rs +++ b/core/mvcc/database/mod.rs @@ -63,10 +63,6 @@ impl MVTableId { assert!(value < 0, "MVCC table IDs are always negative"); Self(value) } - - pub fn is_btree_allocated(&self) -> bool { - self.0 >= 0 - } } impl From for MVTableId {