solana_runtime::snapshot_utils

Function clean_orphaned_account_snapshot_dirs

Source
pub fn clean_orphaned_account_snapshot_dirs(
    bank_snapshots_dir: impl AsRef<Path>,
    account_snapshot_paths: &[PathBuf],
) -> Result<()>
Expand description

The account snapshot directories under <account_path>/snapshot/ contain account files hardlinked from <account_path>/run taken at snapshot time. They are referenced by the symlinks from the bank snapshot dir snapshot//accounts_hardlinks/. We observed that sometimes the bank snapshot dir could be deleted but the account snapshot directories were left behind, possibly by some manual operations or some legacy code not using the symlinks to clean up the account snapshot hardlink directories. This function cleans up any account snapshot directories that are no longer referenced by the bank snapshot dirs, to ensure proper snapshot operations.