Add ref count from storage (#15078) (#15092)

(cherry picked from commit e5225b7e68)

Co-authored-by: sakridge <sakridge@gmail.com>
This commit is contained in:
mergify[bot]
2021-02-04 15:12:23 -08:00
committed by GitHub
parent 858ca752e2
commit 77d2ed95ff
2 changed files with 7 additions and 1 deletions

View File

@ -4629,7 +4629,7 @@ impl AccountsDB {
roots.sort();
info!("{}: accounts_index roots: {:?}", label, roots,);
for (pubkey, account_entry) in self.accounts_index.account_maps.read().unwrap().iter() {
info!(" key: {}", pubkey);
info!(" key: {} ref_count: {}", pubkey, account_entry.ref_count(),);
info!(
" slots: {:?}",
*account_entry.slot_list.read().unwrap()

View File

@ -78,6 +78,12 @@ pub struct AccountMapEntryInner<T> {
pub slot_list: RwLock<SlotList<T>>,
}
impl<T> AccountMapEntryInner<T> {
pub fn ref_count(&self) -> u64 {
self.ref_count.load(Ordering::Relaxed)
}
}
#[self_referencing]
pub struct ReadAccountMapEntry<T: 'static> {
owned_entry: AccountMapEntry<T>,