-
Notifications
You must be signed in to change notification settings - Fork 929
8337 modify chain data pruner #8506
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
8337 modify chain data pruner #8506
Conversation
Signed-off-by: Matilda Clerke <[email protected]>
Signed-off-by: Matilda Clerke <[email protected]>
Signed-off-by: Matilda Clerke <[email protected]>
Signed-off-by: Matilda Clerke <[email protected]>
Signed-off-by: Matilda Clerke <[email protected]>
Signed-off-by: Matilda Clerke <[email protected]>
Signed-off-by: Matilda Clerke <[email protected]>
…nesis block Signed-off-by: Matilda Clerke <[email protected]>
Signed-off-by: Matilda Clerke <[email protected]>
besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java
Outdated
Show resolved
Hide resolved
names = {PRE_MERGE_PRUNING_ENABLED_FLAG}, | ||
description = | ||
"Enable the chain pruner to actively prune pre-merge blocks, but not headers (default: ${DEFAULT-VALUE})") | ||
private final Boolean preMergePruningEnabled = Boolean.FALSE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be nice to see chain pruning be contingent on the sync mode in the same way trielog pruning is. Like a typical node would want to prune pre-merge history, but a full-sync node would not.
The network pre-merge cut-off could be an empty Optional for all networks except those that have at release time entered the proto-4444 window. This way chain pruning could always be enabled, but the presence or absence of a pruning cutoff is what causes the behavior change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While it would be nice to enable pruning by default, I think users might be upset by their stored history being deleted unexpectedly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was originally thinking of a one-off purge of pre-merge blocks and receipts but this approach makes sense in light of the future eip-4444 moving window
besu/src/main/java/org/hyperledger/besu/cli/options/ChainPruningOptions.java
Outdated
Show resolved
Hide resolved
besu/src/main/java/org/hyperledger/besu/cli/options/ChainPruningOptions.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments
besu/src/main/java/org/hyperledger/besu/cli/options/ChainPruningOptions.java
Outdated
Show resolved
Hide resolved
besu/src/main/java/org/hyperledger/besu/cli/options/ChainPruningOptions.java
Outdated
Show resolved
Hide resolved
besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java
Outdated
Show resolved
Hide resolved
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/ChainDataPruner.java
Outdated
Show resolved
Hide resolved
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/ChainDataPruner.java
Show resolved
Hide resolved
new ChainDataPrunerStorage(new InMemoryKeyValueStorage()), | ||
0, | ||
ChainDataPruner.Mode.CHAIN_PRUNING, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No tests added for pre merge pruning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet, but I can add some once we're happy with the code
Co-authored-by: Sally MacFarlane <[email protected]> Signed-off-by: Matilda-Clerke <[email protected]>
Co-authored-by: Sally MacFarlane <[email protected]> Signed-off-by: Matilda-Clerke <[email protected]>
Signed-off-by: Matilda Clerke <[email protected]>
besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java
Outdated
Show resolved
Hide resolved
blockchainStorage, () -> blockchain.removeObserver(chainDataPrunerObserverId.get())); | ||
chainDataPrunerObserverId.set(blockchain.observeBlockAdded(chainDataPruner)); | ||
if (chainPrunerConfiguration.chainPruningEnabled()) { | ||
LOG.info( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good user feedback.
switch (network) { | ||
case MAINNET -> MAINNET_MERGE_BLOCK_NUMBER; | ||
case SEPOLIA -> SEPOLIA_MERGE_BLOCK_NUMBER; | ||
default -> 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a network is cancun at genesis, like hoodi is, then we don't do any PRE_MERGE_PRUNING, which makes sense. We would start CHAIN_PRUNING once we got to block 256. However, 6110 doesn't activate till pectra does. Might we have an inconsistency wrt deposits in the interim between them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also prefer using the checkpoint at Genesis for pruning configuration, as it aligns with the approach taken in #8582
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this PR shares some similarities with #8582.
The 8582 PR includes a flag for saving only headers to the database, which we could consolidate with the flags in this PR.
Additionally, 8582 utilises the checkpoint at genesis to establish the header cutoff. I suggest we adopt the same approach here, rather than introducing new constants to NetworkName or other locations.
Signed-off-by: Matilda Clerke <[email protected]>
...perledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBColumnarKeyValueStorage.java
Outdated
Show resolved
Hide resolved
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/ChainDataPruner.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not part of the PR, but more an improvement, make the chain pruner threadpool expose the same metrics names as other thread pools.
To include the metrics in Besu Full dashboard, we need to change
MonitoredExecutors.newBoundedThreadPool(
ChainDataPruner.class.getSimpleName(),
1,
1,
ChainDataPruner.MAX_PRUNING_THREAD_QUEUE_SIZE,
metricsSystem));
to
MonitoredExecutors.newBoundedThreadPool(
EthScheduler.class.getSimpleName() + "-ChainDataPruner",
1,
1,
ChainDataPruner.MAX_PRUNING_THREAD_QUEUE_SIZE,
metricsSystem));
One other solution is to integrate the thread pool to EthScheduler.
This is related to the formula we're using to display the metrics of monitred thread pools
as the formula currently is something like this
/besu_executors_ethscheduler_([^_]*)_.*/
Signed-off-by: Matilda Clerke <[email protected]>
Signed-off-by: Matilda Clerke <[email protected]>
…led status Signed-off-by: Matilda Clerke <[email protected]>
Signed-off-by: Matilda Clerke <[email protected]>
Signed-off-by: Matilda Clerke <[email protected]>
EthScheduler.class.getSimpleName() + "-ChainDataPruner",
this change has been made
Signed-off-by: Matilda Clerke <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs a changelog
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/ChainDataPruner.java
Show resolved
Hide resolved
besu/src/main/java/org/hyperledger/besu/cli/options/ChainPruningOptions.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Matilda Clerke <[email protected]>
…iple calls per expected call Signed-off-by: Matilda Clerke <[email protected]>
Signed-off-by: Matilda Clerke <[email protected]>
… of multiple calls per expected call" This reverts commit c197b1e. Signed-off-by: Matilda Clerke <[email protected]>
4edd2f1
to
5769dea
Compare
Signed-off-by: Matilda Clerke <[email protected]>
Signed-off-by: Matilda Clerke <[email protected]>
…kName Signed-off-by: Matilda Clerke <[email protected]>
…nto 8337-modify-chain-data-pruner
Signed-off-by: Matilda Clerke <[email protected]>
Signed-off-by: Matilda Clerke <[email protected]>
…nto 8337-modify-chain-data-pruner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚢
PR description
Add an online option to prune pre-merge blocks from the database
Fixed Issue(s)
#8337