Cache account stores, flush from AccountsBackgroundService (#13140)

This commit is contained in:
carllin
2021-01-11 17:00:23 -08:00
committed by GitHub
parent 4a66e3eddc
commit 6dfad0652f
25 changed files with 2604 additions and 833 deletions

View File

@ -69,6 +69,7 @@ pub fn load(
process_options.debug_keys.clone(),
Some(&crate::builtins::get(process_options.bpf_jit)),
process_options.account_indexes.clone(),
process_options.accounts_db_caching_enabled,
)
.expect("Load from snapshot failed");
if let Some(shrink_paths) = shrink_paths {

View File

@ -346,6 +346,7 @@ pub struct ProcessOptions {
pub frozen_accounts: Vec<Pubkey>,
pub debug_keys: Option<Arc<HashSet<Pubkey>>>,
pub account_indexes: HashSet<AccountIndex>,
pub accounts_db_caching_enabled: bool,
}
pub fn process_blockstore(
@ -371,6 +372,7 @@ pub fn process_blockstore(
opts.debug_keys.clone(),
Some(&crate::builtins::get(opts.bpf_jit)),
opts.account_indexes.clone(),
opts.accounts_db_caching_enabled,
);
let bank0 = Arc::new(bank0);
info!("processing ledger for slot 0...");
@ -929,6 +931,8 @@ fn load_frozen_forks(
new_root_bank.squash();
if last_free.elapsed() > Duration::from_secs(10) {
// Must be called after `squash()`, so that AccountsDb knows what
// the roots are for the cache flushing in exhaustively_free_unused_resource().
// This could take few secs; so update last_free later
new_root_bank.exhaustively_free_unused_resource();
last_free = Instant::now();
@ -2901,6 +2905,7 @@ pub mod tests {
None,
None,
HashSet::new(),
false,
);
*bank.epoch_schedule()
}