Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds --no-snapshots to disable generating snapshots #4836

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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.
* 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.
Expand Down
9 changes: 8 additions & 1 deletion validator/src/commands/run/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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(
Expand Down
73 changes: 43 additions & 30 deletions validator/src/commands/run/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading