Skip to content

Commit

Permalink
Adds more metrics for startup accounts verification (#3158)
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo authored Oct 14, 2024
1 parent a66b023 commit 715f49f
Showing 1 changed file with 33 additions and 21 deletions.
54 changes: 33 additions & 21 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<i64>
),
("verify_accounts_hash_us", accounts_hash_time.as_micros(), i64),
);
info!("Initial background accounts hash verification has stopped");
result
})
Expand Down

0 comments on commit 715f49f

Please sign in to comment.