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..00be39f03df347 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 snapshot generation") + ) .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.", + To disable all snapshot generation, see --no-snapshots.", ), ) .arg( diff --git a/validator/src/commands/run/execute.rs b/validator/src/commands/run/execute.rs index ec3b8ef89b7021..592585a155f5c7 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!( + "Snapshot generation was 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 {