Don't bother restoring snapshots, they're never used
This commit is contained in:
parent
b6dcdb90e8
commit
db6ee289c9
|
@ -34,10 +34,6 @@ pub mod transaction_utils;
|
||||||
pub mod vote_account;
|
pub mod vote_account;
|
||||||
pub mod vote_sender_types;
|
pub mod vote_sender_types;
|
||||||
|
|
||||||
extern crate solana_config_program;
|
|
||||||
extern crate solana_stake_program;
|
|
||||||
extern crate solana_vote_program;
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate solana_metrics;
|
extern crate solana_metrics;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
@ -45,6 +41,3 @@ extern crate serde_derive;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate solana_frozen_abi_macro;
|
extern crate solana_frozen_abi_macro;
|
||||||
|
|
||||||
extern crate fs_extra;
|
|
||||||
extern crate tempfile;
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ use crate::{
|
||||||
use bincode::{config::Options, serialize_into};
|
use bincode::{config::Options, serialize_into};
|
||||||
use bzip2::bufread::BzDecoder;
|
use bzip2::bufread::BzDecoder;
|
||||||
use flate2::read::GzDecoder;
|
use flate2::read::GzDecoder;
|
||||||
use fs_extra::dir::CopyOptions;
|
|
||||||
use log::*;
|
use log::*;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use solana_measure::measure::Measure;
|
use solana_measure::measure::Measure;
|
||||||
|
@ -111,9 +110,6 @@ pub enum SnapshotError {
|
||||||
#[error("serialization error: {0}")]
|
#[error("serialization error: {0}")]
|
||||||
Serialize(#[from] bincode::Error),
|
Serialize(#[from] bincode::Error),
|
||||||
|
|
||||||
#[error("file system error: {0}")]
|
|
||||||
FsExtra(#[from] fs_extra::error::Error),
|
|
||||||
|
|
||||||
#[error("archive generation failure {0}")]
|
#[error("archive generation failure {0}")]
|
||||||
ArchiveGenerationFailure(ExitStatus),
|
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: Slot,
|
||||||
slot_deltas: &[BankSlotDelta],
|
slot_deltas: &[BankSlotDelta],
|
||||||
snapshot_links: &TempDir,
|
snapshot_links: &TempDir,
|
||||||
|
@ -627,20 +623,6 @@ pub fn bank_from_archive<P: AsRef<Path>>(
|
||||||
measure.stop();
|
measure.stop();
|
||||||
info!("{}", measure);
|
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, ©_options)?;
|
|
||||||
|
|
||||||
Ok(bank)
|
Ok(bank)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -800,7 +782,10 @@ where
|
||||||
.pop()
|
.pop()
|
||||||
.ok_or_else(|| get_io_error("No snapshots found in snapshots directory"))?;
|
.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| {
|
let bank = deserialize_snapshot_data_file(&root_paths.snapshot_file_path, |mut stream| {
|
||||||
Ok(match snapshot_version_enum {
|
Ok(match snapshot_version_enum {
|
||||||
SnapshotVersion::V1_2_0 => bank_from_stream(
|
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 status_cache_path = unpacked_snapshots_dir.join(SNAPSHOT_STATUS_CACHE_FILE_NAME);
|
||||||
let slot_deltas = deserialize_snapshot_data_file(&status_cache_path, |stream| {
|
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()
|
let slot_deltas: Vec<BankSlotDelta> = bincode::options()
|
||||||
.with_limit(MAX_SNAPSHOT_DATA_FILE_SIZE)
|
.with_limit(MAX_SNAPSHOT_DATA_FILE_SIZE)
|
||||||
.with_fixint_encoding()
|
.with_fixint_encoding()
|
||||||
|
|
Loading…
Reference in New Issue