From 533ae741591cd18670e70abe53de063f716d578e Mon Sep 17 00:00:00 2001 From: steviez Date: Mon, 2 Oct 2023 19:40:31 +0200 Subject: [PATCH] Deprecate bz2/gzip/none/tar snapshot compression types (#33484) These options are now disallowed on the command line for solana-validator and solana-ledger-tool, which effectively means no more snapshots will be created with this types in normal usecases. However, support for reading the deprecated types is still in place. (cherry picked from commit 73e9e6dd70a60b27586f7ea1d2e6c2f83a99b29d) --- runtime/src/snapshot_utils/archive_format.rs | 20 ++++++++------------ scripts/run.sh | 1 - 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/runtime/src/snapshot_utils/archive_format.rs b/runtime/src/snapshot_utils/archive_format.rs index 4ef271cbb5b..d807f4447a2 100644 --- a/runtime/src/snapshot_utils/archive_format.rs +++ b/runtime/src/snapshot_utils/archive_format.rs @@ -3,7 +3,13 @@ use { strum::Display, }; -pub const SUPPORTED_ARCHIVE_COMPRESSION: &[&str] = &["bz2", "gzip", "zstd", "lz4", "tar", "none"]; +// SUPPORTED_ARCHIVE_COMPRESSION lists the compression types that can be +// specified on the command line. "zstd" and "lz4" are valid whereas "gzip", +// "bz2", "tar" and "none" have been deprecated. Thus, all newly created +// snapshots will either use "zstd" or "lz4". By keeping the deprecated types +// in the ArchiveFormat enum, pre-existing snapshot archives with the +// deprecated compression types can still be read. +pub const SUPPORTED_ARCHIVE_COMPRESSION: &[&str] = &["zstd", "lz4"]; pub const DEFAULT_ARCHIVE_COMPRESSION: &str = "zstd"; pub const TAR_BZIP2_EXTENSION: &str = "tar.bz2"; @@ -36,11 +42,8 @@ impl ArchiveFormat { pub fn from_cli_arg(archive_format_str: &str) -> Option { match archive_format_str { - "bz2" => Some(ArchiveFormat::TarBzip2), - "gzip" => Some(ArchiveFormat::TarGzip), "zstd" => Some(ArchiveFormat::TarZstd), "lz4" => Some(ArchiveFormat::TarLz4), - "tar" | "none" => Some(ArchiveFormat::Tar), _ => None, } } @@ -158,14 +161,7 @@ mod tests { #[test] fn test_from_cli_arg() { - let golden = [ - Some(ArchiveFormat::TarBzip2), - Some(ArchiveFormat::TarGzip), - Some(ArchiveFormat::TarZstd), - Some(ArchiveFormat::TarLz4), - Some(ArchiveFormat::Tar), - Some(ArchiveFormat::Tar), - ]; + let golden = [Some(ArchiveFormat::TarZstd), Some(ArchiveFormat::TarLz4)]; for (arg, expected) in zip(SUPPORTED_ARCHIVE_COMPRESSION.iter(), golden.into_iter()) { assert_eq!(ArchiveFormat::from_cli_arg(arg), expected); diff --git a/scripts/run.sh b/scripts/run.sh index a890aa10c17..699bfce3e25 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -110,7 +110,6 @@ args=( --enable-rpc-transaction-history --enable-extended-tx-metadata-storage --init-complete-file "$dataDir"/init-completed - --snapshot-compression none --require-tower --no-wait-for-vote-to-start-leader --no-os-network-limits-test