-
Notifications
You must be signed in to change notification settings - Fork 236
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
persistence softfork cache #4203
Conversation
5765818
to
cb12d58
Compare
b93adac
to
9582cd4
Compare
9582cd4
to
f5095d8
Compare
f5095d8
to
f584807
Compare
3fa9bdb
to
ba5bc01
Compare
util/types/src/core/mod.rs
Outdated
pub use advanced_builders::{BlockBuilder, HeaderBuilder, TransactionBuilder}; | ||
pub use blockchain::DepType; | ||
pub use extras::{BlockExt, EpochExt, EpochNumberWithFraction, TransactionInfo}; | ||
pub use fee_rate::FeeRate; | ||
use once_cell::sync::OnceCell; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OnceCell
have been merged into rust's std
library: https://doc.rust-lang.org/std/cell/struct.OnceCell.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The once_cell in std is still a bit different from the crate we're using now, and the equivalent would be https://doc.rust-lang.org/std/sync/struct.OnceLock.html, which we can decide to replace later.
What problem does this PR solve?
In RFC0043 we introduced the signal mechanism to implement softfork-activation, for each softfork deployment its state needs to be accumulated statistics, the current implementation is to use a memory cache to store the state, resulting in each reboot, the state of the deployment needs to be regenerated. when in the case of large amounts of data, the reboot will be lagged for some time.
What is changed and how it works?
Introduces a persistent mmap cache so that the state doesn't need to be recalculated each time it is restarted
The persistence path is stored in DATA_DIR/softfork/<deployment>/<cache file> format.
after
Related changes
owner/repo
:Check List
Tests
Side effects
Release note