calculate_accounts_hash does not throttle threads on startup (#17338)
This commit is contained in:
committed by
GitHub
parent
a9aa533684
commit
9b74988fc6
@ -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.
|
// 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 chunks = crate::accounts_hash::MERKLE_FANOUT.pow(4);
|
||||||
let total_lamports = Mutex::<u64>::new(0);
|
let total_lamports = Mutex::<u64>::new(0);
|
||||||
let hashes: Vec<Vec<Hash>> = {
|
let get_hashes = || {
|
||||||
self.thread_pool_clean.install(|| {
|
|
||||||
keys.par_chunks(chunks)
|
keys.par_chunks(chunks)
|
||||||
.map(|pubkeys| {
|
.map(|pubkeys| {
|
||||||
let mut sum = 0u128;
|
let mut sum = 0u128;
|
||||||
@ -4033,9 +4032,13 @@ impl AccountsDb {
|
|||||||
*total =
|
*total =
|
||||||
AccountsHash::checked_cast_for_capitalization(*total as u128 + sum);
|
AccountsHash::checked_cast_for_capitalization(*total as u128 + sum);
|
||||||
result
|
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 {
|
if mismatch_found.load(Ordering::Relaxed) > 0 {
|
||||||
warn!(
|
warn!(
|
||||||
|
Reference in New Issue
Block a user