Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

datapoint for verify_snapshot_bank (backport #17306) #17339

Merged
merged 1 commit into from
May 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4415,12 +4415,36 @@ impl Bank {
/// A snapshot bank should be purged of 0 lamport accounts which are not part of the hash
/// calculation and could shield other real accounts.
pub fn verify_snapshot_bank(&self) -> bool {
let mut clean_time = Measure::start("clean");
if self.slot() > 0 {
self.clean_accounts(true);
}
clean_time.stop();

let mut shrink_all_slots_time = Measure::start("shrink_all_slots");
if self.slot() > 0 {
self.shrink_all_slots();
}
shrink_all_slots_time.stop();

let mut verify_time = Measure::start("verify_bank_hash");
let mut verify = self.verify_bank_hash();
verify_time.stop();

let mut verify2_time = Measure::start("verify_hash");
// Order and short-circuiting is significant; verify_hash requires a valid bank hash
self.verify_bank_hash() && self.verify_hash()
verify = verify && self.verify_hash();
verify2_time.stop();

datapoint_info!(
"verify_snapshot_bank",
("clean_us", clean_time.as_us(), i64),
("shrink_all_slots_us", shrink_all_slots_time.as_us(), i64),
("verify_bank_hash_us", verify_time.as_us(), i64),
("verify_hash_us", verify2_time.as_us(), i64),
);

verify
}

/// Return the number of hashes per tick
Expand Down