Add ref count from storage (#15078)

This commit is contained in:
sakridge
2021-02-04 09:11:05 -08:00
committed by GitHub
parent d87e0c3f1d
commit e5225b7e68
2 changed files with 7 additions and 1 deletions

View File

@ -4605,7 +4605,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>,