Skip to content

Commit

Permalink
recycle_store_count is moved to try_recycle_store (#27797)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirill lykov authored Sep 15, 2022
1 parent aae0780 commit 1a4b8b5
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions runtime/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5088,6 +5088,9 @@ impl AccountsDb {
ret.get_path(),
old_id
);
self.stats
.recycle_store_count
.fetch_add(1, Ordering::Relaxed);
return Some(ret);
}
}
Expand Down Expand Up @@ -5135,17 +5138,12 @@ impl AccountsDb {
if store.try_available() {
let ret = store.clone();
drop(slot_stores);
if create_extra {
if self
if create_extra
&& self
.try_recycle_and_insert_store(slot, size as u64, std::u64::MAX)
.is_none()
{
self.create_and_insert_store(slot, self.file_size, "store extra");
} else {
self.stats
.recycle_store_count
.fetch_add(1, Ordering::Relaxed);
}
{
self.create_and_insert_store(slot, self.file_size, "store extra");
}
find_existing.stop();
self.stats
Expand All @@ -5166,9 +5164,6 @@ impl AccountsDb {
.fetch_add(find_existing.as_us(), Ordering::Relaxed);

let store = if let Some(store) = self.try_recycle_store(slot, size as u64, std::u64::MAX) {
self.stats
.recycle_store_count
.fetch_add(1, Ordering::Relaxed);
store
} else {
self.create_store(slot, self.file_size, "store", &self.paths)
Expand Down Expand Up @@ -5797,10 +5792,6 @@ impl AccountsDb {
.is_none()
{
self.create_and_insert_store(slot, special_store_size, "large create");
} else {
self.stats
.recycle_store_count
.fetch_add(1, Ordering::Relaxed);
}
}
continue;
Expand Down

0 comments on commit 1a4b8b5

Please sign in to comment.