Repository: tursodatabase/limbo (rust)

Issue:
Transaction commit in program halt is not re-entrant
If the `Program::halt()` function returns I/O status code, we attempt to commit a transaction that has already been committed as we retry the instruction. Part of the problem is that we perform checkpointing for every transaction, which is not what we want.

Pull request description:
Fix AutoCommit for IO halting
IDK if I'm being naive here but it was the easiest way that I found to handle it.

closes #1004 

Patch:
diff --git a/core/vdbe/mod.rs b/core/vdbe/mod.rs
index 7621146d..af3349a5 100644
--- a/core/vdbe/mod.rs
+++ b/core/vdbe/mod.rs
@@ -1275,6 +1275,10 @@ impl Program {
                     rollback,
                 } => {
                     let conn = self.connection.upgrade().unwrap();
+                    if matches!(state.halt_state, Some(HaltState::Checkpointing)) {
+                        return self.halt(pager, state, mv_store);
+                    }
+
                     if *auto_commit != *conn.auto_commit.borrow() {
                         if *rollback {
                             todo!("Rollback is not implemented");


Test patch:
diff --git a/testing/all.test b/testing/all.test
index 42aadd03..5119b8eb 100755
--- a/testing/all.test
+++ b/testing/all.test
@@ -25,5 +25,4 @@ source $testdir/changes.test
 source $testdir/total-changes.test
 source $testdir/offset.test
 source $testdir/scalar-functions-printf.test
-# Disabled until https://github.com/tursodatabase/limbo/issues/1004 is fixed
-# source $testdir/transactions.test
+source $testdir/transactions.test