get_best_weighted_repairs parameter cleanup (#30010)

This commit is contained in:
Jeff Biseda 2023-01-31 03:12:25 -08:00 committed by GitHub
parent 6163a6c279
commit c6cd96635f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 32 deletions

View File

@ -342,8 +342,8 @@ impl RepairService {
MAX_UNKNOWN_LAST_INDEX_REPAIRS, MAX_UNKNOWN_LAST_INDEX_REPAIRS,
MAX_CLOSEST_COMPLETION_REPAIRS, MAX_CLOSEST_COMPLETION_REPAIRS,
&duplicate_slot_repair_statuses, &duplicate_slot_repair_statuses,
Some(&mut repair_timing), &mut repair_timing,
Some(&mut best_repairs_stats), &mut best_repairs_stats,
); );
repairs repairs
@ -808,8 +808,8 @@ mod test {
MAX_UNKNOWN_LAST_INDEX_REPAIRS, MAX_UNKNOWN_LAST_INDEX_REPAIRS,
MAX_CLOSEST_COMPLETION_REPAIRS, MAX_CLOSEST_COMPLETION_REPAIRS,
&HashSet::default(), &HashSet::default(),
None, &mut RepairTiming::default(),
None, &mut BestRepairsStats::default(),
), ),
vec![ vec![
ShredRepairType::Orphan(2), ShredRepairType::Orphan(2),
@ -845,8 +845,8 @@ mod test {
MAX_UNKNOWN_LAST_INDEX_REPAIRS, MAX_UNKNOWN_LAST_INDEX_REPAIRS,
MAX_CLOSEST_COMPLETION_REPAIRS, MAX_CLOSEST_COMPLETION_REPAIRS,
&HashSet::default(), &HashSet::default(),
None, &mut RepairTiming::default(),
None, &mut BestRepairsStats::default(),
), ),
vec![ShredRepairType::HighestShred(0, 0)] vec![ShredRepairType::HighestShred(0, 0)]
); );
@ -907,8 +907,8 @@ mod test {
MAX_UNKNOWN_LAST_INDEX_REPAIRS, MAX_UNKNOWN_LAST_INDEX_REPAIRS,
MAX_CLOSEST_COMPLETION_REPAIRS, MAX_CLOSEST_COMPLETION_REPAIRS,
&HashSet::default(), &HashSet::default(),
None, &mut RepairTiming::default(),
None, &mut BestRepairsStats::default(),
), ),
expected expected
); );
@ -923,8 +923,8 @@ mod test {
MAX_UNKNOWN_LAST_INDEX_REPAIRS, MAX_UNKNOWN_LAST_INDEX_REPAIRS,
MAX_CLOSEST_COMPLETION_REPAIRS, MAX_CLOSEST_COMPLETION_REPAIRS,
&HashSet::default(), &HashSet::default(),
None, &mut RepairTiming::default(),
None, &mut BestRepairsStats::default(),
)[..], )[..],
expected[0..expected.len() - 2] expected[0..expected.len() - 2]
); );
@ -969,8 +969,8 @@ mod test {
MAX_UNKNOWN_LAST_INDEX_REPAIRS, MAX_UNKNOWN_LAST_INDEX_REPAIRS,
MAX_CLOSEST_COMPLETION_REPAIRS, MAX_CLOSEST_COMPLETION_REPAIRS,
&HashSet::default(), &HashSet::default(),
None, &mut RepairTiming::default(),
None, &mut BestRepairsStats::default(),
), ),
expected expected
); );

View File

@ -157,8 +157,8 @@ impl RepairWeight {
max_unknown_last_index_repairs: usize, max_unknown_last_index_repairs: usize,
max_closest_completion_repairs: usize, max_closest_completion_repairs: usize,
ignore_slots: &impl Contains<'a, Slot>, ignore_slots: &impl Contains<'a, Slot>,
repair_timing: Option<&mut RepairTiming>, repair_timing: &mut RepairTiming,
stats: Option<&mut BestRepairsStats>, stats: &mut BestRepairsStats,
) -> Vec<ShredRepairType> { ) -> Vec<ShredRepairType> {
let mut repairs = vec![]; let mut repairs = vec![];
let mut processed_slots: HashSet<Slot> = vec![self.root].into_iter().collect(); let mut processed_slots: HashSet<Slot> = vec![self.root].into_iter().collect();
@ -227,24 +227,21 @@ impl RepairWeight {
repairs.extend(closest_completion_repairs); repairs.extend(closest_completion_repairs);
get_closest_completion_elapsed.stop(); get_closest_completion_elapsed.stop();
if let Some(stats) = stats { stats.update(
stats.update( num_orphan_slots as u64,
num_orphan_slots as u64, num_orphan_repairs as u64,
num_orphan_repairs as u64, num_best_shreds_slots as u64,
num_best_shreds_slots as u64, num_best_shreds_repairs as u64,
num_best_shreds_repairs as u64, num_unknown_last_index_slots as u64,
num_unknown_last_index_slots as u64, num_unknown_last_index_repairs as u64,
num_unknown_last_index_repairs as u64, num_closest_completion_slots as u64,
num_closest_completion_slots as u64, num_closest_completion_repairs as u64,
num_closest_completion_repairs as u64, );
); repair_timing.get_best_orphans_elapsed += get_best_orphans_elapsed.as_us();
} repair_timing.get_best_shreds_elapsed += get_best_shreds_elapsed.as_us();
if let Some(repair_timing) = repair_timing { repair_timing.get_unknown_last_index_elapsed += get_unknown_last_index_elapsed.as_us();
repair_timing.get_best_orphans_elapsed += get_best_orphans_elapsed.as_us(); repair_timing.get_closest_completion_elapsed += get_closest_completion_elapsed.as_us();
repair_timing.get_best_shreds_elapsed += get_best_shreds_elapsed.as_us();
repair_timing.get_unknown_last_index_elapsed += get_unknown_last_index_elapsed.as_us();
repair_timing.get_closest_completion_elapsed += get_closest_completion_elapsed.as_us();
}
repairs repairs
} }