diff --git a/core/src/validator.rs b/core/src/validator.rs index 399d4d135..21c52c7c3 100644 --- a/core/src/validator.rs +++ b/core/src/validator.rs @@ -2049,7 +2049,7 @@ fn get_stake_percent_in_gossip(bank: &Bank, cluster_info: &ClusterInfo, log: boo /// If the process is killed and the deleting process is not done, /// the leftover path will be deleted in the next process life, so /// there is no file space leaking. -fn move_and_async_delete_path(path: impl AsRef + Copy) { +pub fn move_and_async_delete_path(path: impl AsRef + Copy) { let mut path_delete = PathBuf::new(); path_delete.push(path); path_delete.set_file_name(format!( diff --git a/ledger-tool/src/main.rs b/ledger-tool/src/main.rs index 5331b100b..eb2533367 100644 --- a/ledger-tool/src/main.rs +++ b/ledger-tool/src/main.rs @@ -19,7 +19,9 @@ use { is_parsable, is_pow2, is_pubkey, is_pubkey_or_keypair, is_slot, is_valid_percentage, }, }, - solana_core::system_monitor_service::SystemMonitorService, + solana_core::{ + system_monitor_service::SystemMonitorService, validator::move_and_async_delete_path, + }, solana_entry::entry::Entry, solana_geyser_plugin_manager::geyser_plugin_service::GeyserPluginService, solana_ledger::{ @@ -1053,13 +1055,10 @@ fn load_bank_forks( if non_primary_accounts_path.exists() { info!("Clearing {:?}", non_primary_accounts_path); - if let Err(err) = std::fs::remove_dir_all(&non_primary_accounts_path) { - eprintln!( - "error deleting accounts path {:?}: {}", - non_primary_accounts_path, err - ); - exit(1); - } + let mut measure_time = Measure::start("clean_non_primary_accounts_paths"); + move_and_async_delete_path(&non_primary_accounts_path); + measure_time.stop(); + info!("done. {}", measure_time); } vec![non_primary_accounts_path]