diff --git a/runtime/src/accounts_index.rs b/runtime/src/accounts_index.rs index fe84149c67..ba38f700c8 100644 --- a/runtime/src/accounts_index.rs +++ b/runtime/src/accounts_index.rs @@ -742,7 +742,7 @@ impl AccountsIndex { .unwrap_or(BINS_DEFAULT); // create bin_calculator early to verify # bins is reasonable let bin_calculator = PubkeyBinCalculator16::new(bins); - let storage = AccountsIndexStorage::new(); + let storage = AccountsIndexStorage::new(bins); let account_maps = (0..bins) .into_iter() .map(|bin| RwLock::new(Arc::new(InMemAccountsIndex::new(&storage, bin)))) diff --git a/runtime/src/accounts_index_storage.rs b/runtime/src/accounts_index_storage.rs index f2ad251d9a..5adcb3f29d 100644 --- a/runtime/src/accounts_index_storage.rs +++ b/runtime/src/accounts_index_storage.rs @@ -14,8 +14,6 @@ use std::{ // Also manages the lifetime of the background processing threads. // When this instance is dropped, it will drop the bucket map and cleanup // and it will stop all the background threads and join them. - -#[derive(Default)] pub struct AccountsIndexStorage { // for managing the bg threads exit: Arc, @@ -43,8 +41,8 @@ impl Drop for AccountsIndexStorage { } impl AccountsIndexStorage { - pub fn new() -> AccountsIndexStorage { - let storage = Arc::new(BucketMapHolder::new()); + pub fn new(bins: usize) -> AccountsIndexStorage { + let storage = Arc::new(BucketMapHolder::new(bins)); let storage_ = storage.clone(); let exit = Arc::new(AtomicBool::default()); let exit_ = exit.clone(); diff --git a/runtime/src/bucket_map_holder.rs b/runtime/src/bucket_map_holder.rs index 4d78acf9e1..eaf9c00bd2 100644 --- a/runtime/src/bucket_map_holder.rs +++ b/runtime/src/bucket_map_holder.rs @@ -7,7 +7,6 @@ use std::sync::Arc; use std::time::Duration; // will eventually hold the bucket map -#[derive(Default)] pub struct BucketMapHolder { pub stats: BucketMapHolderStats, _phantom: std::marker::PhantomData, @@ -20,8 +19,11 @@ impl Debug for BucketMapHolder { } impl BucketMapHolder { - pub fn new() -> Self { - Self::default() + pub fn new(_bins: usize) -> Self { + Self { + stats: BucketMapHolderStats::default(), + _phantom: std::marker::PhantomData::::default(), + } } // intended to execute in a bg thread diff --git a/runtime/src/in_mem_accounts_index.rs b/runtime/src/in_mem_accounts_index.rs index 4bb3a086f2..3a652da5a3 100644 --- a/runtime/src/in_mem_accounts_index.rs +++ b/runtime/src/in_mem_accounts_index.rs @@ -41,10 +41,6 @@ impl InMemAccountsIndex { &self.map_internal } - pub fn new_bucket_map_holder() -> Arc> { - Arc::new(BucketMapHolder::new()) - } - pub fn items(&self, range: &Option<&R>) -> Vec<(K, AccountMapEntry)> where R: RangeBounds + std::fmt::Debug,