Don't bother restoring snapshots, they're never used

This commit is contained in:
Michael Vines 2021-01-02 09:09:50 -08:00
parent b6dcdb90e8
commit db6ee289c9
2 changed files with 9 additions and 28 deletions

View File

@ -34,10 +34,6 @@ pub mod transaction_utils;
pub mod vote_account;
pub mod vote_sender_types;
extern crate solana_config_program;
extern crate solana_stake_program;
extern crate solana_vote_program;
#[macro_use]
extern crate solana_metrics;
#[macro_use]
@ -45,6 +41,3 @@ extern crate serde_derive;
#[macro_use]
extern crate solana_frozen_abi_macro;
extern crate fs_extra;
extern crate tempfile;

View File

@ -11,7 +11,6 @@ use crate::{
use bincode::{config::Options, serialize_into};
use bzip2::bufread::BzDecoder;
use flate2::read::GzDecoder;
use fs_extra::dir::CopyOptions;
use log::*;
use regex::Regex;
use solana_measure::measure::Measure;
@ -111,9 +110,6 @@ pub enum SnapshotError {
#[error("serialization error: {0}")]
Serialize(#[from] bincode::Error),
#[error("file system error: {0}")]
FsExtra(#[from] fs_extra::error::Error),
#[error("archive generation failure {0}")]
ArchiveGenerationFailure(ExitStatus),
@ -547,7 +543,7 @@ pub fn add_snapshot<P: AsRef<Path>>(
})
}
pub fn serialize_status_cache(
fn serialize_status_cache(
slot: Slot,
slot_deltas: &[BankSlotDelta],
snapshot_links: &TempDir,
@ -627,20 +623,6 @@ pub fn bank_from_archive<P: AsRef<Path>>(
measure.stop();
info!("{}", measure);
// Move the unpacked snapshots into `snapshot_path`
let dir_files = fs::read_dir(&unpacked_snapshots_dir).unwrap_or_else(|err| {
panic!(
"Invalid snapshot path {:?}: {}",
unpacked_snapshots_dir, err
)
});
let paths: Vec<PathBuf> = dir_files
.filter_map(|entry| entry.ok().map(|e| e.path()))
.collect();
let mut copy_options = CopyOptions::new();
copy_options.overwrite = true;
fs_extra::move_items(&paths, &snapshot_path, &copy_options)?;
Ok(bank)
}
@ -800,7 +782,10 @@ where
.pop()
.ok_or_else(|| get_io_error("No snapshots found in snapshots directory"))?;
info!("Loading bank from {:?}", &root_paths.snapshot_file_path);
info!(
"Loading bank from {}",
&root_paths.snapshot_file_path.display()
);
let bank = deserialize_snapshot_data_file(&root_paths.snapshot_file_path, |mut stream| {
Ok(match snapshot_version_enum {
SnapshotVersion::V1_2_0 => bank_from_stream(
@ -819,7 +804,10 @@ where
let status_cache_path = unpacked_snapshots_dir.join(SNAPSHOT_STATUS_CACHE_FILE_NAME);
let slot_deltas = deserialize_snapshot_data_file(&status_cache_path, |stream| {
info!("Rebuilding status cache...");
info!(
"Rebuilding status cache from {}",
status_cache_path.display()
);
let slot_deltas: Vec<BankSlotDelta> = bincode::options()
.with_limit(MAX_SNAPSHOT_DATA_FILE_SIZE)
.with_fixint_encoding()