batch insert updates stat count correctly (#26107)
This commit is contained in:
parent
d3829b1a76
commit
8e2bae7bf9
|
@ -68,8 +68,12 @@ impl BucketMapHolderStats {
|
|||
}
|
||||
|
||||
pub fn inc_insert(&self) {
|
||||
self.inserts.fetch_add(1, Ordering::Relaxed);
|
||||
self.count.fetch_add(1, Ordering::Relaxed);
|
||||
self.inc_insert_count(1);
|
||||
}
|
||||
|
||||
pub fn inc_insert_count(&self, count: u64) {
|
||||
self.inserts.fetch_add(count, Ordering::Relaxed);
|
||||
self.count.fetch_add(count as usize, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
pub fn inc_delete(&self) {
|
||||
|
|
|
@ -1033,6 +1033,7 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
|
|||
// merge all items into the disk index now
|
||||
let disk = self.bucket.as_ref().unwrap();
|
||||
let mut duplicate = vec![];
|
||||
let mut count = 0;
|
||||
insert.into_iter().for_each(|(slot, k, v)| {
|
||||
let entry = (slot, v);
|
||||
let new_ref_count = if v.is_cached() { 0 } else { 1 };
|
||||
|
@ -1048,12 +1049,14 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
|
|||
Some((slot_list, ref_count))
|
||||
}
|
||||
None => {
|
||||
count += 1;
|
||||
// not on disk, insert it
|
||||
Some((vec![entry], new_ref_count))
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
self.stats().inc_insert_count(count);
|
||||
self.startup_info
|
||||
.lock()
|
||||
.unwrap()
|
||||
|
|
Loading…
Reference in New Issue