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

lib/trie: prepare trie nodes for mutation only when mutation is guaranteed #2836

Closed
qdm12 opened this issue Sep 15, 2022 · 1 comment
Closed

Comments

@qdm12
Copy link
Contributor

qdm12 commented Sep 15, 2022

Preparing a trie node for mutation means:

  1. Report the hash of the existing trie node as a deleted hash for the online pruner
  2. Deep copy the trie node and update the trie 'generation' (bumped on every trie snapshot) on the new node copy

There has already been some work to reduce the number of trie node mutation preparations. However, this was more for performance reasons (CPU and memory usage) by reducing the node deep copying when not needed.

Working on #2835 I realized about 1. mentioned above, and checked our trie code again for these mutation preparations.
Some of them are appropriate, but some happen although mutation isn't guaranteed. In this case, it essentially means our online pruner would just throw out valid and currently in use node hashes from the database. We didn't spot this so far since we don't run the online pruning really.

To fix this, we should change those few occurrences to occur ONLY when mutation is GUARANTEED.

@qdm12
Copy link
Contributor Author

qdm12 commented Oct 17, 2022

Done in #2834

@qdm12 qdm12 closed this as completed Oct 17, 2022
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

No branches or pull requests

2 participants