HashCalc uses self.accounts_hash_cache_path (#23882)
This commit is contained in:
committed by
GitHub
parent
90009f330b
commit
db5d68f01f
@ -20,7 +20,6 @@ use {
|
||||
solana_sdk::{clock::Slot, hash::Hash, pubkey::Pubkey},
|
||||
std::{
|
||||
collections::{HashMap, HashSet},
|
||||
path::{Path, PathBuf},
|
||||
sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc,
|
||||
@ -44,7 +43,6 @@ impl AccountsHashVerifier {
|
||||
halt_on_known_validators_accounts_hash_mismatch: bool,
|
||||
fault_injection_rate_slots: u64,
|
||||
snapshot_config: Option<SnapshotConfig>,
|
||||
ledger_path: PathBuf,
|
||||
) -> Self {
|
||||
let exit = exit.clone();
|
||||
let cluster_info = cluster_info.clone();
|
||||
@ -69,7 +67,6 @@ impl AccountsHashVerifier {
|
||||
&exit,
|
||||
fault_injection_rate_slots,
|
||||
snapshot_config.as_ref(),
|
||||
&ledger_path,
|
||||
);
|
||||
}
|
||||
Err(RecvTimeoutError::Disconnected) => break,
|
||||
@ -94,9 +91,8 @@ impl AccountsHashVerifier {
|
||||
exit: &Arc<AtomicBool>,
|
||||
fault_injection_rate_slots: u64,
|
||||
snapshot_config: Option<&SnapshotConfig>,
|
||||
ledger_path: &Path,
|
||||
) {
|
||||
Self::verify_accounts_package_hash(&accounts_package, ledger_path);
|
||||
Self::verify_accounts_package_hash(&accounts_package);
|
||||
|
||||
Self::push_accounts_hashes_to_cluster(
|
||||
&accounts_package,
|
||||
@ -111,7 +107,7 @@ impl AccountsHashVerifier {
|
||||
Self::submit_for_packaging(accounts_package, pending_snapshot_package, snapshot_config);
|
||||
}
|
||||
|
||||
fn verify_accounts_package_hash(accounts_package: &AccountsPackage, ledger_path: &Path) {
|
||||
fn verify_accounts_package_hash(accounts_package: &AccountsPackage) {
|
||||
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);
|
||||
@ -119,7 +115,6 @@ impl AccountsHashVerifier {
|
||||
.accounts
|
||||
.accounts_db
|
||||
.calculate_accounts_hash_without_index(&mut CalcAccountsHashConfig {
|
||||
accounts_hash_cache_path: ledger_path,
|
||||
storages: &sorted_storages,
|
||||
use_bg_thread_pool: true,
|
||||
stats: HashStats::default(),
|
||||
@ -361,8 +356,6 @@ mod tests {
|
||||
accounts: Arc::clone(&accounts),
|
||||
};
|
||||
|
||||
let ledger_path = TempDir::new().unwrap();
|
||||
|
||||
AccountsHashVerifier::process_accounts_package(
|
||||
accounts_package,
|
||||
&cluster_info,
|
||||
@ -373,7 +366,6 @@ mod tests {
|
||||
&exit,
|
||||
0,
|
||||
Some(&snapshot_config),
|
||||
ledger_path.path(),
|
||||
);
|
||||
|
||||
// sleep for 1ms to create a newer timestmap for gossip entry
|
||||
|
@ -230,7 +230,6 @@ impl Tvu {
|
||||
tvu_config.halt_on_known_validators_accounts_hash_mismatch,
|
||||
tvu_config.accounts_hash_fault_injection_slots,
|
||||
snapshot_config.clone(),
|
||||
blockstore.ledger_path().to_path_buf(),
|
||||
);
|
||||
|
||||
let (snapshot_request_sender, snapshot_request_handler) = match snapshot_config {
|
||||
|
@ -931,7 +931,6 @@ mod tests {
|
||||
true,
|
||||
);
|
||||
|
||||
let tmpdir = TempDir::new().unwrap();
|
||||
let accounts_hash_verifier = AccountsHashVerifier::new(
|
||||
accounts_package_receiver,
|
||||
Some(pending_snapshot_package),
|
||||
@ -941,7 +940,6 @@ mod tests {
|
||||
false,
|
||||
0,
|
||||
Some(snapshot_test_config.snapshot_config.clone()),
|
||||
tmpdir.path().to_path_buf(),
|
||||
);
|
||||
|
||||
let accounts_background_service = AccountsBackgroundService::new(
|
||||
|
@ -5515,7 +5515,6 @@ impl AccountsDb {
|
||||
};
|
||||
|
||||
self.calculate_accounts_hash_without_index(&mut CalcAccountsHashConfig {
|
||||
accounts_hash_cache_path: &self.accounts_hash_cache_path,
|
||||
storages: &storages,
|
||||
use_bg_thread_pool: !is_startup,
|
||||
stats: timings,
|
||||
@ -5729,7 +5728,7 @@ impl AccountsDb {
|
||||
let mut previous_pass = PreviousPass::default();
|
||||
let mut final_result = (Hash::default(), 0);
|
||||
|
||||
let cache_hash_data = CacheHashData::new(&config.accounts_hash_cache_path);
|
||||
let cache_hash_data = CacheHashData::new(&self.accounts_hash_cache_path);
|
||||
|
||||
for pass in 0..num_hash_scan_passes {
|
||||
let bounds = Range {
|
||||
@ -7897,7 +7896,6 @@ pub mod tests {
|
||||
let db = AccountsDb::new(Vec::new(), &ClusterType::Development);
|
||||
let result = db
|
||||
.calculate_accounts_hash_without_index(&mut CalcAccountsHashConfig {
|
||||
accounts_hash_cache_path: TempDir::new().unwrap().path(),
|
||||
storages: &get_storage_refs(&storages),
|
||||
use_bg_thread_pool: false,
|
||||
stats: HashStats::default(),
|
||||
@ -7924,7 +7922,6 @@ pub mod tests {
|
||||
let db = AccountsDb::new(Vec::new(), &ClusterType::Development);
|
||||
let result = db
|
||||
.calculate_accounts_hash_without_index(&mut CalcAccountsHashConfig {
|
||||
accounts_hash_cache_path: TempDir::new().unwrap().path(),
|
||||
storages: &get_storage_refs(&storages),
|
||||
use_bg_thread_pool: false,
|
||||
stats: HashStats::default(),
|
||||
|
@ -10,7 +10,7 @@ use {
|
||||
hash::{Hash, Hasher},
|
||||
pubkey::Pubkey,
|
||||
},
|
||||
std::{borrow::Borrow, convert::TryInto, path::Path, sync::Mutex},
|
||||
std::{borrow::Borrow, convert::TryInto, sync::Mutex},
|
||||
};
|
||||
pub const ZERO_RAW_LAMPORTS_SENTINEL: u64 = std::u64::MAX;
|
||||
pub const MERKLE_FANOUT: usize = 16;
|
||||
@ -24,7 +24,6 @@ pub struct PreviousPass {
|
||||
|
||||
/// parameters to calculate accounts hash
|
||||
pub struct CalcAccountsHashConfig<'a> {
|
||||
pub accounts_hash_cache_path: &'a Path,
|
||||
pub storages: &'a SortedStorages<'a>,
|
||||
pub use_bg_thread_pool: bool,
|
||||
pub stats: HashStats,
|
||||
|
Reference in New Issue
Block a user