From 9629e2f26aa5877c86ce8932243dc98a3324cfcc Mon Sep 17 00:00:00 2001 From: Nikita Sivukhin Date: Wed, 29 Oct 2025 14:24:56 +0400 Subject: [PATCH] reset move_to_right_state cached state in case of quick balancing --- core/storage/btree.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/storage/btree.rs b/core/storage/btree.rs index daae63d16..659dc2208 100644 --- a/core/storage/btree.rs +++ b/core/storage/btree.rs @@ -2589,6 +2589,9 @@ impl BTreeCursor { /// 4. Continue balance from the parent page (inserting the new divider cell may have overflowed the parent) #[instrument(skip(self), level = Level::DEBUG)] fn balance_quick(&mut self) -> Result> { + // Since we are going to change the btree structure, let's forget our cached knowledge of the rightmost page. + let _ = self.move_to_right_state.1.take(); + // Allocate a new leaf page and insert the overflow cell payload in it. let new_rightmost_leaf = return_if_io!(self.pager.do_allocate_page( PageType::TableLeaf,