feat(storage): log debug commit message only on commit (#6918)

This commit is contained in:
Alexey Shekhirin
2024-03-03 20:46:04 +00:00
committed by GitHub
parent 3e54d9415e
commit a79f1951c5
3 changed files with 14 additions and 7 deletions

View File

@ -123,12 +123,15 @@ impl<K: TransactionKind> Tx<K> {
let (result, commit_latency) = f(tx);
let total_duration = start.elapsed();
debug!(
target: "storage::db::mdbx",
?total_duration,
?commit_latency,
"Commit"
);
if outcome.is_commit() {
debug!(
target: "storage::db::mdbx",
?total_duration,
?commit_latency,
is_read_only = K::IS_READ_ONLY,
"Commit"
);
}
(result, commit_latency, total_duration)
};

View File

@ -187,6 +187,11 @@ impl TransactionOutcome {
TransactionOutcome::Drop => "drop",
}
}
/// Returns `true` if the transaction outcome is a commit.
pub(crate) const fn is_commit(&self) -> bool {
matches!(self, TransactionOutcome::Commit)
}
}
/// Types of operations conducted on the database: get, put, delete, and various cursor operations.