Skip to content

Commit

Permalink
no need to call handle_reclaims if reclaims was not populated (#527)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington authored Apr 2, 2024
1 parent 01855ed commit 9099901
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8487,23 +8487,29 @@ impl AccountsDb {
//
// From 1) and 2) we guarantee passing `no_purge_stats` == None, which is
// equivalent to asserting there will be no dead slots, is safe.
let mut handle_reclaims_time = Measure::start("handle_reclaims");
self.handle_reclaims(
(!reclaims.is_empty()).then(|| reclaims.iter()),
expected_single_dead_slot,
None,
reset_accounts,
&HashSet::default(),
);
handle_reclaims_time.stop();
self.stats
.store_handle_reclaims
.fetch_add(handle_reclaims_time.as_us(), Ordering::Relaxed);
let mut handle_reclaims_elapsed = 0;
if reclaim == UpsertReclaim::PopulateReclaims {
let mut handle_reclaims_time = Measure::start("handle_reclaims");
self.handle_reclaims(
(!reclaims.is_empty()).then(|| reclaims.iter()),
expected_single_dead_slot,
None,
reset_accounts,
&HashSet::default(),
);
handle_reclaims_time.stop();
handle_reclaims_elapsed = handle_reclaims_time.as_us();
self.stats
.store_handle_reclaims
.fetch_add(handle_reclaims_elapsed, Ordering::Relaxed);
} else {
assert!(reclaims.is_empty());
}

StoreAccountsTiming {
store_accounts_elapsed: store_accounts_time.as_us(),
update_index_elapsed: update_index_time.as_us(),
handle_reclaims_elapsed: handle_reclaims_time.as_us(),
handle_reclaims_elapsed,
}
}

Expand Down

0 comments on commit 9099901

Please sign in to comment.