diff --git a/core/lib.rs b/core/lib.rs index 739d48eba..5c97c8a72 100644 --- a/core/lib.rs +++ b/core/lib.rs @@ -464,7 +464,6 @@ impl Database { ), database_schemas: RefCell::new(std::collections::HashMap::new()), auto_commit: Cell::new(true), - mv_transactions: RefCell::new(Vec::new()), transaction_state: Cell::new(TransactionState::None), last_insert_rowid: Cell::new(0), last_change: Cell::new(0), @@ -944,8 +943,6 @@ pub struct Connection { database_schemas: RefCell>>, /// Whether to automatically commit transaction auto_commit: Cell, - /// Transactions that are in progress. - mv_transactions: RefCell>, transaction_state: Cell, last_insert_rowid: Cell, last_change: Cell, diff --git a/core/vdbe/execute.rs b/core/vdbe/execute.rs index 2bbaea1d7..5974fe9c6 100644 --- a/core/vdbe/execute.rs +++ b/core/vdbe/execute.rs @@ -2174,7 +2174,6 @@ pub fn op_transaction( return_if_io!(mv_store.begin_exclusive_tx(pager.clone(), None)) } }; - conn.mv_transactions.borrow_mut().push(tx_id); program.connection.mv_tx_id.set(Some(tx_id)); } else if updated && matches!(new_transaction_state, TransactionState::Write { .. }) diff --git a/core/vdbe/mod.rs b/core/vdbe/mod.rs index 1822813de..5d28d2e8a 100644 --- a/core/vdbe/mod.rs +++ b/core/vdbe/mod.rs @@ -820,17 +820,11 @@ impl Program { let auto_commit = conn.auto_commit.get(); if auto_commit { // FIXME: we don't want to commit stuff from other programs. - let mut mv_transactions = conn.mv_transactions.borrow_mut(); if matches!(program_state.commit_state, CommitState::Ready) { - assert!( - mv_transactions.len() <= 1, - "for now we only support one mv transaction in single connection, {mv_transactions:?}", - ); - if mv_transactions.is_empty() { + let Some(tx_id) = conn.mv_tx_id.get() else { return Ok(IOResult::Done(())); - } - let tx_id = mv_transactions.first().unwrap(); - let state_machine = mv_store.commit_tx(*tx_id, pager.clone(), &conn).unwrap(); + }; + let state_machine = mv_store.commit_tx(tx_id, pager.clone(), &conn).unwrap(); program_state.commit_state = CommitState::CommitingMvcc { state_machine }; } let CommitState::CommitingMvcc { state_machine } = &mut program_state.commit_state @@ -843,7 +837,6 @@ impl Program { conn.mv_tx_id.set(None); conn.transaction_state.replace(TransactionState::None); program_state.commit_state = CommitState::Ready; - mv_transactions.clear(); return Ok(IOResult::Done(())); } IOResult::IO(io) => {