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

ship log pruning: optionally reduce disk usage of ship log files during operation by periodically trimming logs #327

Merged
merged 20 commits into from
Jun 15, 2022

Conversation

spoonincode
Copy link
Member

@spoonincode spoonincode commented May 31, 2022

Add a new option, state-history-log-retain-blocks, which when set will periodically reduce the disk usage of the state history log files to only that of the given number of most recent blocks. This allows operators to limit the disk usage of state history without stopping and restarting nodeos.

Pruning is performed by "poking holes" in the log files; in other words making them sparse files. This may have implications if trimmed log files are tarballed/copied/etc with an application that does not recognize sparse files: the files may take up more disk space than expected on their destination if an application is not spare file aware. Logs can be "vacuumed" (converted back in to an unpruned log that doesn't contain holes) by emitting the state-history-log-retain-blocks option.

The pruning is only periodically performed so in practice a small number of additional blocks (no more than a few megabytes worth of data) will be available beyond the configured number.

@arhag arhag self-requested a review May 31, 2022 17:10
@spoonincode spoonincode changed the title optional automatic trimming of state history log files ship log pruning: optionally reduce disk usage of ship log files during operation by periodically trimming logs Jun 7, 2022
@spoonincode spoonincode marked this pull request as ready for review June 7, 2022 03:35
* note on truncate() that it leaves the end of the log without a trailer even if in prune mode
* vacuum() no longer stomps on the version field
* prune() & vacuum() are deliberate in checking their preconditions
* restore validation that the caller of write_entry() filled out the header's size correctly
* consider suffix in deciding when to prune to ensure very pessimistic log entries will get pruned
* tweak vacuum hole punching range to ensure nothing is missed
@spoonincode spoonincode merged commit 3f8e7dd into main Jun 15, 2022
@spoonincode spoonincode deleted the log_trimming branch June 15, 2022 01:06
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