calc hash uses self.thread_pool_clean (#23881)

This commit is contained in:
Jeff Washington (jwash)
2022-03-23 20:52:38 -05:00
committed by GitHub
parent 6428602cd9
commit 3e22d4b286
3 changed files with 11 additions and 31 deletions

View File

@ -6,11 +6,9 @@
use {
crossbeam_channel::RecvTimeoutError,
rayon::ThreadPool,
solana_gossip::cluster_info::{ClusterInfo, MAX_SNAPSHOT_HASHES},
solana_measure::measure::Measure,
solana_runtime::{
accounts_db,
accounts_hash::{CalcAccountsHashConfig, HashStats},
snapshot_config::SnapshotConfig,
snapshot_package::{
@ -54,7 +52,6 @@ impl AccountsHashVerifier {
.name("solana-hash-accounts".to_string())
.spawn(move || {
let mut hashes = vec![];
let mut thread_pool = None;
loop {
if exit.load(Ordering::Relaxed) {
break;
@ -62,11 +59,6 @@ impl AccountsHashVerifier {
match accounts_package_receiver.recv_timeout(Duration::from_secs(1)) {
Ok(accounts_package) => {
if accounts_package.hash_for_testing.is_some() && thread_pool.is_none()
{
thread_pool = Some(accounts_db::make_min_priority_thread_pool());
}
Self::process_accounts_package(
accounts_package,
&cluster_info,
@ -77,7 +69,6 @@ impl AccountsHashVerifier {
&exit,
fault_injection_rate_slots,
snapshot_config.as_ref(),
thread_pool.as_ref(),
&ledger_path,
);
}
@ -103,10 +94,9 @@ impl AccountsHashVerifier {
exit: &Arc<AtomicBool>,
fault_injection_rate_slots: u64,
snapshot_config: Option<&SnapshotConfig>,
thread_pool: Option<&ThreadPool>,
ledger_path: &Path,
) {
Self::verify_accounts_package_hash(&accounts_package, thread_pool, ledger_path);
Self::verify_accounts_package_hash(&accounts_package, ledger_path);
Self::push_accounts_hashes_to_cluster(
&accounts_package,
@ -121,11 +111,7 @@ impl AccountsHashVerifier {
Self::submit_for_packaging(accounts_package, pending_snapshot_package, snapshot_config);
}
fn verify_accounts_package_hash(
accounts_package: &AccountsPackage,
thread_pool: Option<&ThreadPool>,
ledger_path: &Path,
) {
fn verify_accounts_package_hash(accounts_package: &AccountsPackage, ledger_path: &Path) {
let mut measure_hash = Measure::start("hash");
if let Some(expected_hash) = accounts_package.hash_for_testing {
let sorted_storages = SortedStorages::new(&accounts_package.snapshot_storages);
@ -135,7 +121,7 @@ impl AccountsHashVerifier {
.calculate_accounts_hash_without_index(&mut CalcAccountsHashConfig {
accounts_hash_cache_path: ledger_path,
storages: &sorted_storages,
thread_pool,
use_bg_thread_pool: true,
stats: HashStats::default(),
check_hash: false,
accounts_cache_and_ancestors: None,
@ -387,7 +373,6 @@ mod tests {
&exit,
0,
Some(&snapshot_config),
None,
ledger_path.path(),
);