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.
This PR introduces block header pruning for blockchain-db. Original issue: #1570
This is a draft PR to show a possible solution while having several open questions.
Pruning block headers include:
columns::KEY_LOOKUP
,columns::HEADER
, and block hash.remove_header_metadata
)The PR consists of two parts:
---prune-block-headers
which defaults to falseOpen questions:
prune_blocks_on_finalize_and_reorg
marks several blocks in a row as finalized and commits the transaction later in contrast withprune_blocks_on_finalize
which finalized every block in a separate transaction. If we modifyprune_blocks_on_finalize_and_reorg
test to query a header from the pruned fork we will get one, however, the database won't contain it. It seems that the cache gets polluted by dirty reads originating in meta updates because meta updates are saved separately and after the transaction. Is there a way to prevent it? I appreciate an advice here.cc @nazar-pc @bkchr