Moves transient accounts hash cache files into their own dir (#31778)

This commit is contained in:
Brooks 2023-05-23 18:14:30 -04:00 committed by GitHub
parent 174951478f
commit 05c932f92d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -96,6 +96,7 @@ use {
borrow::{Borrow, Cow},
boxed::Box,
collections::{hash_map, BTreeSet, HashMap, HashSet},
fs,
hash::{Hash as StdHash, Hasher as StdHasher},
io::Result as IoResult,
ops::{Range, RangeBounds},
@ -1400,6 +1401,7 @@ pub struct AccountsDb {
full_accounts_hash_cache_path: PathBuf,
incremental_accounts_hash_cache_path: PathBuf,
transient_accounts_hash_cache_path: PathBuf,
// used by tests
// holds this until we are dropped
@ -2401,6 +2403,7 @@ impl AccountsDb {
paths: vec![],
full_accounts_hash_cache_path: accounts_hash_cache_path.join("full"),
incremental_accounts_hash_cache_path: accounts_hash_cache_path.join("incremental"),
transient_accounts_hash_cache_path: accounts_hash_cache_path.join("transient"),
temp_accounts_hash_cache_path,
shrink_paths: RwLock::new(None),
temp_paths: None,
@ -7585,14 +7588,15 @@ impl AccountsDb {
let slot = storages.max_slot_inclusive();
let use_bg_thread_pool = config.use_bg_thread_pool;
let scan_and_hash = || {
let cache_hash_data =
Self::get_cache_hash_data(accounts_hash_cache_path.clone(), config, slot);
let cache_hash_data = Self::get_cache_hash_data(accounts_hash_cache_path, config, slot);
let bounds = Range {
start: 0,
end: PUBKEY_BINS_FOR_CALCULATING_HASHES,
};
fs::create_dir_all(&self.transient_accounts_hash_cache_path)
.expect("create transient accounts hash cache dir");
let accounts_hasher = AccountsHasher {
filler_account_suffix: if self.filler_accounts_config.count > 0 {
self.filler_account_suffix
@ -7600,7 +7604,7 @@ impl AccountsDb {
None
},
zero_lamport_accounts: flavor.zero_lamport_accounts(),
dir_for_temp_cache_files: accounts_hash_cache_path,
dir_for_temp_cache_files: self.transient_accounts_hash_cache_path.clone(),
};
// get raw data by scanning