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

Continuous Trie Log Pruning #6075

Closed
wants to merge 13 commits into from

Conversation

siladu
Copy link
Contributor

@siladu siladu commented Oct 24, 2023

  • Feature toggled by --Xtrie-log-pruning-enabled
  • Add trie log pruning after a successful TrieLogManager.saveTrieLog
  • Each time a trie log is persisted, the current trie log is cached and the pruner is run against the oldest entries in the cache.
  • This makes no attempt to manage the backlog of old trie logs, it will only prune what has been added to the cache, i.e. trie logs that have been added since the feature was enabled.
  • Pruner limit exists in case of exceptional circumstances, but we should only ever be pruning all the forks for a single block number during each prune execution.

This is a second take of #6026
Currently built on #6072 (diff: siladu/besu@refactor-trie-log-manager...trie-log-pruning-take2)

One downside of this PR compared to #6026 is that restarting besu may leave a gap in the pruned trie logs because we don't preload the cache. This will have to be considered as part of managing the backlog. It may mean that we can't simply rely on a "one-off" resync or prune subcommand. However, these un-pruneable trie logs should be negligible compared to the saving gained for long running nodes.

Separate out the concepts of world state caching from trie log management
Make AbstractTrieLogManager a concrete implemenation (to be further renamed/refactored next commit)
Signed-off-by: Simon Dudley <[email protected]>
Feature toggled by --Xtrie-log-pruning-enabled
Each time a trie log is persisted, the current trie log is cached and the pruner is run against the oldest entries in the cache.
This makes no attempt to manage the backlog of old trie logs, it will only prune what has been added to the cache, i.e. trie logs that have been added since the feature was enabled.
Pruner limit exists in case of exceptional circumstances, but we should only ever be pruning all the forks for a single block number during each prune execution.

Signed-off-by: Simon Dudley <[email protected]>
Was only used for supporting test code and can instead reuse static factory from InMemoryKeyValueStorageProvider
Signed-off-by: Simon Dudley <[email protected]>
@github-actions
Copy link

  • I thought about documentation and added the doc-change-required label to this PR if updates are required.
  • I thought about the changelog and included a changelog update if required.
  • If my PR includes database changes (e.g. KeyValueSegmentIdentifier) I have thought about compatibility and performed forwards and backwards compatibility tests

@siladu siladu changed the title Move TrieLogProvider setup code to AbstractTrieLogManager Continuous Trie Log Pruning Oct 24, 2023
@Override
public void reset() {}
public void saveTrieLog(

Check warning

Code scanning / CodeQL

Non-synchronized override of synchronized method

Method 'saveTrieLog' overrides a synchronized method in [org.hyperledger.besu.ethereum.bonsai.trielog.TrieLogManager](1) but is not synchronized.
@siladu siladu added TeamGroot GH issues worked on by Groot Team and removed TeamGroot GH issues worked on by Groot Team labels Oct 24, 2023
@siladu
Copy link
Contributor Author

siladu commented Oct 26, 2023

Abandoning this approach in favour of an adapted form of the original #6026

@siladu siladu closed this Oct 26, 2023
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.

1 participant