AcctIdx: initialize acct idx by config (#19968)

This commit is contained in:
Jeff Washington (jwash) 2021-09-17 11:39:41 -05:00 committed by GitHub
parent 1ec22572f2
commit 37d6f5013f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -764,11 +764,12 @@ impl<T: IndexValue> AccountsIndex<T> {
AccountsIndexStorage<T>,
) {
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])))

View File

@ -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<T: IndexValue> Drop for AccountsIndexStorage<T> {
}
impl<T: IndexValue> AccountsIndexStorage<T> {
pub fn new(bins: usize) -> AccountsIndexStorage<T> {
pub fn new(bins: usize, _config: &Option<AccountsIndexConfig>) -> AccountsIndexStorage<T> {
let storage = Arc::new(BucketMapHolder::new(bins));
let in_mem = (0..bins)