diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 60347c5dde4e00..6167e603f63e4e 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5634,49 +5634,61 @@ impl Bank { .name("solBgHashVerify".into()) .spawn(move || { info!("Initial background accounts hash verification has started"); + let start = Instant::now(); + let mut accounts_lt_hash_time = None; if is_accounts_lt_hash_enabled { let accounts_db = &accounts_.accounts_db; - let (calculated_accounts_lt_hash, duration) = meas_dur!(accounts_db.thread_pool_hash.install(|| { - accounts_db - .calculate_accounts_lt_hash_at_startup_from_storages( + let (calculated_accounts_lt_hash, duration) = + meas_dur!(accounts_db.thread_pool_hash.install(|| { + accounts_db.calculate_accounts_lt_hash_at_startup_from_storages( snapshot_storages.0.as_slice(), &duplicates_lt_hash.unwrap(), ) - })); + })); if calculated_accounts_lt_hash != expected_accounts_lt_hash { error!( - "Verifying accounts lt hash failed: hashes do not match, expected: {}, calculated: {}", + "Verifying accounts lt hash failed: hashes do not match, \ + expected: {}, calculated: {}", expected_accounts_lt_hash.0.checksum(), calculated_accounts_lt_hash.0.checksum(), ); return false; } - datapoint_info!( - "startup_verify_accounts", - ("verify_accounts_lt_hash_us", duration.as_micros(), i64) - ); + accounts_lt_hash_time = Some(duration); } let snapshot_storages_and_slots = ( snapshot_storages.0.as_slice(), snapshot_storages.1.as_slice(), ); - let result = accounts_.verify_accounts_hash_and_lamports( - snapshot_storages_and_slots, - slot, - capitalization, - base, - VerifyAccountsHashAndLamportsConfig { - ancestors: &ancestors, - epoch_schedule: &epoch_schedule, - rent_collector: &rent_collector, - ..verify_config - }, - ); + let (result, accounts_hash_time) = meas_dur!(accounts_ + .verify_accounts_hash_and_lamports( + snapshot_storages_and_slots, + slot, + capitalization, + base, + VerifyAccountsHashAndLamportsConfig { + ancestors: &ancestors, + epoch_schedule: &epoch_schedule, + rent_collector: &rent_collector, + ..verify_config + }, + )); accounts_ .accounts_db .verify_accounts_hash_in_bg .background_finished(); + let total_time = start.elapsed(); + datapoint_info!( + "startup_verify_accounts", + ("total_us", total_time.as_micros(), i64), + ( + "verify_accounts_lt_hash_us", + accounts_lt_hash_time.as_ref().map(Duration::as_micros), + Option + ), + ("verify_accounts_hash_us", accounts_hash_time.as_micros(), i64), + ); info!("Initial background accounts hash verification has stopped"); result })