Removes MAX_BANK_SNAPSHOTS_TO_RETAIN constant (#31827)

This commit is contained in:
Brooks 2023-05-25 17:13:28 -04:00 committed by GitHub
parent 9d6c921b5f
commit 8a3f446db0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View File

@ -31,7 +31,6 @@ use {
snapshot_utils::{
self, ArchiveFormat,
SnapshotVersion::{self, V1_2_0},
MAX_BANK_SNAPSHOTS_TO_RETAIN,
},
status_cache::MAX_CACHE_ENTRIES,
},
@ -329,6 +328,7 @@ fn test_concurrent_snapshot_packaging(
cluster_type: ClusterType,
) {
solana_logger::setup();
const MAX_BANK_SNAPSHOTS_TO_RETAIN: usize = 8;
// Set up snapshotting config
let mut snapshot_test_config =
@ -373,7 +373,7 @@ fn test_concurrent_snapshot_packaging(
let saved_slot = 4;
let mut saved_archive_path = None;
for forks in 0..snapshot_utils::MAX_BANK_SNAPSHOTS_TO_RETAIN + 2 {
for forks in 0..MAX_BANK_SNAPSHOTS_TO_RETAIN + 2 {
let bank = Bank::new_from_parent(
&bank_forks[forks as u64],
&Pubkey::default(),
@ -484,7 +484,7 @@ fn test_concurrent_snapshot_packaging(
assert!(bank_snapshots
.into_iter()
.map(|path| path.slot)
.eq(3..=snapshot_utils::MAX_BANK_SNAPSHOTS_TO_RETAIN as u64 + 2));
.eq(3..=MAX_BANK_SNAPSHOTS_TO_RETAIN as u64 + 2));
// Create a SnapshotPackagerService to create tarballs from all the pending
// SnapshotPackage's on the channel. By the time this service starts, we have already

View File

@ -86,8 +86,6 @@ const MAX_SNAPSHOT_VERSION_FILE_SIZE: u64 = 8; // byte
const VERSION_STRING_V1_2_0: &str = "1.2.0";
pub const TMP_SNAPSHOT_ARCHIVE_PREFIX: &str = "tmp-snapshot-archive-";
pub const BANK_SNAPSHOT_PRE_FILENAME_EXTENSION: &str = "pre";
// Save some bank snapshots but not too many
pub const MAX_BANK_SNAPSHOTS_TO_RETAIN: usize = 8;
// The following unsafes are
// - Safe because the values are fixed, known non-zero constants
// - Necessary in order to have a plain NonZeroUsize as the constant, NonZeroUsize