From df29276eb0a0bbf3cb9e6e578a1c41eaa27a4bd8 Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Fri, 18 Mar 2022 17:13:21 -0500 Subject: [PATCH] AcctIdx: remove -> evict (#23775) --- runtime/src/bucket_map_holder_stats.rs | 12 ++++++------ runtime/src/in_mem_accounts_index.rs | 18 +++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/runtime/src/bucket_map_holder_stats.rs b/runtime/src/bucket_map_holder_stats.rs index 663180124d..47da35ae7c 100644 --- a/runtime/src/bucket_map_holder_stats.rs +++ b/runtime/src/bucket_map_holder_stats.rs @@ -38,14 +38,14 @@ pub struct BucketMapHolderStats { pub count_in_mem: AtomicUsize, pub per_bucket_count: Vec, pub flush_entries_updated_on_disk: AtomicU64, - pub flush_entries_removed_from_mem: AtomicU64, + pub flush_entries_evicted_from_mem: AtomicU64, pub active_threads: AtomicU64, pub get_range_us: AtomicU64, last_age: AtomicU8, last_ages_flushed: AtomicU64, pub flush_scan_us: AtomicU64, pub flush_update_us: AtomicU64, - pub flush_remove_us: AtomicU64, + pub flush_evict_us: AtomicU64, pub flush_grow_us: AtomicU64, last_was_startup: AtomicBool, last_time: AtomicInterval, @@ -345,8 +345,8 @@ impl BucketMapHolderStats { i64 ), ( - "flush_remove_us", - self.flush_remove_us.swap(0, Ordering::Relaxed), + "flush_evict_us", + self.flush_evict_us.swap(0, Ordering::Relaxed), i64 ), ( @@ -438,8 +438,8 @@ impl BucketMapHolderStats { i64 ), ( - "flush_entries_removed_from_mem", - self.flush_entries_removed_from_mem + "flush_entries_evicted_from_mem", + self.flush_entries_evicted_from_mem .swap(0, Ordering::Relaxed), i64 ), diff --git a/runtime/src/in_mem_accounts_index.rs b/runtime/src/in_mem_accounts_index.rs index 7db1de9373..32ac183038 100644 --- a/runtime/src/in_mem_accounts_index.rs +++ b/runtime/src/in_mem_accounts_index.rs @@ -933,7 +933,7 @@ impl InMemAccountsIndex { let startup = self.storage.get_startup(); if !iterate_for_age && !startup { // no need to age, so no need to flush this bucket - // but, at startup we want to remove from buckets as fast as possible if any items exist + // but, at startup we want to evict from buckets as fast as possible if any items exist return; } @@ -970,7 +970,7 @@ impl InMemAccountsIndex { mse.stop(); flush_should_evict_us += mse.as_us(); if !evict_for_age && !Self::random_chance_of_eviction() { - // not planning to remove this item from memory now, so don't write it to disk yet + // not planning to evict this item from memory now, so don't write it to disk yet continue; } @@ -1034,7 +1034,7 @@ impl InMemAccountsIndex { let m = Measure::start("flush_evict"); self.evict_from_cache(evictions, current_age, startup, false); self.evict_from_cache(evictions_random, current_age, startup, true); - Self::update_time_stat(&self.stats().flush_remove_us, m); + Self::update_time_stat(&self.stats().flush_evict_us, m); if iterate_for_age { // completed iteration of the buckets at the current age @@ -1054,7 +1054,7 @@ impl InMemAccountsIndex { }); } - // remove keys in 'evictions' from in-mem cache, likely due to age + // evict keys in 'evictions' from in-mem cache, likely due to age fn evict_from_cache( &self, mut evictions: Vec, @@ -1092,7 +1092,7 @@ impl InMemAccountsIndex { } } - let mut removed = 0; + let mut evicted = 0; // consider chunking these so we don't hold the write lock too long let mut map = self.map().write().unwrap(); for k in evictions { @@ -1120,8 +1120,8 @@ impl InMemAccountsIndex { continue; } - // all conditions for removing succeeded, so really remove item from in-mem cache - removed += 1; + // all conditions for removing succeeded, so really evict item from in-mem cache + evicted += 1; occupied.remove(); } } @@ -1130,8 +1130,8 @@ impl InMemAccountsIndex { } drop(map); self.stats() - .insert_or_delete_mem_count(false, self.bin, removed); - Self::update_stat(&self.stats().flush_entries_removed_from_mem, removed as u64); + .insert_or_delete_mem_count(false, self.bin, evicted); + Self::update_stat(&self.stats().flush_entries_evicted_from_mem, evicted as u64); } pub fn stats(&self) -> &BucketMapHolderStats {