Wait for first incremental snapshot after a full snapshot before restarting

This commit is contained in:
Michael Vines 2022-08-30 08:13:08 -07:00
parent 4aa2a42cc7
commit 574097f640
1 changed files with 23 additions and 5 deletions

View File

@ -167,8 +167,16 @@ fn wait_for_restart_window(
let progress_bar = new_spinner_progress_bar();
let monitor_start_time = SystemTime::now();
let mut seen_incremential_snapshot = false;
loop {
let snapshot_slot_info = rpc_client.get_highest_snapshot_slot().ok();
let snapshot_slot_info_has_incremential = snapshot_slot_info
.as_ref()
.map(|snapshot_slot_info| snapshot_slot_info.incremental.is_some())
.unwrap_or_default();
seen_incremential_snapshot |= snapshot_slot_info_has_incremential;
let epoch_info = rpc_client.get_epoch_info_with_commitment(CommitmentConfig::processed())?;
let healthy = rpc_client.get_health().ok().is_some();
let delinquent_stake_percentage = {
@ -297,16 +305,16 @@ fn wait_for_restart_window(
}
};
let snapshot_slot = snapshot_slot_info.map(|snapshot_slot_info| {
snapshot_slot_info
.incremental
.unwrap_or(snapshot_slot_info.full)
});
match in_leader_schedule_hole {
Ok(_) => {
if skip_new_snapshot_check {
break; // Restart!
}
let snapshot_slot = snapshot_slot_info.map(|snapshot_slot_info| {
snapshot_slot_info
.incremental
.unwrap_or(snapshot_slot_info.full)
});
if restart_snapshot == None {
restart_snapshot = snapshot_slot;
}
@ -316,6 +324,16 @@ fn wait_for_restart_window(
>= (max_delinquency_percentage as f64 / 100.)
{
style("Delinquency too high").red().to_string()
} else if seen_incremential_snapshot && !snapshot_slot_info_has_incremential
{
// Restarts using just a full snapshot will put the node significantly
// further behind than if an incremental snapshot is also used, as full
// snapshots are larger and take much longer to create.
//
// Therefore if the node just created a new full snapshot, wait a
// little longer until it creates the first incremental snapshot for
// the full snapshot.
"Waiting for incremental snapshot".to_string()
} else {
break; // Restart!
}