rollback transaction when we fail in step

This commit is contained in:
pedrocarlo 2025-07-03 16:35:37 -03:00
parent 897426a662
commit 9632ab0a41
2 changed files with 7 additions and 3 deletions

View file

@ -1569,8 +1569,8 @@ pub fn begin_write_wal_frame(
if res.is_err() {
// If we do not reduce the counter here on error, we incur an infinite loop when cacheflushing
*write_counter.borrow_mut() -= 1;
res?;
}
res?;
tracing::trace!("Frame written and synced");
Ok(checksums)
}

View file

@ -382,8 +382,12 @@ impl Program {
let _ = state.result_row.take();
let (insn, insn_function) = &self.insns[state.pc as usize];
trace_insn(self, state.pc as InsnReference, insn);
let res = insn_function(self, state, insn, &pager, mv_store.as_ref())?;
match res {
let res = insn_function(self, state, insn, &pager, mv_store.as_ref());
if res.is_err() {
// TODO: see change_schema correct value
pager.rollback(false, &self.connection)?
}
match res? {
InsnFunctionStepResult::Step => {}
InsnFunctionStepResult::Done => return Ok(StepResult::Done),
InsnFunctionStepResult::IO => return Ok(StepResult::IO),