From 1d5314b5e625d47bcb4b32ca7e96d7133c86812a Mon Sep 17 00:00:00 2001 From: steviez Date: Thu, 15 Sep 2022 16:21:12 -0500 Subject: [PATCH] Make solana-ledger-tool retain all snapshots by default (#27788) --- ledger-tool/src/main.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ledger-tool/src/main.rs b/ledger-tool/src/main.rs index 17ef71399..81fc96a7e 100644 --- a/ledger-tool/src/main.rs +++ b/ledger-tool/src/main.rs @@ -58,8 +58,7 @@ use { snapshot_package::PendingAccountsPackage, snapshot_utils::{ self, ArchiveFormat, SnapshotVersion, DEFAULT_ARCHIVE_COMPRESSION, - DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN, - DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN, SUPPORTED_ARCHIVE_COMPRESSION, + SUPPORTED_ARCHIVE_COMPRESSION, }, }, solana_sdk::{ @@ -1441,8 +1440,9 @@ fn main() { .takes_value(true) .help("Log when transactions are processed that reference the given key(s)."); - let default_max_full_snapshot_archives_to_retain = - &DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN.to_string(); + // Use std::usize::MAX for maximum_*_snapshots_to_retain such that + // ledger-tool commands will not remove any snapshots by default + let default_max_full_snapshot_archives_to_retain = &std::usize::MAX.to_string(); let maximum_full_snapshot_archives_to_retain = Arg::with_name( "maximum_full_snapshots_to_retain", ) @@ -1455,8 +1455,7 @@ fn main() { "The maximum number of full snapshot archives to hold on to when purging older snapshots.", ); - let default_max_incremental_snapshot_archives_to_retain = - &DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN.to_string(); + let default_max_incremental_snapshot_archives_to_retain = &std::usize::MAX.to_string(); let maximum_incremental_snapshot_archives_to_retain = Arg::with_name( "maximum_incremental_snapshots_to_retain", )