Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add maximum_incremental_snapshot_archives_to_retain to SnapshotConfig #19612

Merged
merged 1 commit into from
Sep 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/src/accounts_hash_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ mod tests {
archive_format: ArchiveFormat::Tar,
snapshot_version: SnapshotVersion::default(),
maximum_full_snapshot_archives_to_retain: usize::MAX,
maximum_incremental_snapshot_archives_to_retain: usize::MAX,
};
for i in 0..MAX_SNAPSHOT_HASHES + 1 {
let accounts_package = AccountsPackage {
Expand Down
3 changes: 3 additions & 0 deletions core/src/test_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use {
snapshot_config::SnapshotConfig,
snapshot_utils::{
ArchiveFormat, SnapshotVersion, DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
},
},
solana_sdk::{
Expand Down Expand Up @@ -529,6 +530,8 @@ impl TestValidator {
snapshot_version: SnapshotVersion::default(),
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,
}),
enforce_ulimit_nofile: false,
warp_slot: config.warp_slot,
Expand Down
3 changes: 3 additions & 0 deletions core/tests/snapshots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ mod tests {
},
snapshot_utils::{
self, ArchiveFormat, SnapshotVersion, DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
},
status_cache::MAX_CACHE_ENTRIES,
};
Expand Down Expand Up @@ -149,6 +150,8 @@ mod tests {
snapshot_version,
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,
};
bank_forks.set_snapshot_config(Some(snapshot_config.clone()));
SnapshotTestConfig {
Expand Down
3 changes: 3 additions & 0 deletions ledger-tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use solana_runtime::{
snapshot_config::SnapshotConfig,
snapshot_utils::{
self, ArchiveFormat, SnapshotVersion, DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
},
};
use solana_sdk::{
Expand Down Expand Up @@ -719,6 +720,8 @@ fn load_bank_forks(
archive_format: ArchiveFormat::TarBzip2,
snapshot_version: SnapshotVersion::default(),
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") {
Expand Down
2 changes: 2 additions & 0 deletions local-cluster/tests/local_cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3536,6 +3536,8 @@ fn setup_snapshot_validator_config(
snapshot_version: snapshot_utils::SnapshotVersion::default(),
maximum_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
Expand Down
2 changes: 2 additions & 0 deletions replica-node/src/replica_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ impl ReplicaNode {
snapshot_version: snapshot_utils::SnapshotVersion::default(),
maximum_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 =
Expand Down
2 changes: 2 additions & 0 deletions replica-node/tests/local_replica.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ fn setup_snapshot_validator_config(
snapshot_version: snapshot_utils::SnapshotVersion::default(),
maximum_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
Expand Down
3 changes: 3 additions & 0 deletions rpc/src/rpc_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ mod tests {
bank::Bank,
snapshot_utils::{
ArchiveFormat, SnapshotVersion, DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
},
},
solana_sdk::{
Expand Down Expand Up @@ -623,6 +624,8 @@ mod tests {
snapshot_version: SnapshotVersion::default(),
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,
}),
bank_forks,
RpcHealth::stub(),
Expand Down
4 changes: 4 additions & 0 deletions runtime/src/snapshot_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ pub struct SnapshotConfig {

/// Maximum number of full snapshot archives to retain
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,
}
1 change: 1 addition & 0 deletions runtime/src/snapshot_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 const TMP_SNAPSHOT_ARCHIVE_PREFIX: &str = "tmp-snapshot-archive-";
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 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)$";

Expand Down
3 changes: 3 additions & 0 deletions validator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ use {
snapshot_config::SnapshotConfig,
snapshot_utils::{
self, ArchiveFormat, SnapshotVersion, DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
},
},
solana_sdk::{
Expand Down Expand Up @@ -2691,6 +2692,8 @@ pub fn main() {
archive_format,
snapshot_version,
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 =
Expand Down