Refactor purge_slots_from_cache_and_store() and handle_reclaims() (#17319)

This commit is contained in:
carllin
2021-05-24 13:51:17 -07:00
committed by GitHub
parent 41ec1c8d50
commit d8bc56fa51
6 changed files with 323 additions and 247 deletions

View File

@@ -263,11 +263,12 @@ impl AbsRequestHandler {
})
}
pub fn handle_pruned_banks(&self, bank: &Bank) -> usize {
/// `is_from_abs` is true if the caller is the AccountsBackgroundService
pub fn handle_pruned_banks(&self, bank: &Bank, is_from_abs: bool) -> usize {
let mut count = 0;
for pruned_slot in self.pruned_banks_receiver.try_iter() {
count += 1;
bank.rc.accounts.purge_slot(pruned_slot);
bank.rc.accounts.purge_slot(pruned_slot, is_from_abs);
}
count
@@ -393,7 +394,7 @@ impl AccountsBackgroundService {
total_remove_slots_time: &mut u64,
) {
let mut remove_slots_time = Measure::start("remove_slots_time");
*removed_slots_count += request_handler.handle_pruned_banks(&bank);
*removed_slots_count += request_handler.handle_pruned_banks(&bank, true);
remove_slots_time.stop();
*total_remove_slots_time += remove_slots_time.as_us();