abs purge slots in parallel (#32536)
* abs purge slots in parallel * remove arc clone
This commit is contained in:
parent
0dd4c208e6
commit
91fd2a3a93
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue