Make a snapshot archive out of the snapshot package
Build the full snapshot archive path from its components: the snapshot archives directory, the
snapshot slot, the accounts hash, and the archive format.
Build the incremental snapshot archive path from its components: the snapshot archives
directory, the snapshot base slot, the snapshot slot, the accounts hash, and the archive
format.
Perform the common tasks when deserialize a snapshot. Handles reading snapshot file, reading the version file,
and then returning those fields plus the rebuilt storage
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 acccount 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.
For all account_paths, create the run/ and snapshot/ sub directories.
If an account_path directory does not exist, create it.
It returns (account_run_paths, account_snapshot_paths) or error
Creates directories if they do not exist, and canonicalizes the paths.
Constructs the path to the bank snapshot directory for slot
within bank_snapshots_dir
Get the bank snapshots in a directory
Get the bank snapshots in a directory
Get the bank snapshots in a directory
Get a list of the full snapshot archives from a directory
Get the bank snapshot with the highest slot in a directory
Get the bank snapshot with the highest slot in a directory
Get the bank snapshot with the highest slot in a directory
Get the path (and metadata) for the full snapshot archive with the highest slot in a directory
Get the highest slot of the full snapshot archives in a directory
Get the path for the incremental snapshot archive with the highest slot, for a given full
snapshot slot, in a directory
Get the highest slot of the incremental snapshot archives in a directory, for a given full
snapshot slot
Get a list of the incremental snapshot archives from a directory
Returns the file name of the bank snapshot for slot
Hard-link the files from accounts/ to snapshot/<bank_slot>/accounts/
This keeps the appendvec files alive and with the bank snapshot. The slot and id
in the file names are also updated in case its file is a recycled one with inconsistent slot
and id.
Delete directories/files asynchronously to avoid blocking on it.
First, in sync context, check if the original path exists, if it
does, rename the original path to *_to_be_deleted.
If there’s an in-progress deleting thread for this path, return.
Then spawn a thread to delete the renamed path.
Moves and asynchronously deletes the contents of a directory to avoid blocking on it.
The directory is re-created after the move, and should now be empty.
Get the &str
from a &Path
Remove the bank snapshot at this path
Purges bank snapshots that are older than slot
Purges incomplete bank snapshots
Purges bank snapshots, retaining the newest num_bank_snapshots_to_retain
At startup, purge old (i.e. unusable) bank snapshots
If the validator halts in the middle of archive_snapshot_package()
, the temporary staging
directory won’t be cleaned up. Call this function to clean them up.
Write the snapshot version as a file into the bank snapshot directory