|
|
@@ -1665,27 +1665,42 @@ pub fn main() {
|
|
|
})
|
|
|
});
|
|
|
|
|
|
- let incremental_snapshot_interval_slots =
|
|
|
- value_t_or_exit!(matches, "incremental_snapshot_interval_slots", u64);
|
|
|
- let (full_snapshot_archive_interval_slots, incremental_snapshot_archive_interval_slots) =
|
|
|
- if incremental_snapshot_interval_slots > 0 {
|
|
|
- if !matches.is_present("no_incremental_snapshots") {
|
|
|
- (
|
|
|
- value_t_or_exit!(matches, "full_snapshot_interval_slots", u64),
|
|
|
- incremental_snapshot_interval_slots,
|
|
|
- )
|
|
|
- } else {
|
|
|
- (
|
|
|
- incremental_snapshot_interval_slots,
|
|
|
- DISABLED_SNAPSHOT_ARCHIVE_INTERVAL,
|
|
|
- )
|
|
|
- }
|
|
|
- } else {
|
|
|
+ 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) => {
|
|
|
+ // 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.",
|
|
|
+ );
|
|
|
+ }
|
|
|
+ (
|
|
|
+ full_snapshot_interval_slots,
|
|
|
+ DISABLED_SNAPSHOT_ARCHIVE_INTERVAL,
|
|
|
+ )
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
validator_config.snapshot_config = SnapshotConfig {
|
|
|
usage: if full_snapshot_archive_interval_slots == DISABLED_SNAPSHOT_ARCHIVE_INTERVAL {
|
|
|
@@ -1712,29 +1727,30 @@ pub fn main() {
|
|
|
incremental_snapshot_archive_interval_slots,
|
|
|
);
|
|
|
|
|
|
+ info!(
|
|
|
+ "Snapshot configuration: full snapshot interval: {} slots, incremental snapshot interval: {} slots",
|
|
|
+ if full_snapshot_archive_interval_slots == DISABLED_SNAPSHOT_ARCHIVE_INTERVAL {
|
|
|
+ "disabled".to_string()
|
|
|
+ } else {
|
|
|
+ full_snapshot_archive_interval_slots.to_string()
|
|
|
+ },
|
|
|
+ if incremental_snapshot_archive_interval_slots == DISABLED_SNAPSHOT_ARCHIVE_INTERVAL {
|
|
|
+ "disabled".to_string()
|
|
|
+ } else {
|
|
|
+ incremental_snapshot_archive_interval_slots.to_string()
|
|
|
+ },
|
|
|
+ );
|
|
|
+
|
|
|
if !is_snapshot_config_valid(
|
|
|
&validator_config.snapshot_config,
|
|
|
validator_config.accounts_hash_interval_slots,
|
|
|
) {
|
|
|
eprintln!(
|
|
|
"Invalid snapshot configuration provided: snapshot intervals are incompatible. \
|
|
|
- \n\t- full snapshot interval MUST be a multiple of incremental snapshot interval (if \
|
|
|
- enabled)\
|
|
|
- \n\t- full snapshot interval MUST be larger than incremental snapshot \
|
|
|
- interval (if enabled)\
|
|
|
- \nSnapshot configuration values:\
|
|
|
- \n\tfull snapshot interval: {}\
|
|
|
- \n\tincremental snapshot interval: {}",
|
|
|
- if full_snapshot_archive_interval_slots == DISABLED_SNAPSHOT_ARCHIVE_INTERVAL {
|
|
|
- "disabled".to_string()
|
|
|
- } else {
|
|
|
- full_snapshot_archive_interval_slots.to_string()
|
|
|
- },
|
|
|
- if incremental_snapshot_archive_interval_slots == DISABLED_SNAPSHOT_ARCHIVE_INTERVAL {
|
|
|
- "disabled".to_string()
|
|
|
- } else {
|
|
|
- incremental_snapshot_archive_interval_slots.to_string()
|
|
|
- },
|
|
|
+ \n\t- full snapshot interval MUST be a multiple of incremental snapshot interval \
|
|
|
+ (if enabled) \
|
|
|
+ \n\t- full snapshot interval MUST be larger than incremental snapshot interval \
|
|
|
+ (if enabled)",
|
|
|
);
|
|
|
exit(1);
|
|
|
}
|