Skip to content

Commit

Permalink
Adds --snapshot-zstd-compression-level to agave-validator (#4555)
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo authored Jan 21, 2025
1 parent 11e6ddf commit 02fb093
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Release channels have their own copy of this changelog:
* Add new command `solana feature revoke` for revoking pending feature activations. When a feature is activated, `solana feature revoke <feature-keypair> <cluster>` can be used to deallocate and reassign the account to the System program, undoing the operation. This can only be done before the feature becomes active.
* Unhide `--accounts-db-access-storages-method` for agave-validator and agave-ledger-tool and change default to `file`
* Remove tracer stats from banking-trace. `banking-trace` directory should be cleared when restarting on v2.2 for first time. It will not break if not cleared, but the file will be a mix of new/old format. (#4043)
* Add `--snapshot-zstd-compression-level` to set the compression level when archiving snapshots with zstd.

## [2.1.0]
* Breaking:
Expand Down
16 changes: 16 additions & 0 deletions validator/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1287,6 +1287,20 @@ pub fn app<'a>(version: &'a str, default_args: &'a DefaultArgs) -> App<'a, 'a> {
.takes_value(true)
.help("Snapshot archive format to use."),
)
.arg(
Arg::with_name("snapshot_zstd_compression_level")
.long("snapshot-zstd-compression-level")
.default_value(&default_args.snapshot_zstd_compression_level)
.value_name("LEVEL")
.takes_value(true)
.help("The compression level to use when archiving with zstd")
.long_help(
"The compression level to use when archiving with zstd. \
Higher compression levels generally produce higher \
compression ratio at the expense of speed and memory. \
See the zstd manpage for more information."
),
)
.arg(
Arg::with_name("max_genesis_archive_unpacked_size")
.long("max-genesis-archive-unpacked-size")
Expand Down Expand Up @@ -2360,6 +2374,7 @@ pub struct DefaultArgs {

pub snapshot_version: SnapshotVersion,
pub snapshot_archive_format: String,
pub snapshot_zstd_compression_level: String,

pub rocksdb_shred_compaction: String,
pub rocksdb_ledger_compression: String,
Expand Down Expand Up @@ -2460,6 +2475,7 @@ impl DefaultArgs {
min_snapshot_download_speed: DEFAULT_MIN_SNAPSHOT_DOWNLOAD_SPEED.to_string(),
max_snapshot_download_abort: MAX_SNAPSHOT_DOWNLOAD_ABORT.to_string(),
snapshot_archive_format: DEFAULT_ARCHIVE_COMPRESSION.to_string(),
snapshot_zstd_compression_level: "1".to_string(), // level 1 is optimized for speed
contact_debug_interval: "120000".to_string(),
snapshot_version: SnapshotVersion::default(),
rocksdb_shred_compaction: "level".to_string(),
Expand Down
4 changes: 2 additions & 2 deletions validator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1733,8 +1733,8 @@ pub fn main() {
let mut archive_format = ArchiveFormat::from_cli_arg(&archive_format_str)
.unwrap_or_else(|| panic!("Archive format not recognized: {archive_format_str}"));
if let ArchiveFormat::TarZstd { config } = &mut archive_format {
// level 1 is optimized for speed
config.compression_level = 1;
config.compression_level =
value_t_or_exit!(matches, "snapshot_zstd_compression_level", i32);
}
archive_format
};
Expand Down

0 comments on commit 02fb093

Please sign in to comment.