AcctIdx: streamline metric update (#21936)

This commit is contained in:
Jeff Washington (jwash) 2021-12-15 19:52:23 -06:00 committed by GitHub
parent 1e0d3f13e6
commit 82672b40fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -710,6 +710,7 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
assert!(self.get_stop_flush()); // caller should be controlling the lifetime of how long this needs to be present
let m = Measure::start("range");
let mut added_to_mem = 0;
// load from disk
if let Some(disk) = self.bucket.as_ref() {
let mut map = self.map().write().unwrap();
@ -724,11 +725,13 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
}
Entry::Vacant(vacant) => {
vacant.insert(self.disk_to_cache_entry(item.slot_list, item.ref_count));
self.stats().insert_or_delete_mem(true, self.bin);
added_to_mem += 1;
}
}
}
}
self.stats()
.insert_or_delete_mem_count(true, self.bin, added_to_mem);
Self::update_time_stat(&self.stats().get_range_us, m);
}