AcctIdx: separate account index by startup and !startup (#20711)

This commit is contained in:
Jeff Washington (jwash) 2021-10-15 13:04:32 -05:00 committed by GitHub
parent 9d62963240
commit 5a6d732d48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -2,7 +2,7 @@ use crate::accounts_index::IndexValue;
use crate::bucket_map_holder::BucketMapHolder;
use solana_sdk::timing::{timestamp, AtomicInterval};
use std::fmt::Debug;
use std::sync::atomic::{AtomicU64, AtomicU8, Ordering};
use std::sync::atomic::{AtomicBool, AtomicU64, AtomicU8, Ordering};
// stats logged every 10 s
const STATS_INTERVAL_MS: u64 = 10_000;
@ -42,6 +42,7 @@ pub struct BucketMapHolderStats {
pub flush_scan_update_us: AtomicU64,
pub flush_remove_us: AtomicU64,
pub flush_grow_us: AtomicU64,
last_was_startup: AtomicBool,
last_time: AtomicInterval,
}
@ -150,8 +151,15 @@ impl BucketMapHolderStats {
let in_mem_stats = Self::get_stats(in_mem_per_bucket_counts);
let disk_stats = Self::get_stats(disk_per_bucket_counts);
// all metrics during startup are written to a different data point
let startup = storage.get_startup();
let was_startup = self.last_was_startup.swap(startup, Ordering::Relaxed);
datapoint_info!(
"accounts_index",
if startup || was_startup {
"accounts_index_startup"
} else {
"accounts_index"
},
(
"count_in_mem",
self.count_in_mem.load(Ordering::Relaxed),