Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Deprecate bz2/gzip/none/tar snapshot compression types #33484

Merged
merged 1 commit into from
Oct 2, 2023
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
20 changes: 8 additions & 12 deletions runtime/src/snapshot_utils/archive_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -36,11 +42,8 @@ impl ArchiveFormat {

pub fn from_cli_arg(archive_format_str: &str) -> Option<ArchiveFormat> {
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,
}
}
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down