Skip to content

fix: pruneancient freeze from the previous position when the first time#2542

Merged
zzzckck merged 10 commits intobnb-chain:developfrom
jingjunLi:fix-pruneancient-CanonicalHash
Jul 16, 2024
Merged

fix: pruneancient freeze from the previous position when the first time#2542
zzzckck merged 10 commits intobnb-chain:developfrom
jingjunLi:fix-pruneancient-CanonicalHash

Conversation

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

joey0612
joey0612 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
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added

joey0612
joey0612 previously approved these changes Jul 8, 2024
@zzzckck
Copy link
Copy Markdown
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
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