refactor rebuild_bank_from_snapshots (#17988)
This commit is contained in:
committed by
GitHub
parent
be51ad8264
commit
bb7413c9f9
@ -803,21 +803,10 @@ fn untar_snapshot_in<P: AsRef<Path>>(
|
|||||||
Ok(account_paths_map)
|
Ok(account_paths_map)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
fn verify_snapshot_version_and_folder(
|
||||||
fn rebuild_bank_from_snapshots(
|
|
||||||
snapshot_version: &str,
|
snapshot_version: &str,
|
||||||
frozen_account_pubkeys: &[Pubkey],
|
|
||||||
unpacked_snapshots_dir: &Path,
|
unpacked_snapshots_dir: &Path,
|
||||||
account_paths: &[PathBuf],
|
) -> Result<(SnapshotVersion, SlotSnapshotPaths)> {
|
||||||
unpacked_append_vec_map: UnpackedAppendVecMap,
|
|
||||||
genesis_config: &GenesisConfig,
|
|
||||||
debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
|
||||||
additional_builtins: Option<&Builtins>,
|
|
||||||
account_indexes: AccountSecondaryIndexes,
|
|
||||||
accounts_db_caching_enabled: bool,
|
|
||||||
limit_load_slot_count_from_snapshot: Option<usize>,
|
|
||||||
shrink_ratio: AccountShrinkThreshold,
|
|
||||||
) -> Result<Bank> {
|
|
||||||
info!("snapshot version: {}", snapshot_version);
|
info!("snapshot version: {}", snapshot_version);
|
||||||
|
|
||||||
let snapshot_version_enum =
|
let snapshot_version_enum =
|
||||||
@ -834,7 +823,26 @@ fn rebuild_bank_from_snapshots(
|
|||||||
let root_paths = snapshot_paths
|
let root_paths = snapshot_paths
|
||||||
.pop()
|
.pop()
|
||||||
.ok_or_else(|| get_io_error("No snapshots found in snapshots directory"))?;
|
.ok_or_else(|| get_io_error("No snapshots found in snapshots directory"))?;
|
||||||
|
Ok((snapshot_version_enum, root_paths))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
|
fn rebuild_bank_from_snapshots(
|
||||||
|
snapshot_version: &str,
|
||||||
|
frozen_account_pubkeys: &[Pubkey],
|
||||||
|
unpacked_snapshots_dir: &Path,
|
||||||
|
account_paths: &[PathBuf],
|
||||||
|
unpacked_append_vec_map: UnpackedAppendVecMap,
|
||||||
|
genesis_config: &GenesisConfig,
|
||||||
|
debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
||||||
|
additional_builtins: Option<&Builtins>,
|
||||||
|
account_indexes: AccountSecondaryIndexes,
|
||||||
|
accounts_db_caching_enabled: bool,
|
||||||
|
limit_load_slot_count_from_snapshot: Option<usize>,
|
||||||
|
shrink_ratio: AccountShrinkThreshold,
|
||||||
|
) -> Result<Bank> {
|
||||||
|
let (snapshot_version_enum, root_paths) =
|
||||||
|
verify_snapshot_version_and_folder(snapshot_version, unpacked_snapshots_dir)?;
|
||||||
info!(
|
info!(
|
||||||
"Loading bank from {}",
|
"Loading bank from {}",
|
||||||
&root_paths.snapshot_file_path.display()
|
&root_paths.snapshot_file_path.display()
|
||||||
|
Reference in New Issue
Block a user