From aa84daabf1fa536b732a2a7cbf425cc3bb345f4e Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Thu, 17 Jul 2025 16:23:16 +0300 Subject: [PATCH] core/storage: Fix BTreeCursor::rowid() with MVCC --- core/storage/btree.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/core/storage/btree.rs b/core/storage/btree.rs index d6527c777..414e15bc9 100644 --- a/core/storage/btree.rs +++ b/core/storage/btree.rs @@ -4065,10 +4065,14 @@ impl BTreeCursor { #[instrument(skip(self), level = Level::INFO)] pub fn rowid(&mut self) -> Result>> { if let Some(mv_cursor) = &self.mv_cursor { - let mv_cursor = mv_cursor.borrow(); - return Ok(IOResult::Done( - mv_cursor.current_row_id().map(|rowid| rowid.row_id), - )); + if self.has_record.get() { + let mv_cursor = mv_cursor.borrow(); + return Ok(IOResult::Done( + mv_cursor.current_row_id().map(|rowid| rowid.row_id), + )); + } else { + return Ok(IOResult::Done(None)); + } } if self.has_record.get() { let page = self.stack.top();