Skip to content

Commit

Permalink
even more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Aug 18, 2023
1 parent bbf5c0c commit adffcf6
Showing 1 changed file with 65 additions and 5 deletions.
70 changes: 65 additions & 5 deletions crates/prune/src/pruner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,66 +101,126 @@ impl<DB: Database> Pruner<DB> {
if let Some((to_block, prune_mode)) =
self.modes.prune_target_block_receipts(tip_block_number)?
{
trace!(
target: "pruner",
prune_part = ?PrunePart::Receipts,
%to_block,
?prune_mode,
"Got target block to prune"
);

let part_start = Instant::now();
done = done && self.prune_receipts(&provider, to_block, prune_mode)?;
self.metrics
.get_prune_part_metrics(PrunePart::Receipts)
.duration_seconds
.record(part_start.elapsed())
} else {
trace!(target: "pruner", "No receipts to prune");
trace!(
target: "pruner",
prune_part = ?PrunePart::Receipts,
"No target block to prune"
);
}

if let Some((to_block, prune_mode)) =
self.modes.prune_target_block_transaction_lookup(tip_block_number)?
{
trace!(
target: "pruner",
prune_part = ?PrunePart::TransactionLookup,
%to_block,
?prune_mode,
"Got target block to prune"
);

let part_start = Instant::now();
done = done && self.prune_transaction_lookup(&provider, to_block, prune_mode)?;
self.metrics
.get_prune_part_metrics(PrunePart::TransactionLookup)
.duration_seconds
.record(part_start.elapsed())
} else {
trace!(target: "pruner", "No transaction lookup entries to prune");
trace!(
target: "pruner",
prune_part = ?PrunePart::TransactionLookup,
"No target block to prune"
);
}

if let Some((to_block, prune_mode)) =
self.modes.prune_target_block_sender_recovery(tip_block_number)?
{
trace!(
target: "pruner",
prune_part = ?PrunePart::SenderRecovery,
%to_block,
?prune_mode,
"Got target block to prune"
);

let part_start = Instant::now();
done = done && self.prune_transaction_senders(&provider, to_block, prune_mode)?;
self.metrics
.get_prune_part_metrics(PrunePart::SenderRecovery)
.duration_seconds
.record(part_start.elapsed())
} else {
trace!(target: "pruner", "No transaction senders to prune");
trace!(
target: "pruner",
prune_part = ?PrunePart::SenderRecovery,
"No target block to prune"
);
}

if let Some((to_block, prune_mode)) =
self.modes.prune_target_block_account_history(tip_block_number)?
{
trace!(
target: "pruner",
prune_part = ?PrunePart::AccountHistory,
%to_block,
?prune_mode,
"Got target block to prune"
);

let part_start = Instant::now();
done = done && self.prune_account_history(&provider, to_block, prune_mode)?;
self.metrics
.get_prune_part_metrics(PrunePart::AccountHistory)
.duration_seconds
.record(part_start.elapsed())
} else {
trace!(target: "pruner", "No account history entries to prune");
trace!(
target: "pruner",
prune_part = ?PrunePart::AccountHistory,
"No target block to prune"
);
}

if let Some((to_block, prune_mode)) =
self.modes.prune_target_block_storage_history(tip_block_number)?
{
trace!(
target: "pruner",
prune_part = ?PrunePart::StorageHistory,
%to_block,
?prune_mode,
"Got target block to prune"
);

let part_start = Instant::now();
done = done && self.prune_storage_history(&provider, to_block, prune_mode)?;
self.metrics
.get_prune_part_metrics(PrunePart::StorageHistory)
.duration_seconds
.record(part_start.elapsed())
} else {
trace!(target: "pruner", "No storage history entries to prune");
trace!(
target: "pruner",
prune_part = ?PrunePart::StorageHistory,
"No target block to prune"
);
}

provider.commit()?;
Expand Down

0 comments on commit adffcf6

Please sign in to comment.