Skip to content

Continuous Trie Log Pruning#6075

Closed
siladu wants to merge 13 commits into
besu-eth:mainfrom
siladu:trie-log-pruning-take2
Closed

Continuous Trie Log Pruning#6075
siladu wants to merge 13 commits into
besu-eth:mainfrom
siladu:trie-log-pruning-take2

Conversation

@siladu
Copy link
Copy Markdown
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.

Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
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 <simon.dudley@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
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 <simon.dudley@consensys.net>
Was only used for supporting test code and can instead reuse static factory from InMemoryKeyValueStorageProvider
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
@github-actions
Copy link
Copy Markdown

  • 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
final BonsaiWorldStateUpdateAccumulator localUpdater,
final Hash forWorldStateRootHash,
final BlockHeader forBlockHeader,
final BonsaiWorldState forWorldState) {

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
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Inialised once on startup

Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
@siladu
Copy link
Copy Markdown
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.

2 participants