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:
Ryo Onodera
2020-09-09 12:05:10 +09:00
committed by GitHub
parent 0abf4db82e
commit c274e26eb8
3 changed files with 37 additions and 2 deletions

View File

@@ -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,