From cb6e01d17b5edbf1254b200e4e12e10eb4df16f4 Mon Sep 17 00:00:00 2001 From: apfitzge Date: Wed, 17 Aug 2022 12:57:52 -0500 Subject: [PATCH] snapshots: serialize version file first (#27192) serialize version file first (cherry picked from commit c1111fa069dfed5f8ba0801b2abae3ceded923dd) --- runtime/src/snapshot_utils.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runtime/src/snapshot_utils.rs b/runtime/src/snapshot_utils.rs index 602df50dd9abb1..4ce38c36a1e04a 100644 --- a/runtime/src/snapshot_utils.rs +++ b/runtime/src/snapshot_utils.rs @@ -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(()) };