Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,26 +84,32 @@ impl Drive {
);

#[cfg(feature = "grovedb_operations_logging")]
if tracing::event_enabled!(target: "drive_grovedb_operations", tracing::Level::TRACE)
&& cost_context.value.is_ok()
{
let root_hash = self
.grove
.root_hash(transaction, &drive_version.grove_version)
.unwrap()
.map_err(Error::from)?;

let (ops, previous_root_hash) =
maybe_params_for_logs.expect("log params should be set above");

tracing::trace!(
target: "drive_grovedb_operations",
?ops,
?root_hash,
?previous_root_hash,
is_transactional = transaction.is_some(),
"grovedb batch applied",
);
if let Some((ops, previous_root_hash)) = maybe_params_for_logs {
if cost_context.value.is_ok() {
match self
.grove
.root_hash(transaction, &drive_version.grove_version)
.unwrap()
{
Ok(root_hash) => {
tracing::trace!(
target: "drive_grovedb_operations",
?ops,
?root_hash,
?previous_root_hash,
is_transactional = transaction.is_some(),
"grovedb batch applied",
);
}
Err(e) => {
tracing::warn!(
target: "drive_grovedb_operations",
error = ?e,
"failed to get root hash for post-batch logging",
);
}
}
}
}

push_drive_operation_result(cost_context, drive_operations)
Expand Down
46 changes: 26 additions & 20 deletions packages/rs-drive/src/util/grove_operations/grove_clear/v0/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,32 @@ impl Drive {
.map(|_| ());

#[cfg(feature = "grovedb_operations_logging")]
if tracing::event_enabled!(target: "drive_grovedb_operations", tracing::Level::TRACE)
&& result.is_ok()
{
let root_hash = self
.grove
.root_hash(transaction, &drive_version.grove_version)
.unwrap()
.map_err(Error::from)?;

let (path, previous_root_hash) =
maybe_params_for_logs.expect("log params should be set above");

tracing::trace!(
target: "drive_grovedb_operations",
path = ?path.to_vec(),
?root_hash,
?previous_root_hash,
is_transactional = transaction.is_some(),
"grovedb clear",
);
if let Some((path, previous_root_hash)) = maybe_params_for_logs {
if result.is_ok() {
match self
.grove
.root_hash(transaction, &drive_version.grove_version)
.unwrap()
{
Ok(root_hash) => {
tracing::trace!(
target: "drive_grovedb_operations",
path = ?path.to_vec(),
?root_hash,
?previous_root_hash,
is_transactional = transaction.is_some(),
"grovedb clear",
);
}
Err(e) => {
tracing::warn!(
target: "drive_grovedb_operations",
error = ?e,
"failed to get root hash for post-clear logging",
);
}
}
}
}

result
Expand Down
Loading