log secondary index contents on startup (#24348)
This commit is contained in:
parent
8c9430359e
commit
b4fd9124bf
|
@ -7175,6 +7175,8 @@ impl AccountsDb {
|
||||||
timings.report();
|
timings.report();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.accounts_index.log_secondary_indexes();
|
||||||
|
|
||||||
IndexGenerationInfo {
|
IndexGenerationInfo {
|
||||||
accounts_data_len: accounts_data_len.load(Ordering::Relaxed),
|
accounts_data_len: accounts_data_len.load(Ordering::Relaxed),
|
||||||
}
|
}
|
||||||
|
|
|
@ -1408,6 +1408,22 @@ impl<T: IndexValue> AccountsIndex<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// log any secondary index counts, if non-zero
|
||||||
|
pub(crate) fn log_secondary_indexes(&self) {
|
||||||
|
if !self.program_id_index.index.is_empty() {
|
||||||
|
info!("secondary index: {:?}", AccountIndex::ProgramId);
|
||||||
|
self.program_id_index.log_contents();
|
||||||
|
}
|
||||||
|
if !self.spl_token_mint_index.index.is_empty() {
|
||||||
|
info!("secondary index: {:?}", AccountIndex::SplTokenMint);
|
||||||
|
self.spl_token_mint_index.log_contents();
|
||||||
|
}
|
||||||
|
if !self.spl_token_owner_index.index.is_empty() {
|
||||||
|
info!("secondary index: {:?}", AccountIndex::SplTokenOwner);
|
||||||
|
self.spl_token_owner_index.log_contents();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn update_secondary_indexes(
|
pub(crate) fn update_secondary_indexes(
|
||||||
&self,
|
&self,
|
||||||
pubkey: &Pubkey,
|
pubkey: &Pubkey,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use {
|
use {
|
||||||
dashmap::{mapref::entry::Entry::Occupied, DashMap},
|
dashmap::{mapref::entry::Entry::Occupied, DashMap},
|
||||||
|
log::*,
|
||||||
solana_sdk::{pubkey::Pubkey, timing::AtomicInterval},
|
solana_sdk::{pubkey::Pubkey, timing::AtomicInterval},
|
||||||
std::{
|
std::{
|
||||||
collections::HashSet,
|
collections::HashSet,
|
||||||
|
@ -223,4 +224,19 @@ impl<SecondaryIndexEntryType: SecondaryIndexEntry + Default + Sync + Send>
|
||||||
vec![]
|
vec![]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// log top 20 (owner, # accounts) in descending order of # accounts
|
||||||
|
pub fn log_contents(&self) {
|
||||||
|
let mut entries = self
|
||||||
|
.index
|
||||||
|
.iter()
|
||||||
|
.map(|entry| (entry.value().len(), *entry.key()))
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
entries.sort_unstable();
|
||||||
|
entries
|
||||||
|
.iter()
|
||||||
|
.rev()
|
||||||
|
.take(20)
|
||||||
|
.for_each(|(v, k)| info!("owner: {}, accounts: {}", k, v));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue