abs purge slots in parallel (#32536)

* abs purge slots in parallel

* remove arc clone
This commit is contained in:
Jeff Washington (jwash) 2023-07-31 09:22:53 -07:00 committed by GitHub
parent 0dd4c208e6
commit 91fd2a3a93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 9 deletions

View File

@ -17,6 +17,7 @@ use {
crossbeam_channel::{Receiver, SendError, Sender}, crossbeam_channel::{Receiver, SendError, Sender},
log::*, log::*,
rand::{thread_rng, Rng}, rand::{thread_rng, Rng},
rayon::iter::{IntoParallelIterator, ParallelIterator},
solana_measure::measure::Measure, solana_measure::measure::Measure,
solana_sdk::clock::{BankId, Slot}, solana_sdk::clock::{BankId, Slot},
stats::StatsManager, stats::StatsManager,
@ -499,15 +500,19 @@ pub struct PrunedBanksRequestHandler {
impl PrunedBanksRequestHandler { impl PrunedBanksRequestHandler {
pub fn handle_request(&self, bank: &Bank, is_serialized_with_abs: bool) -> usize { pub fn handle_request(&self, bank: &Bank, is_serialized_with_abs: bool) -> usize {
let mut count = 0; let slots = self.pruned_banks_receiver.try_iter().collect::<Vec<_>>();
for (pruned_slot, pruned_bank_id) in self.pruned_banks_receiver.try_iter() { let count = slots.len();
count += 1; bank.rc.accounts.accounts_db.thread_pool_clean.install(|| {
bank.rc.accounts.accounts_db.purge_slot( slots
pruned_slot, .into_par_iter()
pruned_bank_id, .for_each(|(pruned_slot, pruned_bank_id)| {
is_serialized_with_abs, bank.rc.accounts.accounts_db.purge_slot(
); pruned_slot,
} pruned_bank_id,
is_serialized_with_abs,
);
});
});
count count
} }