From 5887d914ea9ff1ee9354d060c524b74662aa06fc Mon Sep 17 00:00:00 2001 From: frits-double-eye <31902851+frits-double-eye@users.noreply.github.com> Date: Wed, 24 Nov 2021 14:39:20 +0200 Subject: [PATCH] Revert "Rename maximum_full_snapshot_archives_to_retain (#19610)" This reverts commit 3d94d2e96217380f5c5d5881ef1b9a29230bc7b4. --- core/src/accounts_hash_verifier.rs | 2 +- core/src/test_validator.rs | 3 +-- core/src/validator.rs | 4 ++-- core/tests/snapshots.rs | 9 ++++----- ledger-tool/src/main.rs | 2 +- local-cluster/tests/local_cluster.rs | 3 +-- replica-node/src/replica_node.rs | 4 ++-- replica-node/tests/local_replica.rs | 3 +-- rpc/src/rpc_service.rs | 3 +-- runtime/src/snapshot_config.rs | 2 +- validator/src/main.rs | 6 +++--- 11 files changed, 18 insertions(+), 23 deletions(-) diff --git a/core/src/accounts_hash_verifier.rs b/core/src/accounts_hash_verifier.rs index d6d9baf73958e4..90b08f7f4b1dd9 100644 --- a/core/src/accounts_hash_verifier.rs +++ b/core/src/accounts_hash_verifier.rs @@ -342,7 +342,7 @@ mod tests { bank_snapshots_dir: PathBuf::default(), archive_format: ArchiveFormat::Tar, snapshot_version: SnapshotVersion::default(), - maximum_full_snapshot_archives_to_retain: usize::MAX, + maximum_snapshots_to_retain: usize::MAX, }; for i in 0..MAX_SNAPSHOT_HASHES + 1 { let accounts_package = AccountsPackage { diff --git a/core/src/test_validator.rs b/core/src/test_validator.rs index c43f7efc10a621..0957125c028ad2 100644 --- a/core/src/test_validator.rs +++ b/core/src/test_validator.rs @@ -527,8 +527,7 @@ impl TestValidator { snapshot_archives_dir: ledger_path.to_path_buf(), archive_format: ArchiveFormat::Tar, snapshot_version: SnapshotVersion::default(), - maximum_full_snapshot_archives_to_retain: - DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN, + maximum_snapshots_to_retain: DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN, }), enforce_ulimit_nofile: false, warp_slot: config.warp_slot, diff --git a/core/src/validator.rs b/core/src/validator.rs index 5584bbd7992cd2..8aa97df2c7cc8b 100644 --- a/core/src/validator.rs +++ b/core/src/validator.rs @@ -651,7 +651,7 @@ impl Validator { snapshot_hash, &exit, &cluster_info, - snapshot_config.maximum_full_snapshot_archives_to_retain, + snapshot_config.maximum_snapshots_to_retain, ); ( Some(snapshot_packager_service), @@ -1237,7 +1237,7 @@ fn new_banks_from_ledger( None, &snapshot_config.snapshot_archives_dir, snapshot_config.archive_format, - snapshot_config.maximum_full_snapshot_archives_to_retain, + snapshot_config.maximum_snapshots_to_retain, ) .unwrap_or_else(|err| { error!("Unable to create snapshot: {}", err); diff --git a/core/tests/snapshots.rs b/core/tests/snapshots.rs index f66389f5c9a929..1a4b5ec7d914a2 100644 --- a/core/tests/snapshots.rs +++ b/core/tests/snapshots.rs @@ -147,8 +147,7 @@ mod tests { bank_snapshots_dir: bank_snapshots_dir.path().to_path_buf(), archive_format: ArchiveFormat::TarBzip2, snapshot_version, - maximum_full_snapshot_archives_to_retain: - DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN, + maximum_snapshots_to_retain: DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN, }; bank_forks.set_snapshot_config(Some(snapshot_config.clone())); SnapshotTestConfig { @@ -772,7 +771,7 @@ mod tests { bank.get_snapshot_storages(None), snapshot_config.archive_format, snapshot_config.snapshot_version, - snapshot_config.maximum_full_snapshot_archives_to_retain, + snapshot_config.maximum_snapshots_to_retain, )?; Ok(()) @@ -808,7 +807,7 @@ mod tests { storages, snapshot_config.archive_format, snapshot_config.snapshot_version, - snapshot_config.maximum_full_snapshot_archives_to_retain, + snapshot_config.maximum_snapshots_to_retain, )?; Ok(()) @@ -925,7 +924,7 @@ mod tests { &cluster_info, snapshot_test_config .snapshot_config - .maximum_full_snapshot_archives_to_retain, + .maximum_snapshots_to_retain, ); let accounts_hash_verifier = AccountsHashVerifier::new( diff --git a/ledger-tool/src/main.rs b/ledger-tool/src/main.rs index 0d0f78a404dc4f..a47fbdb9ba6464 100644 --- a/ledger-tool/src/main.rs +++ b/ledger-tool/src/main.rs @@ -718,7 +718,7 @@ fn load_bank_forks( bank_snapshots_dir, archive_format: ArchiveFormat::TarBzip2, snapshot_version: SnapshotVersion::default(), - maximum_full_snapshot_archives_to_retain: DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN, + maximum_snapshots_to_retain: DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN, }) }; let account_paths = if let Some(account_paths) = arg_matches.value_of("account_paths") { diff --git a/local-cluster/tests/local_cluster.rs b/local-cluster/tests/local_cluster.rs index 13eaa2f69400cf..026135edf53adf 100644 --- a/local-cluster/tests/local_cluster.rs +++ b/local-cluster/tests/local_cluster.rs @@ -3534,8 +3534,7 @@ fn setup_snapshot_validator_config( bank_snapshots_dir: bank_snapshots_dir.path().to_path_buf(), archive_format: ArchiveFormat::TarBzip2, snapshot_version: snapshot_utils::SnapshotVersion::default(), - maximum_full_snapshot_archives_to_retain: - snapshot_utils::DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN, + maximum_snapshots_to_retain: snapshot_utils::DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN, }; // Create the account paths diff --git a/replica-node/src/replica_node.rs b/replica-node/src/replica_node.rs index a9705c4b61e498..35226ccf295121 100644 --- a/replica-node/src/replica_node.rs +++ b/replica-node/src/replica_node.rs @@ -94,7 +94,7 @@ fn initialize_from_snapshot( &replica_config.snapshot_archives_dir, replica_config.snapshot_info, false, - snapshot_config.maximum_full_snapshot_archives_to_retain, + snapshot_config.maximum_snapshots_to_retain, &mut None, ) .unwrap(); @@ -268,7 +268,7 @@ impl ReplicaNode { bank_snapshots_dir: replica_config.bank_snapshots_dir.clone(), archive_format: ArchiveFormat::TarBzip2, snapshot_version: snapshot_utils::SnapshotVersion::default(), - maximum_full_snapshot_archives_to_retain: + maximum_snapshots_to_retain: snapshot_utils::DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN, }; diff --git a/replica-node/tests/local_replica.rs b/replica-node/tests/local_replica.rs index e06d94c1b44234..f89cce1cd570c8 100644 --- a/replica-node/tests/local_replica.rs +++ b/replica-node/tests/local_replica.rs @@ -127,8 +127,7 @@ fn setup_snapshot_validator_config( bank_snapshots_dir: bank_snapshots_dir.path().to_path_buf(), archive_format: ArchiveFormat::TarBzip2, snapshot_version: snapshot_utils::SnapshotVersion::default(), - maximum_full_snapshot_archives_to_retain: - snapshot_utils::DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN, + maximum_snapshots_to_retain: snapshot_utils::DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN, }; // Create the account paths diff --git a/rpc/src/rpc_service.rs b/rpc/src/rpc_service.rs index ded963884682d2..1a4dbb6b1cc96a 100644 --- a/rpc/src/rpc_service.rs +++ b/rpc/src/rpc_service.rs @@ -621,8 +621,7 @@ mod tests { bank_snapshots_dir: PathBuf::from("/"), archive_format: ArchiveFormat::TarBzip2, snapshot_version: SnapshotVersion::default(), - maximum_full_snapshot_archives_to_retain: - DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN, + maximum_snapshots_to_retain: DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN, }), bank_forks, RpcHealth::stub(), diff --git a/runtime/src/snapshot_config.rs b/runtime/src/snapshot_config.rs index 3e06780ee25d6f..71a504545ebed3 100644 --- a/runtime/src/snapshot_config.rs +++ b/runtime/src/snapshot_config.rs @@ -25,5 +25,5 @@ pub struct SnapshotConfig { pub snapshot_version: SnapshotVersion, /// Maximum number of full snapshot archives to retain - pub maximum_full_snapshot_archives_to_retain: usize, + pub maximum_snapshots_to_retain: usize, } diff --git a/validator/src/main.rs b/validator/src/main.rs index d0bfcbc877710c..a5d0b42d23aaed 100644 --- a/validator/src/main.rs +++ b/validator/src/main.rs @@ -916,7 +916,7 @@ fn rpc_bootstrap( let maximum_snapshots_to_retain = if let Some(snapshot_config) = validator_config.snapshot_config.as_ref() { - snapshot_config.maximum_full_snapshot_archives_to_retain + snapshot_config.maximum_snapshots_to_retain } else { 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 maximum_local_snapshot_age = value_t_or_exit!(matches, "maximum_local_snapshot_age", u64); - let maximum_full_snapshot_archives_to_retain = + let maximum_snapshots_to_retain = value_t_or_exit!(matches, "maximum_snapshots_to_retain", usize); let minimal_snapshot_download_speed = value_t_or_exit!(matches, "minimal_snapshot_download_speed", f32); @@ -2679,7 +2679,7 @@ pub fn main() { snapshot_archives_dir: snapshot_archives_dir.clone(), archive_format, snapshot_version, - maximum_full_snapshot_archives_to_retain, + maximum_snapshots_to_retain, }); validator_config.accounts_hash_interval_slots =