From 6366201f16a952dcc3cf2d4cafaeeb750bdfdb44 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Tue, 3 Mar 2026 06:56:10 +0900 Subject: [PATCH] chore: improve long read tx log (#22716) --- crates/storage/db/src/implementation/mdbx/tx.rs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/crates/storage/db/src/implementation/mdbx/tx.rs b/crates/storage/db/src/implementation/mdbx/tx.rs index 769473ec97..166cfeaa43 100644 --- a/crates/storage/db/src/implementation/mdbx/tx.rs +++ b/crates/storage/db/src/implementation/mdbx/tx.rs @@ -249,21 +249,16 @@ impl MetricsHandler { if open_duration >= self.long_transaction_duration { self.backtrace_recorded.store(true, Ordering::Relaxed); #[cfg(debug_assertions)] - let message = format!( - "The database read transaction has been open for too long. Open backtrace:\n{}\n\nCurrent backtrace:\n{}", - self.open_backtrace, - Backtrace::force_capture() - ); + let open_backtrace = format_args!("{}", self.open_backtrace); #[cfg(not(debug_assertions))] - let message = format!( - "The database read transaction has been open for too long. Backtrace:\n{}", - Backtrace::force_capture() - ); + let open_backtrace = tracing::field::Empty; warn!( target: "storage::db::mdbx", ?open_duration, - %self.txn_id, - "{message}" + id=%self.txn_id, + backtrace=%Backtrace::force_capture(), + open_backtrace, + "A database read transaction has been open for too long" ); } }