Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
LucianBuzzo committed Jan 23, 2025
1 parent d17f59a commit 3f4c88b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions query-engine/core/src/interactive_transactions/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ impl ItxManager {
pub async fn commit_tx(&self, tx_id: &TxId) -> crate::Result<()> {
let transaction_entry = self.get_transaction(tx_id, "commit").await?;
let mut tx = transaction_entry.lock().await;
let depth = tx.depth()?;
let depth = tx.depth();
if depth > 1 {
tx.release_savepoint().await
} else {
Expand All @@ -200,7 +200,7 @@ impl ItxManager {
pub async fn rollback_tx(&self, tx_id: &TxId) -> crate::Result<()> {
let transaction_entry = self.get_transaction(tx_id, "rollback").await?;
let mut tx = transaction_entry.lock().await;
let depth = tx.depth().unwrap_or(0);
let depth = tx.depth();
if depth > 1 {
tx.rollback_to_savepoint().await
} else {
Expand Down
8 changes: 5 additions & 3 deletions query-engine/core/src/interactive_transactions/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,11 @@ impl InteractiveTransaction {
})
}

pub fn depth(&mut self) -> crate::Result<i32> {
let conn = self.state.as_open("depth")?;
Ok(conn.depth())
pub fn depth(&mut self) -> i32 {
match self.state.as_open("depth") {
Ok(state) => state.depth(),
Err(_) => 0,
}
}

pub async fn commit(&mut self) -> crate::Result<()> {
Expand Down

0 comments on commit 3f4c88b

Please sign in to comment.