mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-05 01:04:22 +01:00
btree: add a few more assertions about balance state
This commit is contained in:
@@ -2256,6 +2256,7 @@ impl BTreeCursor {
|
||||
let overflows = !page.get().get_contents().overflow_cells.is_empty();
|
||||
if overflows {
|
||||
*write_state = WriteState::Balancing;
|
||||
assert!(self.balance_state.sub_state == BalanceSubState::Start, "There should be no balancing operation in progress when insert state is {:?}, got: {:?}", self.state, self.balance_state.sub_state);
|
||||
// If we balance, we must save the cursor position and seek to it later.
|
||||
// FIXME: we shouldn't have both DeleteState::SeekAfterBalancing and
|
||||
// save_context()/restore/context(), they are practically the same thing.
|
||||
@@ -2311,6 +2312,7 @@ impl BTreeCursor {
|
||||
};
|
||||
if overflows || underflows {
|
||||
*write_state = WriteState::Balancing;
|
||||
assert!(self.balance_state.sub_state == BalanceSubState::Start, "There should be no balancing operation in progress when overwrite state is {:?}, got: {:?}", self.state, self.balance_state.sub_state);
|
||||
// If we balance, we must save the cursor position and seek to it later.
|
||||
// FIXME: we shouldn't have both DeleteState::SeekAfterBalancing and
|
||||
// save_context()/restore/context(), they are practically the same thing.
|
||||
|
||||
Reference in New Issue
Block a user