Errors that can happen in add_bank_snapshot()
The different archive formats used for snapshots
Errors that can happen in archive_snapshot_package()
Bank snapshots traditionally had their accounts hash calculated prior to serialization. Since
the hash calculation takes a long time, an optimization has been put in to offload the accounts
hash calculation. The bank serialization format has not changed, so we need another way to
identify if a bank snapshot contains the calculated accounts hash or not.
Errors that can happen in get_snapshot_accounts_hardlink_dir()
Errors that can happen in hard_link_storages_to_snapshot()
When constructing a bank a snapshot, traditionally the snapshot was from a snapshot archive. Now,
the snapshot can be from a snapshot directory, or from a snapshot archive. This is the flag to
indicate which.
allow tests to specify what happened to the serialized format
Errors that can happen in verify_slot_deltas()
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.
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.
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
Performs the common tasks when deserializing a snapshot
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.
Unarchives the given full and incremental snapshot archives, as long as they are compatible.