diff --git a/core/mvcc/database/checkpoint_state_machine.rs b/core/mvcc/database/checkpoint_state_machine.rs index ea5b4ed05..5e4a9c4ff 100644 --- a/core/mvcc/database/checkpoint_state_machine.rs +++ b/core/mvcc/database/checkpoint_state_machine.rs @@ -277,11 +277,9 @@ impl CheckpointStateMachine { return Err(crate::LimboError::Busy); } result?; - self.connection - .transaction_state - .replace(TransactionState::Write { - schema_did_change: false, - }); // TODO: schema_did_change?? + *self.connection.transaction_state.write() = TransactionState::Write { + schema_did_change: false, + }; // TODO: schema_did_change?? self.lock_states.pager_write_tx = true; self.state = CheckpointState::WriteRow { write_set_index: 0, @@ -422,9 +420,7 @@ impl CheckpointStateMachine { self.state = CheckpointState::TruncateLogicalLog; self.lock_states.pager_read_tx = false; self.lock_states.pager_write_tx = false; - self.connection - .transaction_state - .replace(TransactionState::None); + *self.connection.transaction_state.write() = TransactionState::None; let header = self .pager .io @@ -520,14 +516,10 @@ impl StateTransition for CheckpointStateMachine { .io .block(|| self.pager.end_tx(rollback, self.connection.as_ref())) .expect("failed to end pager write tx"); - self.connection - .transaction_state - .replace(TransactionState::None); + *self.connection.transaction_state.write() = TransactionState::None; } else if self.lock_states.pager_read_tx { self.pager.end_read_tx().unwrap(); - self.connection - .transaction_state - .replace(TransactionState::None); + *self.connection.transaction_state.write() = TransactionState::None; } if self.lock_states.blocking_checkpoint_lock_held { self.checkpoint_lock.unlock(); diff --git a/core/mvcc/database/mod.rs b/core/mvcc/database/mod.rs index cf3a37e1f..f78c46d1a 100644 --- a/core/mvcc/database/mod.rs +++ b/core/mvcc/database/mod.rs @@ -590,7 +590,7 @@ impl StateTransition for CommitStateMachine { mvcc_store .global_header .write() - .replace(*tx_unlocked.header.borrow()); + .replace(*tx_unlocked.header.read()); // 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