Rename maximum_full_snapshot_archives_to_retain (#19610)

To prepare for adding maximum_incremental_snapshot_archives_to_retain,
rename the current field in SnapshotConfig.
This commit is contained in:
Brooks Prumo
2021-09-03 11:28:10 -05:00
committed by GitHub
parent df040c05da
commit 7ab0aec61f
11 changed files with 23 additions and 18 deletions

View File

@ -342,7 +342,7 @@ mod tests {
bank_snapshots_dir: PathBuf::default(), bank_snapshots_dir: PathBuf::default(),
archive_format: ArchiveFormat::Tar, archive_format: ArchiveFormat::Tar,
snapshot_version: SnapshotVersion::default(), snapshot_version: SnapshotVersion::default(),
maximum_snapshots_to_retain: usize::MAX, maximum_full_snapshot_archives_to_retain: usize::MAX,
}; };
for i in 0..MAX_SNAPSHOT_HASHES + 1 { for i in 0..MAX_SNAPSHOT_HASHES + 1 {
let accounts_package = AccountsPackage { let accounts_package = AccountsPackage {

View File

@ -527,7 +527,8 @@ impl TestValidator {
snapshot_archives_dir: ledger_path.to_path_buf(), snapshot_archives_dir: ledger_path.to_path_buf(),
archive_format: ArchiveFormat::Tar, archive_format: ArchiveFormat::Tar,
snapshot_version: SnapshotVersion::default(), snapshot_version: SnapshotVersion::default(),
maximum_snapshots_to_retain: DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN, maximum_full_snapshot_archives_to_retain:
DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
}), }),
enforce_ulimit_nofile: false, enforce_ulimit_nofile: false,
warp_slot: config.warp_slot, warp_slot: config.warp_slot,

View File

@ -651,7 +651,7 @@ impl Validator {
snapshot_hash, snapshot_hash,
&exit, &exit,
&cluster_info, &cluster_info,
snapshot_config.maximum_snapshots_to_retain, snapshot_config.maximum_full_snapshot_archives_to_retain,
); );
( (
Some(snapshot_packager_service), Some(snapshot_packager_service),
@ -1237,7 +1237,7 @@ fn new_banks_from_ledger(
None, None,
&snapshot_config.snapshot_archives_dir, &snapshot_config.snapshot_archives_dir,
snapshot_config.archive_format, snapshot_config.archive_format,
snapshot_config.maximum_snapshots_to_retain, snapshot_config.maximum_full_snapshot_archives_to_retain,
) )
.unwrap_or_else(|err| { .unwrap_or_else(|err| {
error!("Unable to create snapshot: {}", err); error!("Unable to create snapshot: {}", err);

View File

@ -147,7 +147,8 @@ mod tests {
bank_snapshots_dir: bank_snapshots_dir.path().to_path_buf(), bank_snapshots_dir: bank_snapshots_dir.path().to_path_buf(),
archive_format: ArchiveFormat::TarBzip2, archive_format: ArchiveFormat::TarBzip2,
snapshot_version, snapshot_version,
maximum_snapshots_to_retain: DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN, maximum_full_snapshot_archives_to_retain:
DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
}; };
bank_forks.set_snapshot_config(Some(snapshot_config.clone())); bank_forks.set_snapshot_config(Some(snapshot_config.clone()));
SnapshotTestConfig { SnapshotTestConfig {
@ -771,7 +772,7 @@ mod tests {
bank.get_snapshot_storages(None), bank.get_snapshot_storages(None),
snapshot_config.archive_format, snapshot_config.archive_format,
snapshot_config.snapshot_version, snapshot_config.snapshot_version,
snapshot_config.maximum_snapshots_to_retain, snapshot_config.maximum_full_snapshot_archives_to_retain,
)?; )?;
Ok(()) Ok(())
@ -807,7 +808,7 @@ mod tests {
storages, storages,
snapshot_config.archive_format, snapshot_config.archive_format,
snapshot_config.snapshot_version, snapshot_config.snapshot_version,
snapshot_config.maximum_snapshots_to_retain, snapshot_config.maximum_full_snapshot_archives_to_retain,
)?; )?;
Ok(()) Ok(())
@ -924,7 +925,7 @@ mod tests {
&cluster_info, &cluster_info,
snapshot_test_config snapshot_test_config
.snapshot_config .snapshot_config
.maximum_snapshots_to_retain, .maximum_full_snapshot_archives_to_retain,
); );
let accounts_hash_verifier = AccountsHashVerifier::new( let accounts_hash_verifier = AccountsHashVerifier::new(

View File

@ -718,7 +718,7 @@ fn load_bank_forks(
bank_snapshots_dir, bank_snapshots_dir,
archive_format: ArchiveFormat::TarBzip2, archive_format: ArchiveFormat::TarBzip2,
snapshot_version: SnapshotVersion::default(), snapshot_version: SnapshotVersion::default(),
maximum_snapshots_to_retain: DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN, maximum_full_snapshot_archives_to_retain: DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
}) })
}; };
let account_paths = if let Some(account_paths) = arg_matches.value_of("account_paths") { let account_paths = if let Some(account_paths) = arg_matches.value_of("account_paths") {

View File

@ -3534,7 +3534,8 @@ fn setup_snapshot_validator_config(
bank_snapshots_dir: bank_snapshots_dir.path().to_path_buf(), bank_snapshots_dir: bank_snapshots_dir.path().to_path_buf(),
archive_format: ArchiveFormat::TarBzip2, archive_format: ArchiveFormat::TarBzip2,
snapshot_version: snapshot_utils::SnapshotVersion::default(), snapshot_version: snapshot_utils::SnapshotVersion::default(),
maximum_snapshots_to_retain: snapshot_utils::DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN, maximum_full_snapshot_archives_to_retain:
snapshot_utils::DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
}; };
// Create the account paths // Create the account paths

View File

@ -94,7 +94,7 @@ fn initialize_from_snapshot(
&replica_config.snapshot_archives_dir, &replica_config.snapshot_archives_dir,
replica_config.snapshot_info, replica_config.snapshot_info,
false, false,
snapshot_config.maximum_snapshots_to_retain, snapshot_config.maximum_full_snapshot_archives_to_retain,
&mut None, &mut None,
) )
.unwrap(); .unwrap();
@ -268,7 +268,7 @@ impl ReplicaNode {
bank_snapshots_dir: replica_config.bank_snapshots_dir.clone(), bank_snapshots_dir: replica_config.bank_snapshots_dir.clone(),
archive_format: ArchiveFormat::TarBzip2, archive_format: ArchiveFormat::TarBzip2,
snapshot_version: snapshot_utils::SnapshotVersion::default(), snapshot_version: snapshot_utils::SnapshotVersion::default(),
maximum_snapshots_to_retain: maximum_full_snapshot_archives_to_retain:
snapshot_utils::DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN, snapshot_utils::DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
}; };

View File

@ -127,7 +127,8 @@ fn setup_snapshot_validator_config(
bank_snapshots_dir: bank_snapshots_dir.path().to_path_buf(), bank_snapshots_dir: bank_snapshots_dir.path().to_path_buf(),
archive_format: ArchiveFormat::TarBzip2, archive_format: ArchiveFormat::TarBzip2,
snapshot_version: snapshot_utils::SnapshotVersion::default(), snapshot_version: snapshot_utils::SnapshotVersion::default(),
maximum_snapshots_to_retain: snapshot_utils::DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN, maximum_full_snapshot_archives_to_retain:
snapshot_utils::DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
}; };
// Create the account paths // Create the account paths

View File

@ -621,7 +621,8 @@ mod tests {
bank_snapshots_dir: PathBuf::from("/"), bank_snapshots_dir: PathBuf::from("/"),
archive_format: ArchiveFormat::TarBzip2, archive_format: ArchiveFormat::TarBzip2,
snapshot_version: SnapshotVersion::default(), snapshot_version: SnapshotVersion::default(),
maximum_snapshots_to_retain: DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN, maximum_full_snapshot_archives_to_retain:
DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
}), }),
bank_forks, bank_forks,
RpcHealth::stub(), RpcHealth::stub(),

View File

@ -25,5 +25,5 @@ pub struct SnapshotConfig {
pub snapshot_version: SnapshotVersion, pub snapshot_version: SnapshotVersion,
/// Maximum number of full snapshot archives to retain /// Maximum number of full snapshot archives to retain
pub maximum_snapshots_to_retain: usize, pub maximum_full_snapshot_archives_to_retain: usize,
} }

View File

@ -916,7 +916,7 @@ fn rpc_bootstrap(
let maximum_snapshots_to_retain = if let Some(snapshot_config) = let maximum_snapshots_to_retain = if let Some(snapshot_config) =
validator_config.snapshot_config.as_ref() validator_config.snapshot_config.as_ref()
{ {
snapshot_config.maximum_snapshots_to_retain snapshot_config.maximum_full_snapshot_archives_to_retain
} else { } else {
DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN
}; };
@ -2627,7 +2627,7 @@ pub fn main() {
let snapshot_interval_slots = value_t_or_exit!(matches, "snapshot_interval_slots", u64); 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 maximum_local_snapshot_age = value_t_or_exit!(matches, "maximum_local_snapshot_age", u64);
let maximum_snapshots_to_retain = let maximum_full_snapshot_archives_to_retain =
value_t_or_exit!(matches, "maximum_snapshots_to_retain", usize); value_t_or_exit!(matches, "maximum_snapshots_to_retain", usize);
let minimal_snapshot_download_speed = let minimal_snapshot_download_speed =
value_t_or_exit!(matches, "minimal_snapshot_download_speed", f32); value_t_or_exit!(matches, "minimal_snapshot_download_speed", f32);
@ -2679,7 +2679,7 @@ pub fn main() {
snapshot_archives_dir: snapshot_archives_dir.clone(), snapshot_archives_dir: snapshot_archives_dir.clone(),
archive_format, archive_format,
snapshot_version, snapshot_version,
maximum_snapshots_to_retain, maximum_full_snapshot_archives_to_retain,
}); });
validator_config.accounts_hash_interval_slots = validator_config.accounts_hash_interval_slots =