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

Add flat_storage_creation_enabled config flag #8923

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions chain/client/src/client_actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1430,6 +1430,9 @@ impl ClientActor {
}

fn start_flat_storage_creation(&mut self, ctx: &mut Context<ClientActor>) {
if !self.client.config.flat_storage_creation_enabled {
return;
}
match self.client.run_flat_storage_creation_step() {
Ok(false) => {}
Ok(true) => {
Expand Down
3 changes: 3 additions & 0 deletions core/chain-configs/src/client_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ pub struct ClientConfig {
pub enable_statistics_export: bool,
/// Number of threads to execute background migration work in client.
pub client_background_migration_threads: usize,
/// Enables background flat storage creation.
pub flat_storage_creation_enabled: bool,
/// Duration to perform background flat storage creation step.
pub flat_storage_creation_period: Duration,
/// If enabled, will dump state of every epoch to external storage.
Expand Down Expand Up @@ -251,6 +253,7 @@ impl ClientConfig {
max_gas_burnt_view: None,
enable_statistics_export: true,
client_background_migration_threads: 1,
flat_storage_creation_enabled: true,
flat_storage_creation_period: Duration::from_secs(1),
state_sync_dump_enabled: false,
state_sync_s3_bucket: String::new(),
Expand Down
5 changes: 5 additions & 0 deletions core/store/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ pub struct StoreConfig {
/// with block processing.
pub background_migration_threads: usize,

/// Enables background flat storage creation.
pub flat_storage_creation_enabled: bool,

/// Duration to perform background flat storage creation step. Defines how
/// frequently we check creation status and execute work related to it in
/// main thread (scheduling and collecting state parts, catching up blocks, etc.).
Expand Down Expand Up @@ -220,6 +223,8 @@ impl Default for StoreConfig {
// regular block processing significantly.
background_migration_threads: 8,

flat_storage_creation_enabled: true,

// It shouldn't be very low, because on single flat storage creation step
// we do several disk reads from `FlatStateMisc` and `FlatStateDeltas`.
// One second should be enough to save deltas on start and catch up
Expand Down
1 change: 1 addition & 0 deletions nearcore/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,7 @@ impl NearConfig {
max_gas_burnt_view: config.max_gas_burnt_view,
enable_statistics_export: config.store.enable_statistics_export,
client_background_migration_threads: config.store.background_migration_threads,
flat_storage_creation_enabled: config.store.flat_storage_creation_enabled,
flat_storage_creation_period: config.store.flat_storage_creation_period,
state_sync_dump_enabled: config
.state_sync
Expand Down