Make wait_for_restart_window() aware of Incremental Snapshots (#19587)

When the validator is waiting to restart, the snapshot slot is checked.
With Incremental Snapshots, the full snapshot interval is going to be
_much_ higher, which would make this function wait for a looooong time.

So, if there's an incremental snapshot slot when checking, use that
slot, otherwise fall back to the full snapshot slot.
This commit is contained in:
Brooks Prumo
2021-09-03 11:42:22 -05:00
committed by GitHub
parent 7ab0aec61f
commit fb1b853b14

View File

@ -278,14 +278,17 @@ fn wait_for_restart_window(
} }
}; };
let full_snapshot_slot = let snapshot_slot = snapshot_slot_info.map(|snapshot_slot_info| {
snapshot_slot_info.map(|snapshot_slot_info| snapshot_slot_info.full); snapshot_slot_info
.incremental
.unwrap_or(snapshot_slot_info.full)
});
match in_leader_schedule_hole { match in_leader_schedule_hole {
Ok(_) => { Ok(_) => {
if restart_snapshot == None { if restart_snapshot == None {
restart_snapshot = full_snapshot_slot; restart_snapshot = snapshot_slot;
} }
if restart_snapshot == full_snapshot_slot && !monitoring_another_validator { if restart_snapshot == snapshot_slot && !monitoring_another_validator {
"Waiting for a new snapshot".to_string() "Waiting for a new snapshot".to_string()
} else if delinquent_stake_percentage >= min_delinquency_percentage { } else if delinquent_stake_percentage >= min_delinquency_percentage {
style("Delinquency too high").red().to_string() style("Delinquency too high").red().to_string()
@ -316,10 +319,18 @@ fn wait_for_restart_window(
"".to_string() "".to_string()
} else { } else {
format!( format!(
"| Full Snapshot Slot: {}", "| Full Snapshot Slot: {} | Incremental Snapshot Slot: {}",
snapshot_slot_info snapshot_slot_info
.as_ref()
.map(|snapshot_slot_info| snapshot_slot_info.full.to_string()) .map(|snapshot_slot_info| snapshot_slot_info.full.to_string())
.unwrap_or_else(|| '-'.to_string()), .unwrap_or_else(|| '-'.to_string()),
snapshot_slot_info
.as_ref()
.map(|snapshot_slot_info| snapshot_slot_info
.incremental
.map(|incremental| incremental.to_string()))
.flatten()
.unwrap_or_else(|| '-'.to_string()),
) )
}, },
delinquent_stake_percentage * 100., delinquent_stake_percentage * 100.,