From 30596de7414ce8d21fb639fe4ea00f7f415652d0 Mon Sep 17 00:00:00 2001 From: Jussi Saurio Date: Fri, 19 Sep 2025 08:28:45 +0300 Subject: [PATCH] mvcc: dont set tx state to commit before actually committing --- core/mvcc/database/mod.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/mvcc/database/mod.rs b/core/mvcc/database/mod.rs index 596ff3b9e..1c3bac202 100644 --- a/core/mvcc/database/mod.rs +++ b/core/mvcc/database/mod.rs @@ -803,11 +803,6 @@ impl StateTransition for CommitStateMachine { } CommitState::Commit { end_ts } => { let mut log_record = LogRecord::new(*end_ts); - let tx = mvcc_store.txs.get(&self.tx_id).unwrap(); - let tx_unlocked = tx.value(); - tx_unlocked - .state - .store(TransactionState::Committed(*end_ts)); for id in &self.write_set { if let Some(row_versions) = mvcc_store.rows.get(id) { let mut row_versions = row_versions.value().write(); @@ -909,6 +904,11 @@ impl StateTransition for CommitStateMachine { return Ok(TransitionResult::Continue); } CommitState::CommitEnd { end_ts } => { + let tx = mvcc_store.txs.get(&self.tx_id).unwrap(); + let tx_unlocked = tx.value(); + tx_unlocked + .state + .store(TransactionState::Committed(*end_ts)); // We have now updated all the versions with a reference to the // transaction ID to a timestamp and can, therefore, remove the // transaction. Please note that when we move to lockless, the