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

Only write logs and snapshot if progress changed. #3489

Merged
merged 2 commits into from
Nov 28, 2024
Merged
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
32 changes: 19 additions & 13 deletions wen-restart/src/wen_restart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ pub(crate) fn aggregate_restart_last_voted_fork_slots(
}
let mut cursor = solana_gossip::crds::Cursor::default();
let mut is_full_slots = HashSet::new();
let mut old_progress = WenRestartProgress::default();
loop {
if exit.load(Ordering::Relaxed) {
return Err(WenRestartError::Exiting.into());
Expand Down Expand Up @@ -320,10 +321,14 @@ pub(crate) fn aggregate_restart_last_voted_fork_slots(
.collect();
}
filtered_slots.sort();
info!(
"Active peers: {} Slots to repair: {:?}",
active_percent, &filtered_slots
);
if progress != &old_progress {
info!(
"Active peers: {} Slots to repair: {:?}",
active_percent, &filtered_slots
);
write_wen_restart_records(wen_restart_path, progress)?;
old_progress = progress.clone();
}
if filtered_slots.is_empty()
&& active_percent >= wait_for_supermajority_threshold_percent as f64
{
Expand All @@ -333,7 +338,6 @@ pub(crate) fn aggregate_restart_last_voted_fork_slots(
{
*wen_restart_repair_slots.write().unwrap() = filtered_slots;
}
write_wen_restart_records(wen_restart_path, progress)?;
let elapsed = timestamp().saturating_sub(start);
let time_left = GOSSIP_SLEEP_MILLIS.saturating_sub(elapsed);
if time_left > 0 {
Expand Down Expand Up @@ -719,6 +723,7 @@ pub(crate) fn aggregate_restart_heaviest_fork(
let mut cursor = solana_gossip::crds::Cursor::default();
let mut total_active_stake = 0;
let mut stat_printed_at = Instant::now();
let mut old_progress = WenRestartProgress::default();
loop {
if exit.load(Ordering::Relaxed) {
return Ok(());
Expand Down Expand Up @@ -761,14 +766,15 @@ pub(crate) fn aggregate_restart_heaviest_fork(
.unwrap()
.total_active_stake = current_total_active_stake;
}
let total_active_stake = heaviest_fork_aggregate.total_active_stake();
info!(
"Total active stake: {} Total stake {} Active percent: {:.2}%",
total_active_stake,
total_stake,
total_active_stake as f64 / total_stake as f64 * 100.0,
);
write_wen_restart_records(wen_restart_path, progress)?;
if old_progress != *progress {
info!(
"Total active stake: {} Total stake {}",
heaviest_fork_aggregate.total_active_stake(),
total_stake
);
write_wen_restart_records(wen_restart_path, progress)?;
old_progress = progress.clone();
}
let elapsed = timestamp().saturating_sub(start);
let time_left = GOSSIP_SLEEP_MILLIS.saturating_sub(elapsed);
if time_left > 0 {
Expand Down
Loading