From 5546288a1acd4426395f608370520958ca4920f3 Mon Sep 17 00:00:00 2001 From: Lucian Buzzo Date: Mon, 6 Jan 2025 10:56:14 +0000 Subject: [PATCH] fix: use fetch_add for incrementing depth when creating a savepoint --- query-engine/driver-adapters/src/transaction.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/query-engine/driver-adapters/src/transaction.rs b/query-engine/driver-adapters/src/transaction.rs index 1d9020a7cfb..f41c9a2cd53 100644 --- a/query-engine/driver-adapters/src/transaction.rs +++ b/query-engine/driver-adapters/src/transaction.rs @@ -191,7 +191,9 @@ impl QuaintTransaction for JsTransaction { async fn create_savepoint(&self) -> quaint::Result<()> { let current_depth = self.depth.load(Ordering::SeqCst); let new_depth = current_depth + 1; - self.depth.store(new_depth, Ordering::SeqCst); + + // Increment the depth value + self.depth.fetch_add(1, Ordering::SeqCst); let create_savepoint_statement = self.create_savepoint_statement(new_depth); if self.options().use_phantom_query {