From c6553d82b84ec7cd29a31329923a64a83e10f204 Mon Sep 17 00:00:00 2001 From: Jussi Saurio Date: Mon, 25 Aug 2025 15:05:04 +0300 Subject: [PATCH] Clarify expected behavior with assertion --- core/storage/btree.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/storage/btree.rs b/core/storage/btree.rs index b919e7c0e..30530d691 100644 --- a/core/storage/btree.rs +++ b/core/storage/btree.rs @@ -7099,10 +7099,9 @@ fn fill_cell_payload( } if record_offset_slice.len() - amount_to_copy == 0 { - if let Some(cur_page) = current_overflow_page { - cur_page.unpin(); // We can safely unpin the current overflow page now. - } - // Everything copied. + let cur_page = current_overflow_page.as_ref().expect("we must have overflowed if the remaining payload fits on the current page"); + cur_page.unpin(); // We can safely unpin the current overflow page now. + // Everything copied. break; } *state = CopyDataState::AllocateOverflowPage;