Add maximum_incremental_snapshot_archives_to_retain to SnapshotConfig (#19612)
This commit is contained in:
@ -343,6 +343,7 @@ mod tests {
|
|||||||
archive_format: ArchiveFormat::Tar,
|
archive_format: ArchiveFormat::Tar,
|
||||||
snapshot_version: SnapshotVersion::default(),
|
snapshot_version: SnapshotVersion::default(),
|
||||||
maximum_full_snapshot_archives_to_retain: usize::MAX,
|
maximum_full_snapshot_archives_to_retain: usize::MAX,
|
||||||
|
maximum_incremental_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 {
|
||||||
|
@ -18,6 +18,7 @@ use {
|
|||||||
snapshot_config::SnapshotConfig,
|
snapshot_config::SnapshotConfig,
|
||||||
snapshot_utils::{
|
snapshot_utils::{
|
||||||
ArchiveFormat, SnapshotVersion, DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
ArchiveFormat, SnapshotVersion, DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||||
|
DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
@ -529,6 +530,8 @@ impl TestValidator {
|
|||||||
snapshot_version: SnapshotVersion::default(),
|
snapshot_version: SnapshotVersion::default(),
|
||||||
maximum_full_snapshot_archives_to_retain:
|
maximum_full_snapshot_archives_to_retain:
|
||||||
DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||||
|
maximum_incremental_snapshot_archives_to_retain:
|
||||||
|
DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||||
}),
|
}),
|
||||||
enforce_ulimit_nofile: false,
|
enforce_ulimit_nofile: false,
|
||||||
warp_slot: config.warp_slot,
|
warp_slot: config.warp_slot,
|
||||||
|
@ -71,6 +71,7 @@ mod tests {
|
|||||||
},
|
},
|
||||||
snapshot_utils::{
|
snapshot_utils::{
|
||||||
self, ArchiveFormat, SnapshotVersion, DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
self, ArchiveFormat, SnapshotVersion, DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||||
|
DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||||
},
|
},
|
||||||
status_cache::MAX_CACHE_ENTRIES,
|
status_cache::MAX_CACHE_ENTRIES,
|
||||||
};
|
};
|
||||||
@ -149,6 +150,8 @@ mod tests {
|
|||||||
snapshot_version,
|
snapshot_version,
|
||||||
maximum_full_snapshot_archives_to_retain:
|
maximum_full_snapshot_archives_to_retain:
|
||||||
DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||||
|
maximum_incremental_snapshot_archives_to_retain:
|
||||||
|
DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||||
};
|
};
|
||||||
bank_forks.set_snapshot_config(Some(snapshot_config.clone()));
|
bank_forks.set_snapshot_config(Some(snapshot_config.clone()));
|
||||||
SnapshotTestConfig {
|
SnapshotTestConfig {
|
||||||
|
@ -34,6 +34,7 @@ use solana_runtime::{
|
|||||||
snapshot_config::SnapshotConfig,
|
snapshot_config::SnapshotConfig,
|
||||||
snapshot_utils::{
|
snapshot_utils::{
|
||||||
self, ArchiveFormat, SnapshotVersion, DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
self, ArchiveFormat, SnapshotVersion, DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||||
|
DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use solana_sdk::{
|
use solana_sdk::{
|
||||||
@ -719,6 +720,8 @@ fn load_bank_forks(
|
|||||||
archive_format: ArchiveFormat::TarBzip2,
|
archive_format: ArchiveFormat::TarBzip2,
|
||||||
snapshot_version: SnapshotVersion::default(),
|
snapshot_version: SnapshotVersion::default(),
|
||||||
maximum_full_snapshot_archives_to_retain: DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
maximum_full_snapshot_archives_to_retain: DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||||
|
maximum_incremental_snapshot_archives_to_retain:
|
||||||
|
DEFAULT_MAX_INCREMENTAL_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") {
|
||||||
|
@ -3536,6 +3536,8 @@ fn setup_snapshot_validator_config(
|
|||||||
snapshot_version: snapshot_utils::SnapshotVersion::default(),
|
snapshot_version: snapshot_utils::SnapshotVersion::default(),
|
||||||
maximum_full_snapshot_archives_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,
|
||||||
|
maximum_incremental_snapshot_archives_to_retain:
|
||||||
|
snapshot_utils::DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create the account paths
|
// Create the account paths
|
||||||
|
@ -270,6 +270,8 @@ impl ReplicaNode {
|
|||||||
snapshot_version: snapshot_utils::SnapshotVersion::default(),
|
snapshot_version: snapshot_utils::SnapshotVersion::default(),
|
||||||
maximum_full_snapshot_archives_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,
|
||||||
|
maximum_incremental_snapshot_archives_to_retain:
|
||||||
|
snapshot_utils::DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||||
};
|
};
|
||||||
|
|
||||||
let bank_info =
|
let bank_info =
|
||||||
|
@ -129,6 +129,8 @@ fn setup_snapshot_validator_config(
|
|||||||
snapshot_version: snapshot_utils::SnapshotVersion::default(),
|
snapshot_version: snapshot_utils::SnapshotVersion::default(),
|
||||||
maximum_full_snapshot_archives_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,
|
||||||
|
maximum_incremental_snapshot_archives_to_retain:
|
||||||
|
snapshot_utils::DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create the account paths
|
// Create the account paths
|
||||||
|
@ -506,6 +506,7 @@ mod tests {
|
|||||||
bank::Bank,
|
bank::Bank,
|
||||||
snapshot_utils::{
|
snapshot_utils::{
|
||||||
ArchiveFormat, SnapshotVersion, DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
ArchiveFormat, SnapshotVersion, DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||||
|
DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
@ -623,6 +624,8 @@ mod tests {
|
|||||||
snapshot_version: SnapshotVersion::default(),
|
snapshot_version: SnapshotVersion::default(),
|
||||||
maximum_full_snapshot_archives_to_retain:
|
maximum_full_snapshot_archives_to_retain:
|
||||||
DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||||
|
maximum_incremental_snapshot_archives_to_retain:
|
||||||
|
DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||||
}),
|
}),
|
||||||
bank_forks,
|
bank_forks,
|
||||||
RpcHealth::stub(),
|
RpcHealth::stub(),
|
||||||
|
@ -26,4 +26,8 @@ pub struct SnapshotConfig {
|
|||||||
|
|
||||||
/// Maximum number of full snapshot archives to retain
|
/// Maximum number of full snapshot archives to retain
|
||||||
pub maximum_full_snapshot_archives_to_retain: usize,
|
pub maximum_full_snapshot_archives_to_retain: usize,
|
||||||
|
|
||||||
|
/// Maximum number of incremental snapshot archives to retain
|
||||||
|
/// NOTE: Incremental snapshots will only be kept for the latest full snapshot
|
||||||
|
pub maximum_incremental_snapshot_archives_to_retain: usize,
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,7 @@ const DEFAULT_SNAPSHOT_VERSION: SnapshotVersion = SnapshotVersion::V1_2_0;
|
|||||||
pub(crate) const TMP_BANK_SNAPSHOT_PREFIX: &str = "tmp-bank-snapshot-";
|
pub(crate) const TMP_BANK_SNAPSHOT_PREFIX: &str = "tmp-bank-snapshot-";
|
||||||
pub const TMP_SNAPSHOT_ARCHIVE_PREFIX: &str = "tmp-snapshot-archive-";
|
pub const TMP_SNAPSHOT_ARCHIVE_PREFIX: &str = "tmp-snapshot-archive-";
|
||||||
pub const DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN: usize = 2;
|
pub const DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN: usize = 2;
|
||||||
|
pub const DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN: usize = 100;
|
||||||
pub const FULL_SNAPSHOT_ARCHIVE_FILENAME_REGEX: &str = r"^snapshot-(?P<slot>[[:digit:]]+)-(?P<hash>[[:alnum:]]+)\.(?P<ext>tar|tar\.bz2|tar\.zst|tar\.gz)$";
|
pub const FULL_SNAPSHOT_ARCHIVE_FILENAME_REGEX: &str = r"^snapshot-(?P<slot>[[:digit:]]+)-(?P<hash>[[:alnum:]]+)\.(?P<ext>tar|tar\.bz2|tar\.zst|tar\.gz)$";
|
||||||
pub const INCREMENTAL_SNAPSHOT_ARCHIVE_FILENAME_REGEX: &str = r"^incremental-snapshot-(?P<base>[[:digit:]]+)-(?P<slot>[[:digit:]]+)-(?P<hash>[[:alnum:]]+)\.(?P<ext>tar|tar\.bz2|tar\.zst|tar\.gz)$";
|
pub const INCREMENTAL_SNAPSHOT_ARCHIVE_FILENAME_REGEX: &str = r"^incremental-snapshot-(?P<base>[[:digit:]]+)-(?P<slot>[[:digit:]]+)-(?P<hash>[[:alnum:]]+)\.(?P<ext>tar|tar\.bz2|tar\.zst|tar\.gz)$";
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ use {
|
|||||||
snapshot_config::SnapshotConfig,
|
snapshot_config::SnapshotConfig,
|
||||||
snapshot_utils::{
|
snapshot_utils::{
|
||||||
self, ArchiveFormat, SnapshotVersion, DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
self, ArchiveFormat, SnapshotVersion, DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||||
|
DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
@ -2691,6 +2692,8 @@ pub fn main() {
|
|||||||
archive_format,
|
archive_format,
|
||||||
snapshot_version,
|
snapshot_version,
|
||||||
maximum_full_snapshot_archives_to_retain,
|
maximum_full_snapshot_archives_to_retain,
|
||||||
|
maximum_incremental_snapshot_archives_to_retain:
|
||||||
|
DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||||
});
|
});
|
||||||
|
|
||||||
validator_config.accounts_hash_interval_slots =
|
validator_config.accounts_hash_interval_slots =
|
||||||
|
Reference in New Issue
Block a user