-
Notifications
You must be signed in to change notification settings - Fork 289
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
add prune beacon chain feature #3908
add prune beacon chain feature #3908
Conversation
c5e158d
to
fce50c2
Compare
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.
please fix CI errors, and present test results
This PR change looks does not have a large impact in storage size. From my understanding, the major contributor to the storage is actually the state. Is there any benchmark of this PR to metric how many storage we are saving on mainnet? |
64f3442
to
857f72c
Compare
@JackyWYX You are right, the major contributor to the storage is validator snapshot (in testnet shard 1 beacon chain, it almost 76%, mainnet snapshot is damaged, calculation later) I added prune validator snapshot, tx and cx feature, But this requires @rlan35 to evaluate whether it is safe to delete. testnet shard 1 beacon chain data constitute(yellow line is prune data, almost 90% size) |
ae696d1
to
1d60746
Compare
Testnet doesn't have many transactions and testnet epoch is every 4 hours. So you will see the validatorSnapshot taking more spaces. But in mainnet. epoch is every 18 hours and there is lots of txns. So I doubt the situation will be a lot different there. Do you mind analyzing the storage cost for mainnet instead? |
You are rignt! We can see situation will be a lot different there. mainnet shard 1 beacon chain data constitute(yellow line is prune data, almost 60% size) And we can see I see a lot of unknown (other) data in the database, The length of their keys is 32 bytes, I haven't found their source in the code yet. I guess they are a transactions data, But when I hex them, I can’t find these transactions. Here are some samples: Keys Hex: Keys Hex: These data make our compact require more IO and longer time, Do you know what these are |
These are all the defined keys for the data entry: https://github.com/harmony-one/harmony/blob/main/core/rawdb/schema.go#L31. Don't see any keys as plane 32 bytes hash. That's weird. |
Please make sure that the feature is turned off by default and only enabled if specifically configured. And also fix the Travis tests. |
@rlan35 It's turned off by default, Travis Has been successed |
I think the unknown data is the |
Welcome for discussion for the comments BTW. |
@JackyWYX You can use the following of the code to verify that iteration is faster and simpler than mark in db.
|
Is this still in consideration to be implemented? |
@OneUnitedPowerValidator Currently under review |
Is it a hardfork? Can we enable this feature using the configuration flag? So that it can be dynamically enabled/disabled using configuration flag. |
@LeoHChen There is an optional configuration to open, But once opened, if you want to close, you need to rclone again |
a few questions,
|
|
Do we have any ETA on this PR? |
hey @LuttyYang @rlan35 @LeoHChen tested this PR as the validator on shard1 of mainnet, and the result as follows: first of all, our normal node's db size of shard1 is Node 1using binary build by this PR, synced from latest block(at that time), and the storage used now Node 2using binary build by this PR, synced from 0 block, and the storage used now both nodes can sign blocks normally (48 hours of attention). It seems that if we start syncing from block 0, we will save a lot of space. Next, the database synchronized from block 0 can be made into a snapshot to provide validator download |
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.
final round of review comments,
90ce3fa
to
5db4dc9
Compare
d55b97e
to
f5a7fe4
Compare
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 wonder how long it takes for the first iteration of pruning?
If the first iteration is interrupted with Ctrl+C, how will it effect the second iteration?
For example, current block number = 10000. For the first pruning, I shut down the node when it finished pruning for 0~1000. The next time I start the node, is it true that the pruning will panic when pruning block 0?
return true | ||
} | ||
|
||
blockInfo := rawdb.ReadBlock(bp.db, hash, blockNum) |
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.
Looks like if a certain block is pruned in last iteration, block Info can be nil. Could this possibly happen? If we reach a block that is pruned previously, does the prune iteration continue or break?
It takes about a week for the first iteration (After our test, we do not recommend to delete it slowly from the existing node. There is a lot of unknown data in the current db. We recommend starting a new snapshot.). The iteration does not start from the first block every time, but starts from the last deleted block. |
Issue
harmony-one/bounties#84
Operational Checklist
Does this PR introduce backward-incompatible changes to the on-disk data structure and/or the over-the-wire protocol?. (If no, skip to question 8.)
NO
Does this PR introduce backward-incompatible changes NOT related to on-disk data structure and/or over-the-wire protocol? (If no, continue to question 11.)
NO
Does this PR introduce significant changes to the operational requirements of the node software, such as >20% increase in CPU, memory, and/or disk usage?
NO