Replace boot_from_local_state with use_snapshot_archives_at_startup (#32260)
This commit is contained in:
parent
394fc9b8fc
commit
5f1b5b877a
|
@ -54,6 +54,7 @@ use {
|
||||||
entry_notifier_service::{EntryNotifierSender, EntryNotifierService},
|
entry_notifier_service::{EntryNotifierSender, EntryNotifierService},
|
||||||
leader_schedule::FixedSchedule,
|
leader_schedule::FixedSchedule,
|
||||||
leader_schedule_cache::LeaderScheduleCache,
|
leader_schedule_cache::LeaderScheduleCache,
|
||||||
|
use_snapshot_archives_at_startup::UseSnapshotArchivesAtStartup,
|
||||||
},
|
},
|
||||||
solana_measure::measure::Measure,
|
solana_measure::measure::Measure,
|
||||||
solana_metrics::{datapoint_info, poh_timing_point::PohTimingSender},
|
solana_metrics::{datapoint_info, poh_timing_point::PohTimingSender},
|
||||||
|
@ -251,7 +252,7 @@ pub struct ValidatorConfig {
|
||||||
pub block_verification_method: BlockVerificationMethod,
|
pub block_verification_method: BlockVerificationMethod,
|
||||||
pub block_production_method: BlockProductionMethod,
|
pub block_production_method: BlockProductionMethod,
|
||||||
pub generator_config: Option<GeneratorConfig>,
|
pub generator_config: Option<GeneratorConfig>,
|
||||||
pub boot_from_local_state: bool,
|
pub use_snapshot_archives_at_startup: UseSnapshotArchivesAtStartup,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ValidatorConfig {
|
impl Default for ValidatorConfig {
|
||||||
|
@ -318,7 +319,7 @@ impl Default for ValidatorConfig {
|
||||||
block_verification_method: BlockVerificationMethod::default(),
|
block_verification_method: BlockVerificationMethod::default(),
|
||||||
block_production_method: BlockProductionMethod::default(),
|
block_production_method: BlockProductionMethod::default(),
|
||||||
generator_config: None,
|
generator_config: None,
|
||||||
boot_from_local_state: false,
|
use_snapshot_archives_at_startup: UseSnapshotArchivesAtStartup::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1622,7 +1623,7 @@ fn load_blockstore(
|
||||||
accounts_db_test_hash_calculation: config.accounts_db_test_hash_calculation,
|
accounts_db_test_hash_calculation: config.accounts_db_test_hash_calculation,
|
||||||
accounts_db_skip_shrink: config.accounts_db_skip_shrink,
|
accounts_db_skip_shrink: config.accounts_db_skip_shrink,
|
||||||
runtime_config: config.runtime_config.clone(),
|
runtime_config: config.runtime_config.clone(),
|
||||||
boot_from_local_state: config.boot_from_local_state,
|
use_snapshot_archives_at_startup: config.use_snapshot_archives_at_startup,
|
||||||
..blockstore_processor::ProcessOptions::default()
|
..blockstore_processor::ProcessOptions::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -980,10 +980,9 @@ fn assert_capitalization(bank: &Bank) {
|
||||||
|
|
||||||
/// Get the AccessType required, based on `process_options`
|
/// Get the AccessType required, based on `process_options`
|
||||||
fn get_access_type(process_options: &ProcessOptions) -> AccessType {
|
fn get_access_type(process_options: &ProcessOptions) -> AccessType {
|
||||||
if process_options.boot_from_local_state {
|
match process_options.use_snapshot_archives_at_startup {
|
||||||
AccessType::PrimaryForMaintenance
|
UseSnapshotArchivesAtStartup::Always => AccessType::Secondary,
|
||||||
} else {
|
UseSnapshotArchivesAtStartup::Never => AccessType::PrimaryForMaintenance,
|
||||||
AccessType::Secondary
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2513,11 +2512,6 @@ fn main() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let boot_from_local_state = value_t_or_exit!(
|
|
||||||
arg_matches,
|
|
||||||
use_snapshot_archives_at_startup::cli::NAME,
|
|
||||||
UseSnapshotArchivesAtStartup
|
|
||||||
) == UseSnapshotArchivesAtStartup::Never;
|
|
||||||
let process_options = ProcessOptions {
|
let process_options = ProcessOptions {
|
||||||
new_hard_forks: hardforks_of(arg_matches, "hard_forks"),
|
new_hard_forks: hardforks_of(arg_matches, "hard_forks"),
|
||||||
run_verification: !(arg_matches.is_present("skip_poh_verify")
|
run_verification: !(arg_matches.is_present("skip_poh_verify")
|
||||||
|
@ -2540,7 +2534,11 @@ fn main() {
|
||||||
.is_present("accounts_db_test_hash_calculation"),
|
.is_present("accounts_db_test_hash_calculation"),
|
||||||
accounts_db_skip_shrink: arg_matches.is_present("accounts_db_skip_shrink"),
|
accounts_db_skip_shrink: arg_matches.is_present("accounts_db_skip_shrink"),
|
||||||
runtime_config: RuntimeConfig::default(),
|
runtime_config: RuntimeConfig::default(),
|
||||||
boot_from_local_state,
|
use_snapshot_archives_at_startup: value_t_or_exit!(
|
||||||
|
arg_matches,
|
||||||
|
use_snapshot_archives_at_startup::cli::NAME,
|
||||||
|
UseSnapshotArchivesAtStartup
|
||||||
|
),
|
||||||
..ProcessOptions::default()
|
..ProcessOptions::default()
|
||||||
};
|
};
|
||||||
let print_accounts_stats = arg_matches.is_present("print_accounts_stats");
|
let print_accounts_stats = arg_matches.is_present("print_accounts_stats");
|
||||||
|
@ -2583,17 +2581,16 @@ fn main() {
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
let boot_from_local_state = value_t_or_exit!(
|
|
||||||
arg_matches,
|
|
||||||
use_snapshot_archives_at_startup::cli::NAME,
|
|
||||||
UseSnapshotArchivesAtStartup
|
|
||||||
) == UseSnapshotArchivesAtStartup::Never;
|
|
||||||
let process_options = ProcessOptions {
|
let process_options = ProcessOptions {
|
||||||
new_hard_forks: hardforks_of(arg_matches, "hard_forks"),
|
new_hard_forks: hardforks_of(arg_matches, "hard_forks"),
|
||||||
halt_at_slot: value_t!(arg_matches, "halt_at_slot", Slot).ok(),
|
halt_at_slot: value_t!(arg_matches, "halt_at_slot", Slot).ok(),
|
||||||
run_verification: false,
|
run_verification: false,
|
||||||
accounts_db_config: Some(get_accounts_db_config(&ledger_path, arg_matches)),
|
accounts_db_config: Some(get_accounts_db_config(&ledger_path, arg_matches)),
|
||||||
boot_from_local_state,
|
use_snapshot_archives_at_startup: value_t_or_exit!(
|
||||||
|
arg_matches,
|
||||||
|
use_snapshot_archives_at_startup::cli::NAME,
|
||||||
|
UseSnapshotArchivesAtStartup
|
||||||
|
),
|
||||||
..ProcessOptions::default()
|
..ProcessOptions::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2715,17 +2712,16 @@ fn main() {
|
||||||
NonZeroUsize
|
NonZeroUsize
|
||||||
);
|
);
|
||||||
let genesis_config = open_genesis_config_by(&ledger_path, arg_matches);
|
let genesis_config = open_genesis_config_by(&ledger_path, arg_matches);
|
||||||
let boot_from_local_state = value_t_or_exit!(
|
|
||||||
arg_matches,
|
|
||||||
use_snapshot_archives_at_startup::cli::NAME,
|
|
||||||
UseSnapshotArchivesAtStartup
|
|
||||||
) == UseSnapshotArchivesAtStartup::Never;
|
|
||||||
let mut process_options = ProcessOptions {
|
let mut process_options = ProcessOptions {
|
||||||
new_hard_forks,
|
new_hard_forks,
|
||||||
run_verification: false,
|
run_verification: false,
|
||||||
accounts_db_config: Some(get_accounts_db_config(&ledger_path, arg_matches)),
|
accounts_db_config: Some(get_accounts_db_config(&ledger_path, arg_matches)),
|
||||||
accounts_db_skip_shrink: arg_matches.is_present("accounts_db_skip_shrink"),
|
accounts_db_skip_shrink: arg_matches.is_present("accounts_db_skip_shrink"),
|
||||||
boot_from_local_state,
|
use_snapshot_archives_at_startup: value_t_or_exit!(
|
||||||
|
arg_matches,
|
||||||
|
use_snapshot_archives_at_startup::cli::NAME,
|
||||||
|
UseSnapshotArchivesAtStartup
|
||||||
|
),
|
||||||
..ProcessOptions::default()
|
..ProcessOptions::default()
|
||||||
};
|
};
|
||||||
let blockstore = Arc::new(open_blockstore(
|
let blockstore = Arc::new(open_blockstore(
|
||||||
|
@ -3133,17 +3129,16 @@ fn main() {
|
||||||
}
|
}
|
||||||
("accounts", Some(arg_matches)) => {
|
("accounts", Some(arg_matches)) => {
|
||||||
let halt_at_slot = value_t!(arg_matches, "halt_at_slot", Slot).ok();
|
let halt_at_slot = value_t!(arg_matches, "halt_at_slot", Slot).ok();
|
||||||
let boot_from_local_state = value_t_or_exit!(
|
|
||||||
arg_matches,
|
|
||||||
use_snapshot_archives_at_startup::cli::NAME,
|
|
||||||
UseSnapshotArchivesAtStartup
|
|
||||||
) == UseSnapshotArchivesAtStartup::Never;
|
|
||||||
let process_options = ProcessOptions {
|
let process_options = ProcessOptions {
|
||||||
new_hard_forks: hardforks_of(arg_matches, "hard_forks"),
|
new_hard_forks: hardforks_of(arg_matches, "hard_forks"),
|
||||||
halt_at_slot,
|
halt_at_slot,
|
||||||
run_verification: false,
|
run_verification: false,
|
||||||
accounts_db_config: Some(get_accounts_db_config(&ledger_path, arg_matches)),
|
accounts_db_config: Some(get_accounts_db_config(&ledger_path, arg_matches)),
|
||||||
boot_from_local_state,
|
use_snapshot_archives_at_startup: value_t_or_exit!(
|
||||||
|
arg_matches,
|
||||||
|
use_snapshot_archives_at_startup::cli::NAME,
|
||||||
|
UseSnapshotArchivesAtStartup
|
||||||
|
),
|
||||||
..ProcessOptions::default()
|
..ProcessOptions::default()
|
||||||
};
|
};
|
||||||
let genesis_config = open_genesis_config_by(&ledger_path, arg_matches);
|
let genesis_config = open_genesis_config_by(&ledger_path, arg_matches);
|
||||||
|
@ -3229,17 +3224,16 @@ fn main() {
|
||||||
}
|
}
|
||||||
("capitalization", Some(arg_matches)) => {
|
("capitalization", Some(arg_matches)) => {
|
||||||
let halt_at_slot = value_t!(arg_matches, "halt_at_slot", Slot).ok();
|
let halt_at_slot = value_t!(arg_matches, "halt_at_slot", Slot).ok();
|
||||||
let boot_from_local_state = value_t_or_exit!(
|
|
||||||
arg_matches,
|
|
||||||
use_snapshot_archives_at_startup::cli::NAME,
|
|
||||||
UseSnapshotArchivesAtStartup
|
|
||||||
) == UseSnapshotArchivesAtStartup::Never;
|
|
||||||
let process_options = ProcessOptions {
|
let process_options = ProcessOptions {
|
||||||
new_hard_forks: hardforks_of(arg_matches, "hard_forks"),
|
new_hard_forks: hardforks_of(arg_matches, "hard_forks"),
|
||||||
halt_at_slot,
|
halt_at_slot,
|
||||||
run_verification: false,
|
run_verification: false,
|
||||||
accounts_db_config: Some(get_accounts_db_config(&ledger_path, arg_matches)),
|
accounts_db_config: Some(get_accounts_db_config(&ledger_path, arg_matches)),
|
||||||
boot_from_local_state,
|
use_snapshot_archives_at_startup: value_t_or_exit!(
|
||||||
|
arg_matches,
|
||||||
|
use_snapshot_archives_at_startup::cli::NAME,
|
||||||
|
UseSnapshotArchivesAtStartup
|
||||||
|
),
|
||||||
..ProcessOptions::default()
|
..ProcessOptions::default()
|
||||||
};
|
};
|
||||||
let genesis_config = open_genesis_config_by(&ledger_path, arg_matches);
|
let genesis_config = open_genesis_config_by(&ledger_path, arg_matches);
|
||||||
|
|
|
@ -7,6 +7,7 @@ use {
|
||||||
},
|
},
|
||||||
entry_notifier_service::EntryNotifierSender,
|
entry_notifier_service::EntryNotifierSender,
|
||||||
leader_schedule_cache::LeaderScheduleCache,
|
leader_schedule_cache::LeaderScheduleCache,
|
||||||
|
use_snapshot_archives_at_startup::UseSnapshotArchivesAtStartup,
|
||||||
},
|
},
|
||||||
log::*,
|
log::*,
|
||||||
solana_runtime::{
|
solana_runtime::{
|
||||||
|
@ -197,7 +198,50 @@ fn bank_forks_from_snapshot(
|
||||||
}
|
}
|
||||||
|
|
||||||
let (deserialized_bank, full_snapshot_archive_info, incremental_snapshot_archive_info) =
|
let (deserialized_bank, full_snapshot_archive_info, incremental_snapshot_archive_info) =
|
||||||
if process_options.boot_from_local_state {
|
match process_options.use_snapshot_archives_at_startup {
|
||||||
|
UseSnapshotArchivesAtStartup::Always => {
|
||||||
|
// Given that we are going to boot from an archive, the append vecs held in the snapshot dirs for fast-boot should
|
||||||
|
// be released. They will be released by the account_background_service anyway. But in the case of the account_paths
|
||||||
|
// using memory-mounted file system, they are not released early enough to give space for the new append-vecs from
|
||||||
|
// the archives, causing the out-of-memory problem. So, purge the snapshot dirs upfront before loading from the archive.
|
||||||
|
snapshot_utils::purge_old_bank_snapshots(
|
||||||
|
&snapshot_config.bank_snapshots_dir,
|
||||||
|
0,
|
||||||
|
None,
|
||||||
|
);
|
||||||
|
|
||||||
|
let (
|
||||||
|
deserialized_bank,
|
||||||
|
full_snapshot_archive_info,
|
||||||
|
incremental_snapshot_archive_info,
|
||||||
|
) = snapshot_utils::bank_from_latest_snapshot_archives(
|
||||||
|
&snapshot_config.bank_snapshots_dir,
|
||||||
|
&snapshot_config.full_snapshot_archives_dir,
|
||||||
|
&snapshot_config.incremental_snapshot_archives_dir,
|
||||||
|
&account_paths,
|
||||||
|
genesis_config,
|
||||||
|
&process_options.runtime_config,
|
||||||
|
process_options.debug_keys.clone(),
|
||||||
|
None,
|
||||||
|
process_options.account_indexes.clone(),
|
||||||
|
process_options.limit_load_slot_count_from_snapshot,
|
||||||
|
process_options.shrink_ratio,
|
||||||
|
process_options.accounts_db_test_hash_calculation,
|
||||||
|
process_options.accounts_db_skip_shrink,
|
||||||
|
process_options.verify_index,
|
||||||
|
process_options.accounts_db_config.clone(),
|
||||||
|
accounts_update_notifier,
|
||||||
|
exit,
|
||||||
|
)
|
||||||
|
.expect("load bank from snapshot archives");
|
||||||
|
|
||||||
|
(
|
||||||
|
deserialized_bank,
|
||||||
|
full_snapshot_archive_info,
|
||||||
|
incremental_snapshot_archive_info,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
UseSnapshotArchivesAtStartup::Never => {
|
||||||
let bank = snapshot_utils::bank_from_latest_snapshot_dir(
|
let bank = snapshot_utils::bank_from_latest_snapshot_dir(
|
||||||
&snapshot_config.bank_snapshots_dir,
|
&snapshot_config.bank_snapshots_dir,
|
||||||
genesis_config,
|
genesis_config,
|
||||||
|
@ -256,40 +300,7 @@ fn bank_forks_from_snapshot(
|
||||||
full_snapshot_archive_info,
|
full_snapshot_archive_info,
|
||||||
incremental_snapshot_archive_info,
|
incremental_snapshot_archive_info,
|
||||||
)
|
)
|
||||||
} else {
|
}
|
||||||
// Given that we are going to boot from an archive, the accountvecs held in the snapshot dirs for fast-boot should
|
|
||||||
// be released. They will be released by the account_background_service anyway. But in the case of the account_paths
|
|
||||||
// using memory-mounted file system, they are not released early enough to give space for the new append-vecs from
|
|
||||||
// the archives, causing the out-of-memory problem. So, purge the snapshot dirs upfront before loading from the archive.
|
|
||||||
snapshot_utils::purge_old_bank_snapshots(&snapshot_config.bank_snapshots_dir, 0, None);
|
|
||||||
|
|
||||||
let (deserialized_bank, full_snapshot_archive_info, incremental_snapshot_archive_info) =
|
|
||||||
snapshot_utils::bank_from_latest_snapshot_archives(
|
|
||||||
&snapshot_config.bank_snapshots_dir,
|
|
||||||
&snapshot_config.full_snapshot_archives_dir,
|
|
||||||
&snapshot_config.incremental_snapshot_archives_dir,
|
|
||||||
&account_paths,
|
|
||||||
genesis_config,
|
|
||||||
&process_options.runtime_config,
|
|
||||||
process_options.debug_keys.clone(),
|
|
||||||
None,
|
|
||||||
process_options.account_indexes.clone(),
|
|
||||||
process_options.limit_load_slot_count_from_snapshot,
|
|
||||||
process_options.shrink_ratio,
|
|
||||||
process_options.accounts_db_test_hash_calculation,
|
|
||||||
process_options.accounts_db_skip_shrink,
|
|
||||||
process_options.verify_index,
|
|
||||||
process_options.accounts_db_config.clone(),
|
|
||||||
accounts_update_notifier,
|
|
||||||
exit,
|
|
||||||
)
|
|
||||||
.expect("load bank from snapshot archives");
|
|
||||||
|
|
||||||
(
|
|
||||||
deserialized_bank,
|
|
||||||
full_snapshot_archive_info,
|
|
||||||
incremental_snapshot_archive_info,
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(shrink_paths) = shrink_paths {
|
if let Some(shrink_paths) = shrink_paths {
|
||||||
|
|
|
@ -7,6 +7,7 @@ use {
|
||||||
entry_notifier_service::{EntryNotification, EntryNotifierSender},
|
entry_notifier_service::{EntryNotification, EntryNotifierSender},
|
||||||
leader_schedule_cache::LeaderScheduleCache,
|
leader_schedule_cache::LeaderScheduleCache,
|
||||||
token_balances::collect_token_balances,
|
token_balances::collect_token_balances,
|
||||||
|
use_snapshot_archives_at_startup::UseSnapshotArchivesAtStartup,
|
||||||
},
|
},
|
||||||
chrono_humanize::{Accuracy, HumanTime, Tense},
|
chrono_humanize::{Accuracy, HumanTime, Tense},
|
||||||
crossbeam_channel::Sender,
|
crossbeam_channel::Sender,
|
||||||
|
@ -632,8 +633,7 @@ pub struct ProcessOptions {
|
||||||
/// true if after processing the contents of the blockstore at startup, we should run an accounts hash calc
|
/// true if after processing the contents of the blockstore at startup, we should run an accounts hash calc
|
||||||
/// This is useful for debugging.
|
/// This is useful for debugging.
|
||||||
pub run_final_accounts_hash_calc: bool,
|
pub run_final_accounts_hash_calc: bool,
|
||||||
/// Enable booting from state already on disk, instead of extracting if from a snapshot archive.
|
pub use_snapshot_archives_at_startup: UseSnapshotArchivesAtStartup,
|
||||||
pub boot_from_local_state: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn test_process_blockstore(
|
pub fn test_process_blockstore(
|
||||||
|
|
|
@ -67,7 +67,7 @@ pub fn safe_clone_config(config: &ValidatorConfig) -> ValidatorConfig {
|
||||||
block_verification_method: config.block_verification_method.clone(),
|
block_verification_method: config.block_verification_method.clone(),
|
||||||
block_production_method: config.block_production_method.clone(),
|
block_production_method: config.block_production_method.clone(),
|
||||||
generator_config: config.generator_config.clone(),
|
generator_config: config.generator_config.clone(),
|
||||||
boot_from_local_state: config.boot_from_local_state,
|
use_snapshot_archives_at_startup: config.use_snapshot_archives_at_startup,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ use {
|
||||||
solana_ledger::{
|
solana_ledger::{
|
||||||
ancestor_iterator::AncestorIterator, bank_forks_utils, blockstore::Blockstore,
|
ancestor_iterator::AncestorIterator, bank_forks_utils, blockstore::Blockstore,
|
||||||
blockstore_processor::ProcessOptions, leader_schedule::FixedSchedule,
|
blockstore_processor::ProcessOptions, leader_schedule::FixedSchedule,
|
||||||
|
use_snapshot_archives_at_startup::UseSnapshotArchivesAtStartup,
|
||||||
},
|
},
|
||||||
solana_local_cluster::{
|
solana_local_cluster::{
|
||||||
cluster::{Cluster, ClusterValidatorInfo},
|
cluster::{Cluster, ClusterValidatorInfo},
|
||||||
|
@ -4876,7 +4877,7 @@ fn test_boot_from_local_state() {
|
||||||
// restart WITH fastboot
|
// restart WITH fastboot
|
||||||
info!("Restarting validator2 from local state...");
|
info!("Restarting validator2 from local state...");
|
||||||
let mut validator2_info = cluster.exit_node(&validator2_identity.pubkey());
|
let mut validator2_info = cluster.exit_node(&validator2_identity.pubkey());
|
||||||
validator2_info.config.boot_from_local_state = true;
|
validator2_info.config.use_snapshot_archives_at_startup = UseSnapshotArchivesAtStartup::Never;
|
||||||
cluster.restart_node(
|
cluster.restart_node(
|
||||||
&validator2_identity.pubkey(),
|
&validator2_identity.pubkey(),
|
||||||
validator2_info,
|
validator2_info,
|
||||||
|
|
|
@ -1378,11 +1378,11 @@ pub fn main() {
|
||||||
},
|
},
|
||||||
staked_nodes_overrides: staked_nodes_overrides.clone(),
|
staked_nodes_overrides: staked_nodes_overrides.clone(),
|
||||||
replay_slots_concurrently: matches.is_present("replay_slots_concurrently"),
|
replay_slots_concurrently: matches.is_present("replay_slots_concurrently"),
|
||||||
boot_from_local_state: value_t_or_exit!(
|
use_snapshot_archives_at_startup: value_t_or_exit!(
|
||||||
matches,
|
matches,
|
||||||
use_snapshot_archives_at_startup::cli::NAME,
|
use_snapshot_archives_at_startup::cli::NAME,
|
||||||
UseSnapshotArchivesAtStartup
|
UseSnapshotArchivesAtStartup
|
||||||
) == UseSnapshotArchivesAtStartup::Never,
|
),
|
||||||
..ValidatorConfig::default()
|
..ValidatorConfig::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue