Skip to content

Commit

Permalink
snapshots: serialize version file first (#27192)
Browse files Browse the repository at this point in the history
serialize version file first

(cherry picked from commit c1111fa)
  • Loading branch information
apfitzge authored and mergify[bot] committed Aug 17, 2022
1 parent fd38f5d commit cb6e01d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion runtime/src/snapshot_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,12 @@ pub fn archive_snapshot_package(

let do_archive_files = |encoder: &mut dyn Write| -> Result<()> {
let mut archive = tar::Builder::new(encoder);
// Serialize the version and snapshots files before accounts so we can quickly determine the version
// and other bank fields. This is necessary if we want to interleave unpacking with reconstruction
archive.append_path_with_name(staging_dir.as_ref().join("version"), "version")?;
for dir in ["snapshots", "accounts"] {
archive.append_dir_all(dir, staging_dir.as_ref().join(dir))?;
}
archive.append_path_with_name(staging_dir.as_ref().join("version"), "version")?;
archive.into_inner()?;
Ok(())
};
Expand Down

0 comments on commit cb6e01d

Please sign in to comment.