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

Purges old accounts hash cache dirs #33183

Merged
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
21 changes: 17 additions & 4 deletions core/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,10 +598,23 @@ impl Validator {
timer.stop();
info!("Cleaning orphaned account snapshot directories done. {timer}");

// The accounts hash cache dir was renamed, so cleanup the old dir if it exists.
let old_accounts_hash_cache_dir = ledger_path.join("calculate_accounts_hash_cache");
if old_accounts_hash_cache_dir.exists() {
snapshot_utils::move_and_async_delete_path(old_accounts_hash_cache_dir);
// The accounts hash cache dir was renamed, so cleanup any old dirs that exist.
let accounts_hash_cache_path = config
.accounts_db_config
.as_ref()
.and_then(|config| config.accounts_hash_cache_path.as_ref())
.map(PathBuf::as_path)
.unwrap_or(ledger_path);
let old_accounts_hash_cache_dirs = [
ledger_path.join("calculate_accounts_hash_cache"),
accounts_hash_cache_path.join("full"),
accounts_hash_cache_path.join("incremental"),
accounts_hash_cache_path.join("transient"),
];
for old_accounts_hash_cache_dir in old_accounts_hash_cache_dirs {
if old_accounts_hash_cache_dir.exists() {
snapshot_utils::move_and_async_delete_path(old_accounts_hash_cache_dir);
}
}

{
Expand Down