AcctIdx: set age of cache accesses to future (#20125)
This commit is contained in:
committed by
GitHub
parent
fb55e9a9b6
commit
5dae615208
@ -142,7 +142,8 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
|
|||||||
Self::update_time_stat(time, m);
|
Self::update_time_stat(time, m);
|
||||||
Self::update_stat(count, 1);
|
Self::update_stat(count, 1);
|
||||||
|
|
||||||
if result.is_some() {
|
if let Some(entry) = result.as_ref() {
|
||||||
|
entry.set_age(self.storage.future_age_to_flush());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,6 +259,7 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
|
|||||||
reclaims,
|
reclaims,
|
||||||
previous_slot_entry_was_cached,
|
previous_slot_entry_was_cached,
|
||||||
);
|
);
|
||||||
|
current.set_age(self.storage.future_age_to_flush());
|
||||||
Self::update_stat(&self.stats().updates_in_mem, 1);
|
Self::update_stat(&self.stats().updates_in_mem, 1);
|
||||||
}
|
}
|
||||||
Entry::Vacant(vacant) => {
|
Entry::Vacant(vacant) => {
|
||||||
@ -536,11 +538,13 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
|
|||||||
if let Some(disk) = self.storage.disk.as_ref() {
|
if let Some(disk) = self.storage.disk.as_ref() {
|
||||||
let items = disk.items_in_range(self.bin, range);
|
let items = disk.items_in_range(self.bin, range);
|
||||||
let mut map = self.map().write().unwrap();
|
let mut map = self.map().write().unwrap();
|
||||||
|
let future_age = self.storage.future_age_to_flush();
|
||||||
for item in items {
|
for item in items {
|
||||||
let entry = map.entry(item.pubkey);
|
let entry = map.entry(item.pubkey);
|
||||||
match entry {
|
match entry {
|
||||||
Entry::Occupied(_occupied) => {
|
Entry::Occupied(occupied) => {
|
||||||
// do nothing - item already in cache
|
// item already in cache, bump age to future. This helps the current age flush to succeed.
|
||||||
|
occupied.get().set_age(future_age);
|
||||||
}
|
}
|
||||||
Entry::Vacant(vacant) => {
|
Entry::Vacant(vacant) => {
|
||||||
vacant.insert(self.disk_to_cache_entry(item.slot_list, item.ref_count));
|
vacant.insert(self.disk_to_cache_entry(item.slot_list, item.ref_count));
|
||||||
|
Reference in New Issue
Block a user