From 248a38f61c86995b2c68557e1ad993a3f7dcf012 Mon Sep 17 00:00:00 2001 From: brooks Date: Thu, 6 Feb 2025 15:45:11 -0500 Subject: [PATCH 1/5] Adds --no-snapshots to disable generating snapshots --- CHANGELOG.md | 2 + validator/src/commands/run/args.rs | 9 +++- validator/src/commands/run/execute.rs | 73 ++++++++++++++++----------- 3 files changed, 53 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75f6f649c3b5d1..cd811e3f95b9b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,8 @@ Release channels have their own copy of this changelog: * Add global `--skip-preflight` option for skipping preflight checks on all transactions sent through RPC. This flag, along with `--use-rpc`, can improve success rate with program deployments using the public RPC nodes. * Add new command `solana feature revoke` for revoking pending feature activations. When a feature is activated, `solana feature revoke ` 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. * Add new variant to `--block-production-method` for `central-scheduler-greedy`. This is a simplified scheduler that has much better performance than the more strict `central-scheduler` variant. + * Add `--no-snapshots` to disable generating snapshots. + * Using `--snapshot-interval-slots 0` to disable generating snapshots is now deprecated. * 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. diff --git a/validator/src/commands/run/args.rs b/validator/src/commands/run/args.rs index dac15bc7caaa67..cca5933c48b2cb 100644 --- a/validator/src/commands/run/args.rs +++ b/validator/src/commands/run/args.rs @@ -456,6 +456,13 @@ pub fn add_args<'a>(app: App<'a, 'a>, default_args: &'a DefaultArgs) -> App<'a, snapshot available for download from other validators", ), ) + .arg( + Arg::with_name("no_snapshots") + .long("no-snapshots") + .takes_value(false) + .conflicts_with_all(&["no_incremental_snapshots", "snapshot_interval_slots", "full_snapshot_interval_slots"]) + .help("Disable all snapshots") + ) .arg( Arg::with_name("no_incremental_snapshots") .long("no-incremental-snapshots") @@ -474,7 +481,7 @@ pub fn add_args<'a>(app: App<'a, 'a>, default_args: &'a DefaultArgs) -> App<'a, "Number of slots between generating snapshots. \ If incremental snapshots are enabled, this sets the incremental snapshot interval. \ If incremental snapshots are disabled, this sets the full snapshot interval. \ - Setting this to 0 disables all snapshots.", + Setting this to 0 disables all snapshots, but prefer --no-snapshots instead.", ), ) .arg( diff --git a/validator/src/commands/run/execute.rs b/validator/src/commands/run/execute.rs index ec3b8ef89b7021..e5c6aa88b2d4c6 100644 --- a/validator/src/commands/run/execute.rs +++ b/validator/src/commands/run/execute.rs @@ -942,42 +942,55 @@ pub fn execute( }) }); - let (full_snapshot_archive_interval_slots, incremental_snapshot_archive_interval_slots) = match ( - !matches.is_present("no_incremental_snapshots"), - value_t_or_exit!(matches, "snapshot_interval_slots", u64), - ) { - (_, 0) => { + let (full_snapshot_archive_interval_slots, incremental_snapshot_archive_interval_slots) = + if matches.is_present("no_snapshots") { // snapshots are disabled ( DISABLED_SNAPSHOT_ARCHIVE_INTERVAL, DISABLED_SNAPSHOT_ARCHIVE_INTERVAL, ) - } - (true, incremental_snapshot_interval_slots) => { - // incremental snapshots are enabled - // use --snapshot-interval-slots for the incremental snapshot interval - ( - value_t_or_exit!(matches, "full_snapshot_interval_slots", u64), - incremental_snapshot_interval_slots, - ) - } - (false, full_snapshot_interval_slots) => { - // incremental snapshots are *disabled* - // use --snapshot-interval-slots for the *full* snapshot interval - // also warn if --full-snapshot-interval-slots was specified - if matches.occurrences_of("full_snapshot_interval_slots") > 0 { - warn!( - "Incremental snapshots are disabled, yet --full-snapshot-interval-slots was specified! \ - Note that --full-snapshot-interval-slots is *ignored* when incremental snapshots are disabled. \ - Use --snapshot-interval-slots instead.", - ); + } else { + match ( + !matches.is_present("no_incremental_snapshots"), + value_t_or_exit!(matches, "snapshot_interval_slots", u64), + ) { + (_, 0) => { + // snapshots are disabled + warn!( + "Snapshots were disabled with `--snapshot-interval-slots 0`, which is \ + now deprecated. Use `--no-snapshots` instead.", + ); + ( + DISABLED_SNAPSHOT_ARCHIVE_INTERVAL, + DISABLED_SNAPSHOT_ARCHIVE_INTERVAL, + ) + } + (true, incremental_snapshot_interval_slots) => { + // incremental snapshots are enabled + // use --snapshot-interval-slots for the incremental snapshot interval + ( + value_t_or_exit!(matches, "full_snapshot_interval_slots", u64), + incremental_snapshot_interval_slots, + ) + } + (false, full_snapshot_interval_slots) => { + // incremental snapshots are *disabled* + // use --snapshot-interval-slots for the *full* snapshot interval + // also warn if --full-snapshot-interval-slots was specified + if matches.occurrences_of("full_snapshot_interval_slots") > 0 { + warn!( + "Incremental snapshots are disabled, yet --full-snapshot-interval-slots was specified! \ + Note that --full-snapshot-interval-slots is *ignored* when incremental snapshots are disabled. \ + Use --snapshot-interval-slots instead.", + ); + } + ( + full_snapshot_interval_slots, + DISABLED_SNAPSHOT_ARCHIVE_INTERVAL, + ) + } } - ( - full_snapshot_interval_slots, - DISABLED_SNAPSHOT_ARCHIVE_INTERVAL, - ) - } - }; + }; validator_config.snapshot_config = SnapshotConfig { usage: if full_snapshot_archive_interval_slots == DISABLED_SNAPSHOT_ARCHIVE_INTERVAL { From 23442b590bcfa0bf57cba876c15cc0e4ef8c902d Mon Sep 17 00:00:00 2001 From: Brooks Date: Tue, 11 Feb 2025 21:44:32 -0500 Subject: [PATCH 2/5] pr: help for --snapshot-interval-slots Co-authored-by: Trent Nelson <490004+t-nelson@users.noreply.github.com> --- validator/src/commands/run/args.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validator/src/commands/run/args.rs b/validator/src/commands/run/args.rs index cca5933c48b2cb..84e7ae2ac0a969 100644 --- a/validator/src/commands/run/args.rs +++ b/validator/src/commands/run/args.rs @@ -481,7 +481,7 @@ pub fn add_args<'a>(app: App<'a, 'a>, default_args: &'a DefaultArgs) -> App<'a, "Number of slots between generating snapshots. \ If incremental snapshots are enabled, this sets the incremental snapshot interval. \ If incremental snapshots are disabled, this sets the full snapshot interval. \ - Setting this to 0 disables all snapshots, but prefer --no-snapshots instead.", + To disable all snapshot generation, see --no-snapshots.", ), ) .arg( From fd9dafb42a73a6c68049b0024e6bfd58a99588c6 Mon Sep 17 00:00:00 2001 From: Brooks Date: Tue, 11 Feb 2025 21:44:57 -0500 Subject: [PATCH 3/5] pr: help for --no-snapshots Co-authored-by: Trent Nelson <490004+t-nelson@users.noreply.github.com> --- validator/src/commands/run/args.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validator/src/commands/run/args.rs b/validator/src/commands/run/args.rs index 84e7ae2ac0a969..00be39f03df347 100644 --- a/validator/src/commands/run/args.rs +++ b/validator/src/commands/run/args.rs @@ -461,7 +461,7 @@ pub fn add_args<'a>(app: App<'a, 'a>, default_args: &'a DefaultArgs) -> App<'a, .long("no-snapshots") .takes_value(false) .conflicts_with_all(&["no_incremental_snapshots", "snapshot_interval_slots", "full_snapshot_interval_slots"]) - .help("Disable all snapshots") + .help("Disable all snapshot generation") ) .arg( Arg::with_name("no_incremental_snapshots") From c32be594b95876f8888d2c655d1e8b0702052145 Mon Sep 17 00:00:00 2001 From: Brooks Date: Tue, 11 Feb 2025 21:45:45 -0500 Subject: [PATCH 4/5] pr: warn text Co-authored-by: Trent Nelson <490004+t-nelson@users.noreply.github.com> --- validator/src/commands/run/execute.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/validator/src/commands/run/execute.rs b/validator/src/commands/run/execute.rs index e5c6aa88b2d4c6..3a20ae17c0a364 100644 --- a/validator/src/commands/run/execute.rs +++ b/validator/src/commands/run/execute.rs @@ -957,8 +957,8 @@ pub fn execute( (_, 0) => { // snapshots are disabled warn!( - "Snapshots were disabled with `--snapshot-interval-slots 0`, which is \ - now deprecated. Use `--no-snapshots` instead.", + "Snapshots generation was disabled with `--snapshot-interval-slots 0`, \ + which is now deprecated. Use `--no-snapshots` instead.", ); ( DISABLED_SNAPSHOT_ARCHIVE_INTERVAL, From dee135b539ec0e7a57b6715390ef577c730166a6 Mon Sep 17 00:00:00 2001 From: brooks Date: Tue, 11 Feb 2025 21:46:50 -0500 Subject: [PATCH 5/5] fixup formatting and grammar --- validator/src/commands/run/execute.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/validator/src/commands/run/execute.rs b/validator/src/commands/run/execute.rs index 3a20ae17c0a364..592585a155f5c7 100644 --- a/validator/src/commands/run/execute.rs +++ b/validator/src/commands/run/execute.rs @@ -957,8 +957,8 @@ pub fn execute( (_, 0) => { // snapshots are disabled warn!( - "Snapshots generation was disabled with `--snapshot-interval-slots 0`, \ - which is now deprecated. Use `--no-snapshots` instead.", + "Snapshot generation was disabled with `--snapshot-interval-slots 0`, \ + which is now deprecated. Use `--no-snapshots` instead.", ); ( DISABLED_SNAPSHOT_ARCHIVE_INTERVAL,