call set_startup and add metrics on generate_index (#20006)
This commit is contained in:
parent
db40d06a39
commit
742155c214
|
@ -219,6 +219,7 @@ struct GenerateIndexTimings {
|
||||||
pub storage_size_accounts_map_us: u64,
|
pub storage_size_accounts_map_us: u64,
|
||||||
pub storage_size_storages_us: u64,
|
pub storage_size_storages_us: u64,
|
||||||
pub storage_size_accounts_map_flatten_us: u64,
|
pub storage_size_accounts_map_flatten_us: u64,
|
||||||
|
pub index_flush_us: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug, PartialEq)]
|
#[derive(Default, Debug, PartialEq)]
|
||||||
|
@ -253,6 +254,7 @@ impl GenerateIndexTimings {
|
||||||
self.storage_size_accounts_map_flatten_us as i64,
|
self.storage_size_accounts_map_flatten_us as i64,
|
||||||
i64
|
i64
|
||||||
),
|
),
|
||||||
|
("index_flush_us", self.index_flush_us as i64, i64),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6408,6 +6410,9 @@ impl AccountsDb {
|
||||||
// verify checks that all the expected items are in the accounts index and measures how long it takes to look them all up
|
// verify checks that all the expected items are in the accounts index and measures how long it takes to look them all up
|
||||||
let passes = if verify { 2 } else { 1 };
|
let passes = if verify { 2 } else { 1 };
|
||||||
for pass in 0..passes {
|
for pass in 0..passes {
|
||||||
|
if pass == 0 {
|
||||||
|
self.accounts_index.set_startup(true);
|
||||||
|
}
|
||||||
let storage_info = StorageSizeAndCountMap::default();
|
let storage_info = StorageSizeAndCountMap::default();
|
||||||
let total_processed_slots_across_all_threads = AtomicU64::new(0);
|
let total_processed_slots_across_all_threads = AtomicU64::new(0);
|
||||||
let outer_slots_len = slots.len();
|
let outer_slots_len = slots.len();
|
||||||
|
@ -6496,7 +6501,17 @@ impl AccountsDb {
|
||||||
|
|
||||||
let storage_info_timings = storage_info_timings.into_inner().unwrap();
|
let storage_info_timings = storage_info_timings.into_inner().unwrap();
|
||||||
|
|
||||||
|
let mut index_flush_us = 0;
|
||||||
|
if pass == 0 {
|
||||||
|
// tell accounts index we are done adding the initial accounts at startup
|
||||||
|
let mut m = Measure::start("accounts_index_idle_us");
|
||||||
|
self.accounts_index.set_startup(false);
|
||||||
|
m.stop();
|
||||||
|
index_flush_us = m.as_us();
|
||||||
|
}
|
||||||
|
|
||||||
let mut timings = GenerateIndexTimings {
|
let mut timings = GenerateIndexTimings {
|
||||||
|
index_flush_us,
|
||||||
scan_time,
|
scan_time,
|
||||||
index_time: index_time.as_us(),
|
index_time: index_time.as_us(),
|
||||||
insertion_time_us: insertion_time_us.load(Ordering::Relaxed),
|
insertion_time_us: insertion_time_us.load(Ordering::Relaxed),
|
||||||
|
|
|
@ -1376,6 +1376,11 @@ impl<T: IndexValue> AccountsIndex<T> {
|
||||||
let iter = self.iter(Some(range), true);
|
let iter = self.iter(Some(range), true);
|
||||||
iter.hold_range_in_memory(range, start_holding);
|
iter.hold_range_in_memory(range, start_holding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_startup(&self, value: bool) {
|
||||||
|
self.storage.storage.set_startup(value);
|
||||||
|
}
|
||||||
|
|
||||||
/// Get an account
|
/// Get an account
|
||||||
/// The latest account that appears in `ancestors` or `roots` is returned.
|
/// The latest account that appears in `ancestors` or `roots` is returned.
|
||||||
pub(crate) fn get(
|
pub(crate) fn get(
|
||||||
|
|
|
@ -23,7 +23,7 @@ pub struct AccountsIndexStorage<T: IndexValue> {
|
||||||
handles: Option<Vec<JoinHandle<()>>>,
|
handles: Option<Vec<JoinHandle<()>>>,
|
||||||
|
|
||||||
// eventually the backing storage
|
// eventually the backing storage
|
||||||
storage: Arc<BucketMapHolder<T>>,
|
pub storage: Arc<BucketMapHolder<T>>,
|
||||||
pub in_mem: Vec<Arc<InMemAccountsIndex<T>>>,
|
pub in_mem: Vec<Arc<InMemAccountsIndex<T>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,9 +48,16 @@ impl<T: IndexValue> BucketMapHolder<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_startup(&self, value: bool) {
|
pub fn set_startup(&self, value: bool) {
|
||||||
|
if !value {
|
||||||
|
self.wait_for_idle();
|
||||||
|
}
|
||||||
self.startup.store(value, Ordering::Relaxed)
|
self.startup.store(value, Ordering::Relaxed)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn wait_for_idle(&self) {
|
||||||
|
assert!(self.get_startup());
|
||||||
|
}
|
||||||
|
|
||||||
pub fn current_age(&self) -> Age {
|
pub fn current_age(&self) -> Age {
|
||||||
self.age.load(Ordering::Relaxed)
|
self.age.load(Ordering::Relaxed)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue