Skip to content
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 ancient feature #862

Merged
merged 6 commits into from
Jun 29, 2022
Merged

add prune ancient feature #862

merged 6 commits into from
Jun 29, 2022

Conversation

joeylichang
Copy link
Contributor

Description

Block Data no longer transfer to AncientDB when delete from KVStore.
Save more os resources, disk space, disk bandwidth, cpu.

Rationale

Release more disk space, disk bandwidth resources.

Example

"./geth" start command add "--puneancient" parameter

Changes

Notable changes:

  • add punedfreezer struct inherit AncientStore interface, implement not save to AncientDB when delete from KVStore
  • add 'PruneAncientFlag'(record abcinet type) and 'StableStateBlockNumber'(record lastest rootHash savetodisk)
  • add check logic for block data is nil, because maybe delete when transfer to AncientDB

@richardrich975 richardrich975 self-requested a review June 9, 2022 10:19
core/blockchain.go Outdated Show resolved Hide resolved
cmd/utils/flags.go Outdated Show resolved Hide resolved
core/rawdb/prunedfreezer.go Show resolved Hide resolved
core/rawdb/prunedfreezer.go Outdated Show resolved Hide resolved
cmd/utils/flags.go Outdated Show resolved Hide resolved
core/blockchain.go Outdated Show resolved Hide resolved
core/blockchain.go Outdated Show resolved Hide resolved
cmd/utils/flags.go Outdated Show resolved Hide resolved
@unclezoro
Copy link
Collaborator

Besides, can you evaluate how this feature impacts the tx index system?

@joeylichang
Copy link
Contributor Author

Besides, can you evaluate how this feature impacts the tx index system?

It has no effect. It has been fixed for the online problem (that is, the tx index error reported from ancient data after executing the pruneblock tool). The fix is to check whether the block range that needs to be indexed is in ancient before creating the index. If it is not, it will Adjust the boundaries of the block range.

code:
https://github.com/bnb-chain/bsc/pull/862/files/174e3cf6b35fe18c56f99e850321b0d7e5aaa11d#diff-5d45a05258d00e090bc241a1b22c8eb8f4183ac91bd480c46835bc72c8a15c6a

calmbeing
calmbeing previously approved these changes Jun 20, 2022
Mercybudda
Mercybudda previously approved these changes Jun 20, 2022
@joeylichang joeylichang dismissed stale reviews from Mercybudda and calmbeing via 2d7fbb1 June 21, 2022 02:32
KeefeL
KeefeL previously approved these changes Jun 21, 2022
core/rawdb/accessors_metadata.go Outdated Show resolved Hide resolved
j75689
j75689 previously approved these changes Jun 24, 2022
Mercybudda
Mercybudda previously approved these changes Jun 24, 2022
@joeylichang joeylichang dismissed stale reviews from Mercybudda and j75689 via ab834c4 June 29, 2022 05:15
Copy link

@richardrich975 richardrich975 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@unclezoro unclezoro merged commit d6b9bdb into develop Jun 29, 2022
@joeylichang joeylichang deleted the prune_ancient branch July 21, 2022 02:45
This was referenced Jul 28, 2022
batch.Reset()

// Step into the future and delete and dangling side chains
if frozen > 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this code is quite risky, it could even delete the whole chain, is the "dangling" was created with a bug, such as issue: #2529
Maybe we don't need it, as we have already deleted the "dangling" block from first to frozen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants