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

@ -35,8 +35,7 @@ use solana_rpc::{
};
use solana_runtime::{
accounts_background_service::{
AbsRequestHandler, AbsRequestSender, AccountsBackgroundService, SendDroppedBankCallback,
SnapshotRequestHandler,
AbsRequestHandler, AbsRequestSender, AccountsBackgroundService, SnapshotRequestHandler,
},
bank_forks::{BankForks, SnapshotConfig},
commitment::BlockCommitmentCache,
@ -235,10 +234,18 @@ impl Tvu {
let (pruned_banks_sender, pruned_banks_receiver) = unbounded();
// Before replay starts, set the callbacks in each of the banks in BankForks
// Note after this callback is created, only the AccountsBackgroundService should be calling
// AccountsDb::purge_slot() to clean up dropped banks.
let callback = bank_forks
.read()
.unwrap()
.root_bank()
.rc
.accounts
.accounts_db
.create_drop_bank_callback(pruned_banks_sender);
for bank in bank_forks.read().unwrap().banks().values() {
bank.set_callback(Some(Box::new(SendDroppedBankCallback::new(
pruned_banks_sender.clone(),
))));
bank.set_callback(Some(Box::new(callback.clone())));
}
let accounts_background_request_sender = AbsRequestSender::new(snapshot_request_sender);