Log an operation to the WAL if there's an active transaction
(
&self,
operation_type: crate::txn::state::OperationType,
description: String,
)
| 679 | |
| 680 | /// Log an operation to the WAL if there's an active transaction |
| 681 | pub fn log_operation_to_wal( |
| 682 | &self, |
| 683 | operation_type: crate::txn::state::OperationType, |
| 684 | description: String, |
| 685 | ) -> Result<(), ExecutionError> { |
| 686 | // Check if we have an active transaction |
| 687 | let current_txn = self.current_transaction.read().map_err(|_| { |
| 688 | ExecutionError::RuntimeError("Failed to read current transaction".to_string()) |
| 689 | })?; |
| 690 | |
| 691 | if let Some(txn_id) = *current_txn { |
| 692 | drop(current_txn); |
| 693 | // Log the operation to WAL |
| 694 | self.transaction_manager |
| 695 | .log_operation(txn_id, operation_type, description)?; |
| 696 | } |
| 697 | // If no active transaction, don't log to WAL (this shouldn't happen with autocommit) |
| 698 | |
| 699 | Ok(()) |
| 700 | } |
| 701 | |
| 702 | /// Private helper for statement execution within the unified flow |
| 703 | fn execute_statement( |
nothing calls this directly
no test coverage detected