From 9bd0ce4082f2c2dff8335c740e26f8403df6d690 Mon Sep 17 00:00:00 2001 From: steviez Date: Tue, 17 Jan 2023 21:53:51 -0600 Subject: [PATCH] ledger-tool: Clean account paths in all cases (#29609) The existing logic would clean account paths only when we had secondary access to the blockstore. However, the access mode shouldn't dictate when we clean accounts data; we can and should clean account data from previous runs in all instances given that we always start over from a snapshot. --- ledger-tool/src/main.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ledger-tool/src/main.rs b/ledger-tool/src/main.rs index 00772923e2..0bf6a89238 100644 --- a/ledger-tool/src/main.rs +++ b/ledger-tool/src/main.rs @@ -1089,17 +1089,17 @@ fn load_bank_forks( "Default accounts path is switched aligning with Blockstore's secondary access: {:?}", non_primary_accounts_path ); - - if non_primary_accounts_path.exists() { - info!("Clearing {:?}", non_primary_accounts_path); - 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] }; + info!("Cleaning contents of account paths: {:?}", account_paths); + let mut measure = Measure::start("clean_accounts_paths"); + account_paths.iter().for_each(|path| { + if path.exists() { + move_and_async_delete_path(path); + } + }); + measure.stop(); + info!("done. {}", measure); let mut accounts_update_notifier = Option::::default(); if arg_matches.is_present("geyser_plugin_config") {