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

fix: online prune of ancient delete unexpected blocks #2562

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

jingjunLi
Copy link
Contributor

@jingjunLi jingjunLi commented Jul 4, 2024

Description

The first time you run with the --pruneancient option, a BAD BLOCK error may occur.

image

Rationale

When pruneancient is enabled, it deletes the CanonicalHash previously stored in the ancient database. This results in the loss of some CanonicalHash entries in the range [first, frozen) during the subsequent loop.
image

In gcKvStore, when attempting to delete CanonicalHash and Header, the ancients and numbers do not match, preventing the proper deletion.

For example, if first in the loop is 60002, the range being traversed is [60002, 90003). Due to the deletion of CanonicalHash in the range [60002, 61298], the data in ancients is actually [61299, 90003).
In gcKvStore, the number range [60002, 88706) is being deleted, while the corresponding hash range is [61299, 90003), causing the construction of incorrect block keys and failing to delete the actual blocks.
number[60002] + hash[61299]
number[60003] + hash[61300]

Example

add an example CLI or API response...

Changes

Notable changes:

  • add each change in a bullet point here
  • ...

core/rawdb/prunedfreezer.go Outdated Show resolved Hide resolved
Copy link

@RenRick RenRick left a comment

Choose a reason for hiding this comment

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

LGTM

@zzzckck zzzckck merged commit bc970e5 into bnb-chain:develop Jul 8, 2024
7 checks passed
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

4 participants