diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index 643575d582..79afd64aef 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -8627,7 +8627,7 @@ impl AccountsDb { let mut lookup_time = Measure::start("lookup_time"); for account in accounts_map.into_iter() { let (key, account_info) = account; - let lock = self.accounts_index.get_account_maps_read_lock(&key); + let lock = self.accounts_index.get_bin(&key); let x = lock.get(&key).unwrap(); let sl = x.slot_list.read().unwrap(); let mut count = 0; diff --git a/runtime/src/accounts_index.rs b/runtime/src/accounts_index.rs index e707635aa6..584e09916a 100644 --- a/runtime/src/accounts_index.rs +++ b/runtime/src/accounts_index.rs @@ -1111,7 +1111,7 @@ impl AccountsIndex { } pub fn get_account_read_entry(&self, pubkey: &Pubkey) -> Option> { - let lock = self.get_account_maps_read_lock(pubkey); + let lock = self.get_bin(pubkey); self.get_account_read_entry_with_lock(pubkey, &lock) } @@ -1129,7 +1129,7 @@ impl AccountsIndex { pubkey: &Pubkey, user: impl for<'a> FnOnce(&mut RwLockWriteGuard<'a, SlotList>) -> RT, ) -> Option { - let read_lock = self.get_account_maps_read_lock(pubkey); + let read_lock = self.get_bin(pubkey); read_lock.slot_list_mut(pubkey, user) } @@ -1140,7 +1140,7 @@ impl AccountsIndex { ) { if !dead_keys.is_empty() { for key in dead_keys.iter() { - let w_index = self.get_account_maps_read_lock(key); + let w_index = self.get_bin(key); if w_index.remove_if_slot_list_empty(**key) { // Note it's only safe to remove all the entries for this key // because we have the lock for this key's entry in the AccountsIndex, @@ -1407,7 +1407,7 @@ impl AccountsIndex { ancestors: Option<&Ancestors>, max_root: Option, ) -> AccountIndexGetResult { - let read_lock = self.get_account_maps_read_lock(pubkey); + let read_lock = self.get_bin(pubkey); let account = read_lock .get(pubkey) .map(ReadAccountMapEntry::from_account_map_entry); @@ -1536,7 +1536,7 @@ impl AccountsIndex { ); } - pub(crate) fn get_account_maps_read_lock(&self, pubkey: &Pubkey) -> AccountMapsReadLock { + pub(crate) fn get_bin(&self, pubkey: &Pubkey) -> AccountMapsReadLock { &self.account_maps[self.bin_calculator.bin_from_pubkey(pubkey)] } @@ -1662,19 +1662,19 @@ impl AccountsIndex { &self.storage.storage, store_raw, ); - let map = self.get_account_maps_read_lock(pubkey); + let map = self.get_bin(pubkey); map.upsert(pubkey, new_item, Some(old_slot), reclaims, reclaim); self.update_secondary_indexes(pubkey, account, account_indexes); } pub fn unref_from_storage(&self, pubkey: &Pubkey) { - let map = self.get_account_maps_read_lock(pubkey); + let map = self.get_bin(pubkey); map.unref(pubkey) } pub fn ref_count_from_storage(&self, pubkey: &Pubkey) -> RefCount { - let map = self.get_account_maps_read_lock(pubkey); + let map = self.get_bin(pubkey); map.get_internal(pubkey, |entry| { ( false, @@ -1751,7 +1751,7 @@ impl AccountsIndex { // locked and inserted the pubkey in-between when `is_slot_list_empty=true` and the call to // remove() below. if is_slot_list_empty { - let w_maps = self.get_account_maps_read_lock(pubkey); + let w_maps = self.get_bin(pubkey); w_maps.remove_if_slot_list_empty(*pubkey); } } @@ -2641,7 +2641,7 @@ pub mod tests { for lock in &[false, true] { let read_lock = if *lock { - Some(index.get_account_maps_read_lock(&key)) + Some(index.get_bin(&key)) } else { None }; @@ -2696,7 +2696,7 @@ pub mod tests { assert_eq!((slot, account_info), new_entry.clone().into()); assert_eq!(0, account_maps_stats_len(&index)); - let r_account_maps = index.get_account_maps_read_lock(&key.pubkey()); + let r_account_maps = index.get_bin(&key.pubkey()); r_account_maps.upsert( &key.pubkey(), new_entry,