Improves logs in bank verification at startup (#30671)
* Improves logs in bank verification at startup * pr: should_clean
This commit is contained in:
parent
94ef881de0
commit
64f583b37d
|
@ -7274,62 +7274,75 @@ impl Bank {
|
||||||
accounts_db_skip_shrink: bool,
|
accounts_db_skip_shrink: bool,
|
||||||
last_full_snapshot_slot: Slot,
|
last_full_snapshot_slot: Slot,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let mut clean_time = Measure::start("clean");
|
let (_, clean_time_us) = measure_us!({
|
||||||
if !accounts_db_skip_shrink && self.slot() > 0 {
|
let should_clean = !accounts_db_skip_shrink && self.slot() > 0;
|
||||||
info!("cleaning..");
|
if should_clean {
|
||||||
self.rc
|
info!("Cleaning...");
|
||||||
.accounts
|
self.rc.accounts.accounts_db.clean_accounts(
|
||||||
.accounts_db
|
None,
|
||||||
.clean_accounts(None, true, Some(last_full_snapshot_slot));
|
true,
|
||||||
|
Some(last_full_snapshot_slot),
|
||||||
|
);
|
||||||
|
info!("Cleaning... Done.");
|
||||||
|
} else {
|
||||||
|
info!("Cleaning... Skipped.");
|
||||||
}
|
}
|
||||||
clean_time.stop();
|
});
|
||||||
|
|
||||||
let mut shrink_all_slots_time = Measure::start("shrink_all_slots");
|
let (_, shrink_time_us) = measure_us!({
|
||||||
if !accounts_db_skip_shrink && self.slot() > 0 {
|
let should_shrink = !accounts_db_skip_shrink && self.slot() > 0;
|
||||||
info!("shrinking..");
|
if should_shrink {
|
||||||
|
info!("Shrinking...");
|
||||||
self.rc
|
self.rc
|
||||||
.accounts
|
.accounts
|
||||||
.accounts_db
|
.accounts_db
|
||||||
.shrink_all_slots(true, Some(last_full_snapshot_slot));
|
.shrink_all_slots(true, Some(last_full_snapshot_slot));
|
||||||
|
info!("Shrinking... Done.");
|
||||||
|
} else {
|
||||||
|
info!("Shrinking... Skipped.");
|
||||||
}
|
}
|
||||||
shrink_all_slots_time.stop();
|
});
|
||||||
|
|
||||||
let (mut verify, verify_time_us) = if !self.rc.accounts.accounts_db.skip_initial_hash_calc {
|
let (verified_accounts, verify_accounts_time_us) = measure_us!({
|
||||||
info!("verify_bank_hash..");
|
let should_verify_accounts = !self.rc.accounts.accounts_db.skip_initial_hash_calc;
|
||||||
let mut verify_time = Measure::start("verify_bank_hash");
|
if should_verify_accounts {
|
||||||
let verify = self.verify_bank_hash(VerifyBankHash {
|
info!("Verifying accounts...");
|
||||||
|
let verified = self.verify_bank_hash(VerifyBankHash {
|
||||||
test_hash_calculation,
|
test_hash_calculation,
|
||||||
ignore_mismatch: false,
|
ignore_mismatch: false,
|
||||||
require_rooted_bank: false,
|
require_rooted_bank: false,
|
||||||
run_in_background: true,
|
run_in_background: true,
|
||||||
store_hash_raw_data_for_debug: false,
|
store_hash_raw_data_for_debug: false,
|
||||||
});
|
});
|
||||||
verify_time.stop();
|
info!("Verifying accounts... In background.");
|
||||||
(verify, verify_time.as_us())
|
verified
|
||||||
} else {
|
} else {
|
||||||
|
info!("Verifying accounts... Skipped.");
|
||||||
self.rc
|
self.rc
|
||||||
.accounts
|
.accounts
|
||||||
.accounts_db
|
.accounts_db
|
||||||
.verify_accounts_hash_in_bg
|
.verify_accounts_hash_in_bg
|
||||||
.verification_complete();
|
.verification_complete();
|
||||||
(true, 0)
|
true
|
||||||
};
|
}
|
||||||
|
});
|
||||||
|
|
||||||
info!("verify_hash..");
|
let (verified_bank, verify_bank_time_us) = measure_us!({
|
||||||
let mut verify2_time = Measure::start("verify_hash");
|
info!("Verifying bank...");
|
||||||
// Order and short-circuiting is significant; verify_hash requires a valid bank hash
|
let verified = self.verify_hash();
|
||||||
verify = verify && self.verify_hash();
|
info!("Verifying bank... Done.");
|
||||||
verify2_time.stop();
|
verified
|
||||||
|
});
|
||||||
|
|
||||||
datapoint_info!(
|
datapoint_info!(
|
||||||
"verify_snapshot_bank",
|
"verify_snapshot_bank",
|
||||||
("clean_us", clean_time.as_us(), i64),
|
("clean_us", clean_time_us, i64),
|
||||||
("shrink_all_slots_us", shrink_all_slots_time.as_us(), i64),
|
("shrink_us", shrink_time_us, i64),
|
||||||
("verify_bank_hash_us", verify_time_us, i64),
|
("verify_accounts_us", verify_accounts_time_us, i64),
|
||||||
("verify_hash_us", verify2_time.as_us(), i64),
|
("verify_bank_us", verify_bank_time_us, i64),
|
||||||
);
|
);
|
||||||
|
|
||||||
verify
|
verified_accounts && verified_bank
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the number of hashes per tick
|
/// Return the number of hashes per tick
|
||||||
|
|
Loading…
Reference in New Issue