Skip to content

fix: online prune of ancient delete unexpected blocks#2562

Merged
zzzckck merged 1 commit intobnb-chain:developfrom
jingjunLi:fix-badblock
Jul 8, 2024
Merged

fix: online prune of ancient delete unexpected blocks#2562
zzzckck merged 1 commit intobnb-chain:developfrom
jingjunLi:fix-badblock

Conversation

@jingjunLi
Copy link
Copy Markdown
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
  • ...

Copy link
Copy Markdown

@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

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.

4 participants