@@ -152,7 +152,10 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
152
152
let entry = map. entry ( * pubkey) ;
153
153
let result = match entry {
154
154
Entry :: Occupied ( occupied) => Arc :: clone ( occupied. get ( ) ) ,
155
- Entry :: Vacant ( vacant) => Arc :: clone ( vacant. insert ( new_entry) ) ,
155
+ Entry :: Vacant ( vacant) => {
156
+ stats. insert_or_delete_mem ( true , self . bin ) ;
157
+ Arc :: clone ( vacant. insert ( new_entry) )
158
+ }
156
159
} ;
157
160
Some ( result)
158
161
}
@@ -184,6 +187,7 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
184
187
// We have to have a write lock to the map here, which means nobody else can get
185
188
// the arc, but someone may already have retreived a clone of it.
186
189
self . delete_disk_key ( occupied. key ( ) ) ;
190
+ self . stats ( ) . insert_or_delete_mem ( false , self . bin ) ;
187
191
occupied. remove ( ) ;
188
192
}
189
193
result
@@ -274,6 +278,7 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
274
278
} ;
275
279
assert ! ( new_value. dirty( ) ) ;
276
280
vacant. insert ( new_value) ;
281
+ self . stats ( ) . insert_or_delete_mem ( true , self . bin ) ;
277
282
self . stats ( ) . insert_or_delete ( true , self . bin ) ;
278
283
}
279
284
}
@@ -424,6 +429,7 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
424
429
Entry :: Vacant ( vacant) => {
425
430
// not in cache, look on disk
426
431
let disk_entry = self . load_account_entry_from_disk ( vacant. key ( ) ) ;
432
+ stats. insert_or_delete_mem ( true , self . bin ) ;
427
433
if let Some ( disk_entry) = disk_entry {
428
434
// on disk, so insert into cache, then return cache value so caller will merge
429
435
let result = Some ( Self :: insert_returner ( & disk_entry, vacant. key ( ) , new_entry) ) ;
@@ -537,6 +543,7 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
537
543
}
538
544
Entry :: Vacant ( vacant) => {
539
545
vacant. insert ( self . disk_to_cache_entry ( item. slot_list , item. ref_count ) ) ;
546
+ self . stats ( ) . insert_or_delete_mem ( true , self . bin ) ;
540
547
}
541
548
}
542
549
}
@@ -682,6 +689,7 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
682
689
}
683
690
684
691
// all conditions for removing succeeded, so really remove item from in-mem cache
692
+ self . stats ( ) . insert_or_delete_mem ( false , self . bin ) ;
685
693
occupied. remove ( ) ;
686
694
}
687
695
}
0 commit comments