Prevent unbound memory growth by blockstore_processor (#12110)
* Prevent unbound memory growth by blockstore_processor * Promote log to info! considering infrequency * Exclude the time of freeing from interval... * Skip not-shrinkable slots even if forced * Add comment
This commit is contained in:
@ -863,7 +863,15 @@ impl AccountsDB {
|
||||
alive_count += store.count();
|
||||
stored_count += store.approx_stored_count();
|
||||
}
|
||||
if (alive_count as f32 / stored_count as f32) >= 0.80 && !forced {
|
||||
if alive_count == stored_count && stores.values().len() == 1 {
|
||||
trace!(
|
||||
"shrink_stale_slot: not able to shrink at all{}: {} / {}",
|
||||
alive_count,
|
||||
stored_count,
|
||||
if forced { " (forced)" } else { "" },
|
||||
);
|
||||
return 0;
|
||||
} else if (alive_count as f32 / stored_count as f32) >= 0.80 && !forced {
|
||||
trace!(
|
||||
"shrink_stale_slot: not enough space to shrink: {} / {}",
|
||||
alive_count,
|
||||
|
@ -1123,6 +1123,25 @@ impl Bank {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn exhaustively_free_unused_resource(&self) {
|
||||
let mut reclaim = Measure::start("reclaim");
|
||||
self.process_dead_slots();
|
||||
reclaim.stop();
|
||||
|
||||
let mut clean = Measure::start("clean");
|
||||
self.clean_accounts();
|
||||
clean.stop();
|
||||
|
||||
let mut shrink = Measure::start("shrink");
|
||||
self.shrink_all_slots();
|
||||
shrink.stop();
|
||||
|
||||
info!(
|
||||
"exhaustively_free_unused_resource(): {} {} {}",
|
||||
reclaim, clean, shrink,
|
||||
);
|
||||
}
|
||||
|
||||
pub fn epoch_schedule(&self) -> &EpochSchedule {
|
||||
&self.epoch_schedule
|
||||
}
|
||||
|
Reference in New Issue
Block a user