Skip to content

Commit

Permalink
remove disable_read_cache_updates_count
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington committed Mar 29, 2024
1 parent 1182d20 commit 24ffbc8
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1270,40 +1270,12 @@ struct RemoveUnrootedSlotsSynchronization {

type AccountInfoAccountsIndex = AccountsIndex<AccountInfo, AccountInfo>;

/// When an instance of this exists, the read cache is not updated for account loads.
/// When all instances are dropped, the read cache is populated for account loads.
/// By default, all loads will populate the read cache.
/// This cannot be incorrect, it is only a performance penalty at worst.
pub struct DisableReadCacheUpdates<'a> {
accounts_db: &'a AccountsDb,
}

impl<'a> DisableReadCacheUpdates<'a> {
pub fn new(accounts_db: &'a AccountsDb) -> Self {
accounts_db
.disable_read_cache_updates_count
.fetch_add(1, Ordering::Relaxed);
Self { accounts_db }
}
}

impl<'a> Drop for DisableReadCacheUpdates<'a> {
fn drop(&mut self) {
self.accounts_db
.disable_read_cache_updates_count
.fetch_sub(1, Ordering::Relaxed);
}
}

// This structure handles the load/store of the accounts
#[derive(Debug)]
pub struct AccountsDb {
/// Keeps tracks of index into AppendVec on a per slot basis
pub accounts_index: AccountInfoAccountsIndex,

/// if != 0, read cache is not updated on loads
disable_read_cache_updates_count: AtomicU64,

/// Some(offset) iff we want to squash old append vecs together into 'ancient append vecs'
/// Some(offset) means for slots up to (max_slot - (slots_per_epoch - 'offset')), put them in ancient append vecs
pub ancient_append_vec_offset: Option<i64>,
Expand Down Expand Up @@ -2357,7 +2329,6 @@ impl AccountsDb {
active_stats: ActiveStats::default(),
skip_initial_hash_calc: false,
ancient_append_vec_offset: None,
disable_read_cache_updates_count: AtomicU64::default(),
accounts_index,
storage: AccountStorage::default(),
accounts_cache: AccountsCache::default(),
Expand Down

0 comments on commit 24ffbc8

Please sign in to comment.