From 37d6f5013f0cfaace474e4f24a0cc6933de31f2b Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" <75863576+jeffwashington@users.noreply.github.com> Date: Fri, 17 Sep 2021 11:39:41 -0500 Subject: [PATCH] AcctIdx: initialize acct idx by config (#19968) --- runtime/src/accounts_index.rs | 3 ++- runtime/src/accounts_index_storage.rs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/runtime/src/accounts_index.rs b/runtime/src/accounts_index.rs index 432f0cdcb..8324cdbea 100644 --- a/runtime/src/accounts_index.rs +++ b/runtime/src/accounts_index.rs @@ -764,11 +764,12 @@ impl AccountsIndex { AccountsIndexStorage, ) { let bins = config + .as_ref() .and_then(|config| config.bins) .unwrap_or(BINS_DEFAULT); // create bin_calculator early to verify # bins is reasonable let bin_calculator = PubkeyBinCalculator16::new(bins); - let storage = AccountsIndexStorage::new(bins); + let storage = AccountsIndexStorage::new(bins, &config); let account_maps = (0..bins) .into_iter() .map(|bin| RwLock::new(Arc::clone(&storage.in_mem[bin]))) diff --git a/runtime/src/accounts_index_storage.rs b/runtime/src/accounts_index_storage.rs index 60014234b..3d22f311b 100644 --- a/runtime/src/accounts_index_storage.rs +++ b/runtime/src/accounts_index_storage.rs @@ -1,4 +1,4 @@ -use crate::accounts_index::IndexValue; +use crate::accounts_index::{AccountsIndexConfig, IndexValue}; use crate::bucket_map_holder::BucketMapHolder; use crate::in_mem_accounts_index::InMemAccountsIndex; use crate::waitable_condvar::WaitableCondvar; @@ -44,7 +44,7 @@ impl Drop for AccountsIndexStorage { } impl AccountsIndexStorage { - pub fn new(bins: usize) -> AccountsIndexStorage { + pub fn new(bins: usize, _config: &Option) -> AccountsIndexStorage { let storage = Arc::new(BucketMapHolder::new(bins)); let in_mem = (0..bins)