Add option for separate snapshot location
(cherry picked from commit 6126878f509c69e23480a5ec22b3271e2b16e072)
This commit is contained in:
@ -341,7 +341,7 @@ fn get_rpc_node(
|
||||
blacklisted_rpc_nodes: &mut HashSet<Pubkey>,
|
||||
snapshot_not_required: bool,
|
||||
no_untrusted_rpc: bool,
|
||||
ledger_path: &std::path::Path,
|
||||
snapshot_output_dir: &Path,
|
||||
) -> Option<(ContactInfo, Option<(Slot, Hash)>)> {
|
||||
let mut blacklist_timeout = Instant::now();
|
||||
let mut newer_cluster_snapshot_timeout = None;
|
||||
@ -420,7 +420,7 @@ fn get_rpc_node(
|
||||
blacklist_timeout = Instant::now();
|
||||
|
||||
let mut highest_snapshot_hash: Option<(Slot, Hash)> =
|
||||
get_highest_snapshot_archive_path(ledger_path)
|
||||
get_highest_snapshot_archive_path(snapshot_output_dir)
|
||||
.map(|(_path, (slot, hash, _compression))| (slot, hash));
|
||||
let eligible_rpc_peers = if snapshot_not_required {
|
||||
rpc_peers
|
||||
@ -758,6 +758,7 @@ fn rpc_bootstrap(
|
||||
node: &Node,
|
||||
identity_keypair: &Arc<Keypair>,
|
||||
ledger_path: &Path,
|
||||
snapshot_output_dir: &Path,
|
||||
vote_account: &Pubkey,
|
||||
authorized_voter_keypairs: &[Arc<Keypair>],
|
||||
cluster_entrypoints: &[ContactInfo],
|
||||
@ -809,7 +810,7 @@ fn rpc_bootstrap(
|
||||
&mut blacklisted_rpc_nodes,
|
||||
bootstrap_config.no_snapshot_fetch,
|
||||
bootstrap_config.no_untrusted_rpc,
|
||||
ledger_path,
|
||||
snapshot_output_dir,
|
||||
);
|
||||
if rpc_node_details.is_none() {
|
||||
return;
|
||||
@ -865,7 +866,7 @@ fn rpc_bootstrap(
|
||||
let mut use_local_snapshot = false;
|
||||
|
||||
if let Some(highest_local_snapshot_slot) =
|
||||
get_highest_snapshot_archive_path(ledger_path)
|
||||
get_highest_snapshot_archive_path(snapshot_output_dir)
|
||||
.map(|(_path, (slot, _hash, _compression))| slot)
|
||||
{
|
||||
if highest_local_snapshot_slot
|
||||
@ -905,7 +906,7 @@ fn rpc_bootstrap(
|
||||
gossip_exit_flag.store(true, Ordering::Relaxed);
|
||||
let ret = download_snapshot(
|
||||
&rpc_contact_info.rpc,
|
||||
&ledger_path,
|
||||
&snapshot_output_dir,
|
||||
snapshot_hash,
|
||||
use_progress_bar,
|
||||
);
|
||||
@ -1203,6 +1204,13 @@ pub fn main() {
|
||||
.multiple(true)
|
||||
.help("Path to accounts shrink path which can hold a compacted account set."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("snapshots_path")
|
||||
.long("snapshots")
|
||||
.value_name("PATHS")
|
||||
.takes_value(true)
|
||||
.help("Snapshots location"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("gossip_port")
|
||||
.long("gossip-port")
|
||||
@ -2058,7 +2066,12 @@ pub fn main() {
|
||||
|
||||
let snapshot_interval_slots = value_t_or_exit!(matches, "snapshot_interval_slots", u64);
|
||||
let maximum_local_snapshot_age = value_t_or_exit!(matches, "maximum_local_snapshot_age", u64);
|
||||
let snapshot_path = ledger_path.join("snapshot");
|
||||
let snapshot_output_dir = if matches.is_present("snapshots_path") {
|
||||
PathBuf::from(matches.value_of("snapshots_path").unwrap())
|
||||
} else {
|
||||
ledger_path.clone()
|
||||
};
|
||||
let snapshot_path = snapshot_output_dir.join("snapshot");
|
||||
fs::create_dir_all(&snapshot_path).unwrap_or_else(|err| {
|
||||
eprintln!(
|
||||
"Failed to create snapshots directory {:?}: {}",
|
||||
@ -2094,7 +2107,7 @@ pub fn main() {
|
||||
std::u64::MAX
|
||||
},
|
||||
snapshot_path,
|
||||
snapshot_package_output_path: ledger_path.clone(),
|
||||
snapshot_package_output_path: snapshot_output_dir.clone(),
|
||||
archive_format,
|
||||
snapshot_version,
|
||||
});
|
||||
@ -2291,7 +2304,7 @@ pub fn main() {
|
||||
enable_recycler_warming();
|
||||
}
|
||||
solana_ledger::entry::init_poh();
|
||||
solana_runtime::snapshot_utils::remove_tmp_snapshot_archives(&ledger_path);
|
||||
solana_runtime::snapshot_utils::remove_tmp_snapshot_archives(&snapshot_output_dir);
|
||||
|
||||
let should_check_duplicate_instance = !matches.is_present("no_duplicate_instance_check");
|
||||
if !cluster_entrypoints.is_empty() {
|
||||
@ -2299,6 +2312,7 @@ pub fn main() {
|
||||
&node,
|
||||
&identity_keypair,
|
||||
&ledger_path,
|
||||
&snapshot_output_dir,
|
||||
&vote_account,
|
||||
&authorized_voter_keypairs,
|
||||
&cluster_entrypoints,
|
||||
|
Reference in New Issue
Block a user