Serialize a bank to a snapshot
Make a snapshot archive out of the snapshot package
Utility for parsing out bank specific information from a snapshot archive. This utility can be used
to parse out bank specific information like the leader schedule, epoch schedule, etc.
Rebuild bank from snapshot archives. This function searches full_snapshot_archives_dir
and incremental_snapshot_archives_dir
for the
highest full snapshot and highest corresponding incremental snapshot, then rebuilds the bank.
follow the prototype of fn bank_from_latest_snapshot_archives, implement the from_dir case
Rebuild bank from snapshot archives. Handles either just a full snapshot, or both a full
snapshot and an incremental snapshot.
Build bank from a snapshot (a snapshot directory, not a snapshot archive)
Convenience function to create a full snapshot archive out of any Bank, regardless of state.
The Bank will be frozen during the process.
This is only called from ledger-tool or tests. Warping is a special case as well.
Convenience function to create an incremental snapshot archive out of any Bank, regardless of
state. The Bank will be frozen during the process.
This is only called from ledger-tool or tests. Warping is a special case as well.
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.
To allow generating a bank snapshot directory with full state information, we need to
hardlink account appendvec files from the runtime operation directory to a snapshot
hardlink directory. This is to create the run/ and snapshot sub directories for an
account_path provided by the user. These two sub directories are on the same file
system partition to allow hard-linking.
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
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
Get the snapshot storages for this bank
Delete directories/files asynchronously to avoid blocking on it.
First, in sync context, rename the original path to *_deleted,
then spawn a thread to delete the renamed path.
If the process is killed and the deleting process is not done,
the leftover path will be deleted in the next process life, so
there is no file space leaking.
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.
Helper function to hold shared code to package, process, and archive full snapshots
Helper function to hold shared code to package, process, and archive incremental snapshots
Get the &str
from a &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