Skip to content

Commit

Permalink
try 10 roots at a time
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington committed Oct 10, 2024
1 parent 3d3360e commit d9d6ae6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5118,6 +5118,7 @@ impl AccountsDb {
let mut ancient_slots_added = 0;
// If there are too few slots to shrink, add an ancient slot
// for shrinking.
let mut count = 0;
if shrink_slots.len() < 10 {
let mut ancients = self.best_ancient_slots_to_shrink.write().unwrap();
let mut done = false;
Expand All @@ -5137,7 +5138,7 @@ impl AccountsDb {
continue;
}
if done {
log::error!("next ancient storage to shrink: {}, alive: {}, capacity: {}", slot, store.alive_bytes(), store.capacity());
log::error!("next ancient storage to shrink: {}, alive: {}, capacity: {}, root age from max: {}", slot, store.alive_bytes(), store.capacity(), self.accounts_index.roots_tracker.read().unwrap().alive_roots.max_exclusive() - slot);
break;
}
*capacity = 0;
Expand All @@ -5146,7 +5147,10 @@ impl AccountsDb {
.ancient_bytes_added_to_shrink
.fetch_add(store.alive_bytes() as u64, Ordering::Relaxed);
shrink_slots.insert(*slot, store);
done = true;
count += 1;
if count >= 10 {
done = true;
}
}
}
if !done {
Expand Down

0 comments on commit d9d6ae6

Please sign in to comment.