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: pruneancient freeze from the previous position when the first time #2542

Merged
merged 10 commits into from
Jul 16, 2024

Conversation

jingjunLi
Copy link
Contributor

@jingjunLi jingjunLi commented Jun 26, 2024

Description

The first time online pruning is enabled, the freeze() process starts from 0, leading to a large number of log.Error("Canonical hash missing, can't freeze", "number", f.frozen) logs.

image

In the freezer's database, record FrozenOfAncientFreezer. When online pruning is enabled for the first time, it will continue to freeze from the previous position.

Rationale

tell us why we need these changes...

Example

add an example CLI or API response...

Changes

Notable changes:

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

joeylichang
joeylichang previously approved these changes Jun 26, 2024
@jingjunLi jingjunLi added the wip work in process label Jun 28, 2024
@jingjunLi jingjunLi closed this Jul 4, 2024
@jingjunLi jingjunLi reopened this Jul 4, 2024
@jingjunLi jingjunLi force-pushed the fix-pruneancient-CanonicalHash branch from 2449752 to 1212526 Compare July 4, 2024 14:33
zzzckck
zzzckck previously approved these changes Jul 5, 2024
@jingjunLi jingjunLi removed the wip work in process label Jul 8, 2024
@jingjunLi jingjunLi force-pushed the fix-pruneancient-CanonicalHash branch from 1212526 to 2fa163d Compare July 8, 2024 03:10
log.Info("Read ancientdb item counts", "items", min)
offset += min
items := head - tail
log.Info("Read ancientdb item counts", "items", items)
Copy link
Contributor

Choose a reason for hiding this comment

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

add 'head' and 'tail' info ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

joeylichang
joeylichang previously approved these changes Jul 8, 2024
@zzzckck
Copy link
Collaborator

zzzckck commented Jul 12, 2024

May double check this code, see if it is reasonable:

offset += min
if frozen := ReadFrozenOfAncientFreezer(f.db); frozen > offset {
offset = frozen
}
atomic.StoreUint64(&f.frozen, offset)

@jingjunLi jingjunLi force-pushed the fix-pruneancient-CanonicalHash branch from f3da606 to 6436146 Compare July 16, 2024 10:44
@zzzckck zzzckck merged commit 13d4547 into bnb-chain:develop Jul 16, 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.

3 participants