Name snapshots consistently (#19346)
#### Problem Snapshot names are overloaded, and there are multiple terms that mean the same thing. This is confusing. Here's a list of ones in the codebase that I've found: ``` - snapshot_dir - snapshots_dir - snapshot_path - snapshot_output_dir - snapshot_package_output_path - snapshot_archives_dir ``` #### Summary of Changes For all the ones that are about the directory where snapshot archives are stored, ensure they are `snapshot_archives_dir`. For the ones about the (bank) snapshots directory, set to `bank_snapshots_dir`. Co-authored-by: Michael Vines <mvines@gmail.com>
This commit is contained in:
@@ -278,12 +278,12 @@ pub fn main() {
|
||||
);
|
||||
|
||||
let ledger_path = PathBuf::from(matches.value_of("ledger_path").unwrap());
|
||||
let snapshot_output_dir = if let Some(snapshots) = matches.value_of("snapshots") {
|
||||
let snapshot_archives_dir = if let Some(snapshots) = matches.value_of("snapshots") {
|
||||
PathBuf::from(snapshots)
|
||||
} else {
|
||||
ledger_path.clone()
|
||||
};
|
||||
let snapshot_path = snapshot_output_dir.join("snapshot");
|
||||
let bank_snapshots_dir = snapshot_archives_dir.join("snapshot");
|
||||
|
||||
let account_paths: Vec<PathBuf> =
|
||||
if let Ok(account_paths) = values_t!(matches, "account_paths", String) {
|
||||
@@ -348,7 +348,7 @@ pub fn main() {
|
||||
&node,
|
||||
expected_shred_version,
|
||||
&peer_pubkey,
|
||||
&snapshot_output_dir,
|
||||
&snapshot_archives_dir,
|
||||
socket_addr_space,
|
||||
);
|
||||
|
||||
@@ -362,8 +362,8 @@ pub fn main() {
|
||||
rpc_addr: rpc_addrs.0,
|
||||
rpc_pubsub_addr: rpc_addrs.1,
|
||||
ledger_path,
|
||||
snapshot_output_dir,
|
||||
snapshot_path,
|
||||
snapshot_archives_dir,
|
||||
bank_snapshots_dir,
|
||||
account_paths,
|
||||
snapshot_info: snapshot_info.unwrap(),
|
||||
cluster_info,
|
||||
|
@@ -44,8 +44,8 @@ pub struct ReplicaNodeConfig {
|
||||
pub rpc_addr: SocketAddr,
|
||||
pub rpc_pubsub_addr: SocketAddr,
|
||||
pub ledger_path: PathBuf,
|
||||
pub snapshot_output_dir: PathBuf,
|
||||
pub snapshot_path: PathBuf,
|
||||
pub snapshot_archives_dir: PathBuf,
|
||||
pub bank_snapshots_dir: PathBuf,
|
||||
pub account_paths: Vec<PathBuf>,
|
||||
pub snapshot_info: (Slot, Hash),
|
||||
pub cluster_info: Arc<ClusterInfo>,
|
||||
@@ -82,12 +82,12 @@ fn initialize_from_snapshot(
|
||||
) -> ReplicaBankInfo {
|
||||
info!(
|
||||
"Downloading snapshot from the peer into {:?}",
|
||||
replica_config.snapshot_output_dir
|
||||
replica_config.snapshot_archives_dir
|
||||
);
|
||||
|
||||
download_snapshot(
|
||||
&replica_config.rpc_source_addr,
|
||||
&replica_config.snapshot_output_dir,
|
||||
&replica_config.snapshot_archives_dir,
|
||||
replica_config.snapshot_info,
|
||||
false,
|
||||
snapshot_config.maximum_snapshots_to_retain,
|
||||
@@ -95,11 +95,13 @@ fn initialize_from_snapshot(
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
fs::create_dir_all(&snapshot_config.snapshot_path).expect("Couldn't create snapshot directory");
|
||||
fs::create_dir_all(&snapshot_config.bank_snapshots_dir)
|
||||
.expect("Couldn't create bank snapshot directory");
|
||||
|
||||
let archive_info =
|
||||
snapshot_utils::get_highest_full_snapshot_archive_info(&replica_config.snapshot_output_dir)
|
||||
.unwrap();
|
||||
let archive_info = snapshot_utils::get_highest_full_snapshot_archive_info(
|
||||
&replica_config.snapshot_archives_dir,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let process_options = blockstore_processor::ProcessOptions {
|
||||
account_indexes: replica_config.account_indexes.clone(),
|
||||
@@ -109,12 +111,12 @@ fn initialize_from_snapshot(
|
||||
|
||||
info!(
|
||||
"Build bank from snapshot archive: {:?}",
|
||||
&snapshot_config.snapshot_path
|
||||
&snapshot_config.bank_snapshots_dir
|
||||
);
|
||||
let (bank0, _) = snapshot_utils::bank_from_snapshot_archives(
|
||||
&replica_config.account_paths,
|
||||
&[],
|
||||
&snapshot_config.snapshot_path,
|
||||
&snapshot_config.bank_snapshots_dir,
|
||||
&archive_info,
|
||||
None,
|
||||
genesis_config,
|
||||
@@ -257,8 +259,8 @@ impl ReplicaNode {
|
||||
let snapshot_config = SnapshotConfig {
|
||||
full_snapshot_archive_interval_slots: std::u64::MAX,
|
||||
incremental_snapshot_archive_interval_slots: std::u64::MAX,
|
||||
snapshot_package_output_path: replica_config.snapshot_output_dir.clone(),
|
||||
snapshot_path: replica_config.snapshot_path.clone(),
|
||||
snapshot_archives_dir: replica_config.snapshot_archives_dir.clone(),
|
||||
bank_snapshots_dir: replica_config.bank_snapshots_dir.clone(),
|
||||
archive_format: ArchiveFormat::TarBzip2,
|
||||
snapshot_version: snapshot_utils::SnapshotVersion::default(),
|
||||
maximum_snapshots_to_retain:
|
||||
|
@@ -55,7 +55,7 @@ fn get_rpc_peer_node(
|
||||
cluster_entrypoints: &[ContactInfo],
|
||||
expected_shred_version: Option<u16>,
|
||||
peer_pubkey: &Pubkey,
|
||||
snapshot_output_dir: &Path,
|
||||
snapshot_archives_dir: &Path,
|
||||
) -> Option<(ContactInfo, Option<(Slot, Hash)>)> {
|
||||
let mut newer_cluster_snapshot_timeout = None;
|
||||
let mut retry_reason = None;
|
||||
@@ -110,7 +110,7 @@ fn get_rpc_peer_node(
|
||||
);
|
||||
|
||||
let mut highest_snapshot_info: Option<(Slot, Hash)> =
|
||||
snapshot_utils::get_highest_full_snapshot_archive_info(snapshot_output_dir).map(
|
||||
snapshot_utils::get_highest_full_snapshot_archive_info(snapshot_archives_dir).map(
|
||||
|snapshot_archive_info| {
|
||||
(snapshot_archive_info.slot(), *snapshot_archive_info.hash())
|
||||
},
|
||||
@@ -238,7 +238,7 @@ pub fn get_rpc_peer_info(
|
||||
node: &Node,
|
||||
expected_shred_version: Option<u16>,
|
||||
peer_pubkey: &Pubkey,
|
||||
snapshot_output_dir: &Path,
|
||||
snapshot_archives_dir: &Path,
|
||||
socket_addr_space: SocketAddrSpace,
|
||||
) -> (Arc<ClusterInfo>, ContactInfo, Option<(Slot, Hash)>) {
|
||||
let identity_keypair = Arc::new(identity_keypair);
|
||||
@@ -260,7 +260,7 @@ pub fn get_rpc_peer_info(
|
||||
cluster_entrypoints,
|
||||
expected_shred_version,
|
||||
peer_pubkey,
|
||||
snapshot_output_dir,
|
||||
snapshot_archives_dir,
|
||||
);
|
||||
let rpc_node_details = rpc_node_details.unwrap();
|
||||
|
||||
|
Reference in New Issue
Block a user