Skip to content

core/rawdb: only complain loudly if truncating many items #21483

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

Merged
merged 1 commit into from
Aug 25, 2020

Conversation

karalabe
Copy link
Member

When we originally implemented the freezer, it was disallowed to roll back items from it. In theory Geth will never do it itself during normal mode of operation, but in practice the user can call SetHead and Geth can roll back during fast sync. With the unified rollback handling, all these paths use the same code that printed the warning. This resulted in 2000 truncation warnings printed every time fast sync failed (2K headers rolled back).

This PR changes the behavior so that if only a single item is removed (SetHead will remove one-by-one since it needs to do additional maintenance after each), the log level is Debug, not Warn. If the freezer gets corrupted and a lot of data is removed we will still see the large truncation warnings.

@karalabe karalabe added this to the 1.9.20 milestone Aug 25, 2020
@karalabe karalabe requested a review from holiman August 25, 2020 05:49
@karalabe karalabe requested a review from rjl493456442 as a code owner August 25, 2020 05:49
@karalabe karalabe force-pushed the freezer-truncate-silent branch from 291b65b to 5655dce Compare August 25, 2020 06:03
Copy link
Member

@rjl493456442 rjl493456442 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.

2 participants