-
Notifications
You must be signed in to change notification settings - Fork 491
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
Enable ancient block pruning #1216
Conversation
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
…-chain/bsc#1005 Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Updates: I have resolved all the conflicts and the tests are passing now. Below are few pending things:
|
Updates:
Next steps
|
Yes. Post pruning of the ancient data, none of the RPC calls will return the block / tx data (which is expected) for the pruned blocks. They will instead return null. Also, it doesn't affect the working of node in any way. |
updates? |
Hi, there, I have a question about block prune implementation, what is workflow with it usage, I had node with almost out of disk space, and I started there block prune, and node within several hours got out of space and crushed. So, better have some explanation about block prune implementation. My aim is to setup node with pruned blocks that supposed should save disk space on the node server? Should I resetup node, download snapshot and start bor with this settings to exclude blocks from database? How much space additionally needed? |
Hey @VSGic, a very brief workflow is written in this PR description. I'd like to know which parameters you used to run the ancient pruning and were there any errors in logs? Moreover, you can inspect the ancient datadir via the command below:
This will let you know how many blocks your ancient dir contains and if they're actually pruned or not (due to some errors while running pruning). Additionally, can you check the size of ancient datadir ( I don't think you need to setup the node again and download snapshot. The underlying state of the blockchain also takes quite a bit of space. I don't know individual amounts but one of our internal node is taking 3.8TB (mainnet, full datadir size). You might want to prune the state data as well (which might take few hours and is a lengthy process). This will reduce your state size by a great extent. See the Finally, we'll also be releasing a PBSS snapshot soon which has significant reduction in the state size if you want to wait for that. I'd appreciate if you can create a new issue to discuss this. Thanks! |
Description
Updated version of original PR from @jsvisa: #751
This PR implements PIP-32: Ancient Block Pruning. It adds a new pruner which can be used to prune the data from the ancient/freezer database in bor. The aim of this is to delete the historical block data (headers, txs, and receipts) for old blocks which are not used in verification of the chain (after a point).
Specification
The prune command keeps the last N blocks in the Freezer database and removes the rest. Value of N can vary from 0 to K, where K is the length of the chain excluding the blocks in KvDB (LevelDB/PebbleDB) (90k default) and can be set using the flag
block-amount-reserved
. Basically, the pruning process will begin from genesis moving towards the most recent block. Pruning can be done multiple times.For example: the Freezer database has these blocks: [0, 1, ..., 999, 1000]. If the value of
block-amount-reserved
is set to 100, then [0, 1, ..., 900] will be pruned and the database will be left with [901, ..., 1000]. On the second round of pruning with the value of block-amount-reserved set to 50, the remaining values will be [951, ..., 1000].The pruner maintains an offset in the key value store, which depicts the start block number of the Freezer db containing ancient data. The pruner keeps updating this value after each pruning round and uses it for the next round to determine the starting point. The pruner opens a backup Freezer db and moves the blocks to be kept from the old db location. Upon completion, it performs the validation to make sure the Freezer db and KvDB (LevelDB/PebbleDB) are in continuity and proceeds to delete the old db fully.
Note: Ancient pruning only works for
hash
based storage scheme and doesn't work forpath
based as of now.Backwards Compatibility
This change is backwards in-compatible if pruning is performed (at least once) on the node.
Changes
Breaking changes
Once pruning is done (for a particular range of blocks), one won't be able to serve RPC requests and P2P requests involving blocks in that range.
Checklist
Cross repository changes
Testing
Manual tests
Tested on devnets, and mumbai.