Repository navigation
Conversation
Without this, -prune and -fastprune in extra_args have no effect.
Move the blk file aside instead of deleting it, so it can be restored.
The pruned blk/rev files are not deleted, even after a later flush succeeds.
Files selected for pruning were kept in a local, so a failed flush left them on disk until the next startup. Keep them in BlockManager and delete them after the next block index write. Take them with the dirty entries, which WriteBlockIndexDB() drops even if the write fails. Drop a file from the set once a block is written to it. Pending files wait for the next periodic, forced or shutdown flush rather than forcing one, which would retry a failing write on every block.
Move the block and undo file flush, block index write and pruned file deletion from FlushStateToDisk into BlockManager. Their bench log lines change from FlushStateToDisk to WriteBlockStorage.
Validation read BlockManager's prune locks directly. Move that code and PRUNE_LOCK_BUFFER into BlockManager.
BlockManager read the chainstate to decide what to prune. Decide in validation and pass the height range and sizes instead. An Assume checks the heights are non-negative.
Move FlushStateToDisk's handling of the prune request, prune locks, pruned flag, files to delete and blocks directory space check into BlockManager. The prune request is cleared before the prune locks are applied rather than after selection, which differs only if selection throws. An Assume checks that the pruned flag is set before files are queued for deletion, so a restart knows blocks were deleted.
Contributor
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
This was referenced Nov 4, 2026
This was referenced Nov 13, 2026
Contributor
|
Concept ACK |
This was referenced Nov 14, 2026
This was referenced Nov 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

FlushStateToDisk()handles block storage directly. It appliesBlockManager's prune locks, writes its pruned flag, checks its blocks directory space and runs the flush, index write and file deletion, whileBlockManagerreads the chainstate to pick files. A pruning API on block storage (#35627) would have to go through validation for all of it.This moves the storage side into
BlockManager, as described in the same issue. Validation decides which heights may be pruned and passes them as limits.BlockManagerapplies its prune locks, selects the files, flushes, writes the index and deletes the files, in the same order as before. There is no behavior change to my knowledge.The kernel pruning functions in #36856 and #36857 use this.
Based on #36735 Draft until it is merged.
Thanks to musaHaruna for his review on my fork, which led to grouping and checking the prune limits and to moving the prune bookkeeping into
BlockManager.