Poh timing service (#23736)

* initial work for poh timing report service

* add poh_timing_report_service to validator

* fix comments

* clippy

* imrove test coverage

* delete record when complete

* rename shred full to slot full.

* debug logging

* fix slot full

* remove debug comments

* adding fmt trait

* derive default

* default for poh timing reporter

* better comments

* remove commented code

* fix test

* more test fixes

* delete timestamps for slot that are older than root_slot

* debug log

* record poh start end in bank reset

* report full to start time instead

* fix poh slot offset

* report poh start for normal ticks

* fix typo

* refactor out poh point report fn

* rename

* optimize delete - delete only when last_root changed

* change log level to trace

* convert if to match

* remove redudant check

* fix SlotPohTiming comments

* review feedback on poh timing reporter

* review feedback on poh_recorder

* add test case for out-of-order arrival of timing points and incomplete timing points

* refactor poh_timing_points into its own mod

* remove option for poh_timing_report service

* move poh_timing_point_sender to constructor

* clippy

* better comments

* more clippy

* more clippy

* add slot poh timing point macro

* clippy

* assert in test

* comments and display fmt

* fix check

* assert format

* revise comments

* refactor

* extrac send fn

* revert reporting_poh_timing_point

* align loggin

* small refactor

* move type declaration to the top of the module

* replace macro with constructor

* clippy: remove redundant closure

* review comments

* simplify poh timing point creation

Co-authored-by: Haoran Yi <hyi@Haorans-MacBook-Air.local>
This commit is contained in:
HaoranYi
2022-03-30 09:04:49 -05:00
committed by GitHub
parent cda3d66b21
commit ba770832d0
8 changed files with 649 additions and 3 deletions

View File

@ -27,7 +27,10 @@ use {
rocksdb::DBRawIterator,
solana_entry::entry::{create_ticks, Entry},
solana_measure::measure::Measure,
solana_metrics::{datapoint_debug, datapoint_error},
solana_metrics::{
datapoint_debug, datapoint_error,
poh_timing_point::{send_poh_timing_point, PohTimingSender, SlotPohTimingInfo},
},
solana_rayon_threadlimit::get_thread_count,
solana_runtime::hardened_unpack::{unpack_genesis_archive, MAX_GENESIS_ARCHIVE_UNPACKED_SIZE},
solana_sdk::{
@ -173,6 +176,7 @@ pub struct Blockstore {
insert_shreds_lock: Mutex<()>,
pub new_shreds_signals: Vec<Sender<bool>>,
pub completed_slots_senders: Vec<CompletedSlotsSender>,
pub shred_timing_point_sender: Option<PohTimingSender>,
pub lowest_cleanup_slot: RwLock<Slot>,
no_compaction: bool,
slots_stats: Mutex<SlotsStats>,
@ -442,6 +446,7 @@ impl Blockstore {
bank_hash_cf,
new_shreds_signals: vec![],
completed_slots_senders: vec![],
shred_timing_point_sender: None,
insert_shreds_lock: Mutex::<()>::default(),
last_root,
lowest_cleanup_slot: RwLock::<Slot>::default(),
@ -1548,6 +1553,20 @@ impl Blockstore {
.unwrap_or_default()
}
/// send slot full timing point to poh_timing_report service
fn send_slot_full_timing(&self, slot: Slot) {
if let Some(ref sender) = self.shred_timing_point_sender {
send_poh_timing_point(
sender,
SlotPohTimingInfo::new_slot_full_poh_time_point(
slot,
Some(self.last_root()),
solana_sdk::timing::timestamp(),
),
);
}
}
fn insert_data_shred(
&self,
slot_meta: &mut SlotMeta,
@ -1619,7 +1638,14 @@ impl Blockstore {
slots_stats.set_full(slot_meta);
}
}
// slot is full, send slot full timing to poh_timing_report service.
if slot_meta.is_full() {
self.send_slot_full_timing(slot);
}
trace!("inserted shred into slot {:?} and index {:?}", slot, index);
Ok(newly_completed_data_sets)
}