calculate_accounts_hash does not throttle threads on startup (#17338)

This commit is contained in:
Jeff Washington (jwash)
2021-05-20 10:25:54 -05:00
committed by GitHub
parent a9aa533684
commit 9b74988fc6

View File

@ -3973,8 +3973,7 @@ impl AccountsDb {
// We'll also accumulate the lamports within each chunk and fewer chunks results in less contention to accumulate the sum.
let chunks = crate::accounts_hash::MERKLE_FANOUT.pow(4);
let total_lamports = Mutex::<u64>::new(0);
let hashes: Vec<Vec<Hash>> = {
self.thread_pool_clean.install(|| {
let get_hashes = || {
keys.par_chunks(chunks)
.map(|pubkeys| {
let mut sum = 0u128;
@ -4033,9 +4032,13 @@ impl AccountsDb {
*total =
AccountsHash::checked_cast_for_capitalization(*total as u128 + sum);
result
})
.collect()
})
}).collect()
};
let hashes: Vec<Vec<Hash>> = if check_hash {
get_hashes()
} else {
self.thread_pool_clean.install(get_hashes)
};
if mismatch_found.load(Ordering::Relaxed) > 0 {
warn!(