log fail to evict (#23815)

This commit is contained in:
Jeff Washington (jwash) 2022-03-22 09:19:38 -05:00 committed by GitHub
parent 16b73a998b
commit 89ba3ff139
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -29,6 +29,7 @@ pub struct BucketMapHolderStats {
pub updates_in_mem: AtomicU64, pub updates_in_mem: AtomicU64,
pub items: AtomicU64, pub items: AtomicU64,
pub items_us: AtomicU64, pub items_us: AtomicU64,
pub failed_to_evict: AtomicU64,
pub keys: AtomicU64, pub keys: AtomicU64,
pub deletes: AtomicU64, pub deletes: AtomicU64,
pub inserts: AtomicU64, pub inserts: AtomicU64,
@ -319,6 +320,11 @@ impl BucketMapHolderStats {
self.entry_missing_us.swap(0, Ordering::Relaxed), self.entry_missing_us.swap(0, Ordering::Relaxed),
i64 i64
), ),
(
"failed_to_evict",
self.failed_to_evict.swap(0, Ordering::Relaxed),
i64
),
( (
"updates_in_mem", "updates_in_mem",
self.updates_in_mem.swap(0, Ordering::Relaxed), self.updates_in_mem.swap(0, Ordering::Relaxed),

View File

@ -1104,6 +1104,8 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
return; return;
} }
let mut failed = 0;
// skip any keys that are held in memory because of ranges being held // skip any keys that are held in memory because of ranges being held
let ranges = self.cache_ranges_held.read().unwrap().clone(); let ranges = self.cache_ranges_held.read().unwrap().clone();
if !ranges.is_empty() { if !ranges.is_empty() {
@ -1118,6 +1120,7 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
} }
}); });
if !move_age.is_empty() { if !move_age.is_empty() {
failed += move_age.len();
self.move_ages_to_future(next_age_on_failure, current_age, &move_age); self.move_ages_to_future(next_age_on_failure, current_age, &move_age);
} }
} }
@ -1131,6 +1134,7 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
let v = occupied.get(); let v = occupied.get();
if Arc::strong_count(v) > 1 { if Arc::strong_count(v) > 1 {
// someone is holding the value arc's ref count and could modify it, so do not evict // someone is holding the value arc's ref count and could modify it, so do not evict
failed += 1;
v.try_exchange_age(next_age_on_failure, current_age); v.try_exchange_age(next_age_on_failure, current_age);
continue; continue;
} }
@ -1142,11 +1146,13 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
// marked dirty or bumped in age after we looked above // marked dirty or bumped in age after we looked above
// these evictions will be handled in later passes (at later ages) // these evictions will be handled in later passes (at later ages)
// but, at startup, everything is ready to age out if it isn't dirty // but, at startup, everything is ready to age out if it isn't dirty
failed += 1;
continue; continue;
} }
if stop_evictions_changes_at_start != self.get_stop_evictions_changes() { if stop_evictions_changes_at_start != self.get_stop_evictions_changes() {
// ranges were changed // ranges were changed
failed += 1;
v.try_exchange_age(next_age_on_failure, current_age); v.try_exchange_age(next_age_on_failure, current_age);
continue; continue;
} }
@ -1163,6 +1169,7 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
self.stats() self.stats()
.insert_or_delete_mem_count(false, self.bin, evicted); .insert_or_delete_mem_count(false, self.bin, evicted);
Self::update_stat(&self.stats().flush_entries_evicted_from_mem, evicted as u64); Self::update_stat(&self.stats().flush_entries_evicted_from_mem, evicted as u64);
Self::update_stat(&self.stats().failed_to_evict, failed as u64);
} }
pub fn stats(&self) -> &BucketMapHolderStats { pub fn stats(&self) -> &BucketMapHolderStats {