chore: log mdbx tx manager msg (#21916)

This commit is contained in:
DaniPopes
2026-02-06 22:28:14 +01:00
committed by GitHub
parent 352430cd84
commit 887421cef2

View File

@@ -4,7 +4,7 @@ use crate::{
CommitLatency,
};
use std::{
ptr,
fmt, ptr,
sync::mpsc::{sync_channel, Receiver, SyncSender},
};
@@ -19,6 +19,18 @@ pub(crate) enum TxnManagerMessage {
Commit { tx: TxnPtr, sender: SyncSender<Result<(bool, CommitLatency)>> },
}
impl fmt::Debug for TxnManagerMessage {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Begin { parent, flags, sender: _ } => {
f.debug_struct("Begin").field("parent", parent).field("flags", flags).finish()
}
Self::Abort { tx, sender: _ } => f.debug_struct("Abort").field("tx", tx).finish(),
Self::Commit { tx, sender: _ } => f.debug_struct("Commit").field("tx", tx).finish(),
}
}
}
/// Manages transactions by doing two things:
/// - Opening, aborting, and committing transactions using [`TxnManager::send_message`] with the
/// corresponding [`TxnManagerMessage`]
@@ -55,7 +67,9 @@ impl TxnManager {
let task = move || {
let env = env;
loop {
match rx.recv() {
let msg = rx.recv();
tracing::debug!(target: "libmdbx::txn", ?msg, "txn-mngr received");
match msg {
Ok(msg) => match msg {
TxnManagerMessage::Begin { parent, flags, sender } => {
let _span =