Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(prune): add pruner log with INFO level #4573

Merged
merged 5 commits into from
Sep 18, 2023

Conversation

tcoratger
Copy link
Contributor

Should solve #4563.

@codecov
Copy link

codecov bot commented Sep 12, 2023

Codecov Report

Merging #4573 (122c719) into main (b8e15fa) will increase coverage by 0.00%.
Report is 25 commits behind head on main.
The diff coverage is 13.33%.

❗ Current head 122c719 differs from pull request most recent head f5a9f72. Consider uploading reports for the commit f5a9f72 to get more accurate results

Impacted file tree graph

Files Changed Coverage Δ
crates/prune/src/pruner.rs 81.78% <13.33%> (-1.06%) ⬇️

... and 29 files with indirect coverage changes

Flag Coverage Δ
integration-tests 16.77% <0.00%> (+0.07%) ⬆️
unit-tests 64.00% <13.33%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
reth binary 30.85% <ø> (ø)
blockchain tree 83.58% <ø> (ø)
pipeline 90.53% <ø> (ø)
storage (db) 75.32% <ø> (ø)
trie 94.84% <ø> (-0.04%) ⬇️
txpool 49.61% <ø> (+0.93%) ⬆️
networking 77.21% <ø> (-0.27%) ⬇️
rpc 57.40% <ø> (+0.11%) ⬆️
consensus 63.40% <ø> (ø)
revm 31.56% <ø> (ø)
payload builder 8.97% <ø> (+2.84%) ⬆️
primitives 86.54% <ø> (+<0.01%) ⬆️

@joshieDo
Copy link
Collaborator

joshieDo commented Sep 14, 2023

This is counting how many variants PruneParts were checked. However, I think entries is related to how many table rows were deleted. Do you confirm @shekhirin ?

Comment on lines 236 to 244
trace!(target: "pruner", %tip_block_number, ?elapsed, "Pruner finished");
info!(
target: "pruner",
%tip_block_number,
%done,
"Pruner finished after {:?} nanosec, pruned {} entries",
elapsed.subsec_nanos(),
total_pruned_entries
);
Copy link
Collaborator

@shekhirin shekhirin Sep 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several things:

  1. As @joshieDo said, we want to log total number of pruned entries, and not the number of pruned parts. It would be nice to show the summary of pruning, i.e. number of entries per part. So each prune part will have its own field.
  2. Total elapsed time is nice, but let's put it into a field instead of the log message. Log message should be a human-readable text, and all the additional data should go to fields.
  3. New info log now replicates the trace one, and since INFO < TRACE in terms of log levels, we can remove the old trace log.

Copy link
Contributor Author

@tcoratger tcoratger Sep 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shekhirin Points 2 and 3 should be resolved, I'm not very familiar with the concept of pruned entries inside pruned parts because I don't know this part very well, can you give me an example of how to calculate that I imagine to place it in a HashMap which will summarize pruned entries sorted by pruned parts?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that's right. But I just realized it might a bit tricky because account and storage history pruning methods have two internal counters for pruned entries, so it's not clear which one to put in the log.

Let's just have a separate field for each of pruning parts with done value returned by the pruning method? So, something like

info!(
    target: "pruner",
    %tip_block_number,
    ?elapsed,
    %done,
    ?parts_done,
    "Pruner finished"
);

where parts_done is a HashMap<PrunePart, bool>.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shekhirin I agree, this is done now

tcoratger and others added 2 commits September 15, 2023 23:47
Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com>
Copy link
Collaborator

@shekhirin shekhirin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@shekhirin shekhirin added this pull request to the merge queue Sep 18, 2023
Merged via the queue into paradigmxyz:main with commit 78edae4 Sep 18, 2023
21 checks passed
@tcoratger tcoratger deleted the info-pruner branch September 18, 2023 20:37
@shekhirin shekhirin linked an issue Sep 19, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add pruner logs with INFO level
3 participants