* Remove dead code (cherry picked from commitb6dcdb90e8
) * Don't bother restoring snapshots, they're never used (cherry picked from commitdb6ee289c9
) Co-authored-by: Michael Vines <mvines@gmail.com>
This commit is contained in:
@ -3158,9 +3158,8 @@ pub mod tests {
|
|||||||
};
|
};
|
||||||
use assert_matches::assert_matches;
|
use assert_matches::assert_matches;
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
use solana_sdk::pubkey::PUBKEY_BYTES;
|
use solana_sdk::{account::Account, hash::HASH_BYTES, pubkey::PUBKEY_BYTES};
|
||||||
use solana_sdk::{account::Account, hash::HASH_BYTES};
|
use std::{iter::FromIterator, str::FromStr};
|
||||||
use std::{fs, iter::FromIterator, str::FromStr};
|
|
||||||
|
|
||||||
fn linear_ancestors(end_slot: u64) -> Ancestors {
|
fn linear_ancestors(end_slot: u64) -> Ancestors {
|
||||||
let mut ancestors: Ancestors = vec![(0, 0)].into_iter().collect();
|
let mut ancestors: Ancestors = vec![(0, 0)].into_iter().collect();
|
||||||
@ -4637,24 +4636,6 @@ pub mod tests {
|
|||||||
assert_eq!(ret.0.data.len(), data_len);
|
assert_eq!(ret.0.data.len(), data_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn copy_append_vecs<P: AsRef<Path>>(
|
|
||||||
accounts_db: &AccountsDB,
|
|
||||||
output_dir: P,
|
|
||||||
) -> IOResult<()> {
|
|
||||||
let storage_entries = accounts_db.get_snapshot_storages(Slot::max_value());
|
|
||||||
for storage in storage_entries.iter().flatten() {
|
|
||||||
let storage_path = storage.get_path();
|
|
||||||
let output_path = output_dir.as_ref().join(AppendVec::new_relative_path(
|
|
||||||
storage.slot(),
|
|
||||||
storage.append_vec_id(),
|
|
||||||
));
|
|
||||||
|
|
||||||
fs::copy(storage_path, output_path)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_hash_frozen_account_data() {
|
fn test_hash_frozen_account_data() {
|
||||||
let account = Account::new(1, 42, &Pubkey::default());
|
let account = Account::new(1, 42, &Pubkey::default());
|
||||||
|
@ -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()
|
||||||
|
Reference in New Issue
Block a user