randomly shrink ancient append vecs (#27523)

This commit is contained in:
Jeff Washington (jwash) 2022-09-01 08:32:43 -07:00 committed by GitHub
parent 28c3552756
commit 0df0b94a72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -3798,8 +3798,13 @@ impl AccountsDb {
}
let storage = all_storages.first().unwrap();
let accounts = &storage.accounts;
if is_full_ancient(accounts) {
if self.is_candidate_for_shrink(storage, true) {
// randomly shrink ancient slots
// this exercises the ancient shrink code more often
let random_shrink = thread_rng().gen_range(0, 100) == 0 && is_ancient(accounts);
if is_full_ancient(accounts) || random_shrink {
if self.is_candidate_for_shrink(storage, true) || random_shrink {
// we are full, but we are a candidate for shrink, so either append us to the previous append vec
// or recreate us as a new append vec and eliminate some contents
info!("ancient_append_vec: shrinking full ancient: {}", slot);