mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:29:40 +00:00
WIP: refactor: move block writes and pruning into BlockManager #36738
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36738
Loading…
Reference in a new issue
No description provided.
Delete branch "blockstorage-prune-bookkeeping"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Conflicts
Reviewers, 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.
🔵 Suggestion · Block-file reuse after a failed prune flush is untested
The new recovery test never rewrites a file awaiting deletion, so it would miss removal of the cancellation that keeps a later flush from unlinking that reused file.
Location:
src/node/blockstorage.cpp:948(head).🔵 Suggestion · The pruned-flag invariant remains a caller prerequisite
The sole caller sets the flag correctly, but WriteBlockStorage() leaves future callers responsible for recording pruning before it can unlink files.
Location:
src/node/blockstorage.cpp:831(head).🔵 Suggestion · The prune-lock test misses locks below the reorg cutoff
The new test would still pass if MovePruneLocksBack() advanced an already-lower lock, leaving its preservation guard without a regression assertion.
Location:
src/test/blockmanager_tests.cpp:322(head).🔵 Suggestion · The prune-retry test does not check deferred flushing
The forced retry in prune_flush_failure cannot distinguish intended deferral from a change that makes pending deletions force a storage write.
Location:
src/test/chainstate_write_tests.cpp:210(head).Review coverage was incomplete.
Reviewed:
777b2f90de97· Full review report · Previous reportspermalink
Concept ACK