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

Improve pruning: performance, config and progress logging #328

Merged
merged 5 commits into from
Jun 14, 2024

Conversation

magicxyyz
Copy link
Contributor

@magicxyyz magicxyyz commented Jun 13, 2024

part of NIT-2541

This PR:

  • reintroduces performance improvement previously removed while fixing upstream geth merge
// note: we are passing data.Root as stateRoot here, to skip the check for stateRoot existence in trie.newTrieReader,
// we already check that when opening state trie and reading the account node
trieID := trie.StorageTrieID(data.Root, key, data.Root)
storageTr, err := trie.NewStateTrie(trieID, sdb.TrieDB())
  • enables cleans cache in triedb used for traversing storage tries in dumpRawTrieDescendants - when opening storage trie with trie.NewStateTrie (using the trick above), a node with hash equal data.Root is read twice from triedb (once in when getting a trie.Reader, then when reading the node). Caching the node should save some of KeyValueStore reads.

  • adds pruner.Config.Threads option

  • adds extra progress logging when a thread traversing storage trie for given account takes longer then 5 minutes

@magicxyyz magicxyyz marked this pull request as ready for review June 14, 2024 15:31
Copy link
Collaborator

@PlasmaPower PlasmaPower left a comment

Choose a reason for hiding this comment

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

LGTM

@PlasmaPower PlasmaPower merged commit 8516902 into master Jun 14, 2024
4 of 6 checks passed
@PlasmaPower PlasmaPower deleted the pruning-progress branch June 14, 2024 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants