From 02356fdbd3695636bb78cedaace58857e32c3393 Mon Sep 17 00:00:00 2001 From: jeff washington Date: Fri, 10 Nov 2023 10:20:44 -0600 Subject: [PATCH] stop page aligning shrunk append vecs --- accounts-db/src/accounts_db.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/accounts-db/src/accounts_db.rs b/accounts-db/src/accounts_db.rs index 6942f9adad19c7..79f88cd66caeff 100644 --- a/accounts-db/src/accounts_db.rs +++ b/accounts-db/src/accounts_db.rs @@ -459,7 +459,6 @@ impl AncientSlotPubkeys { pub(crate) struct ShrinkCollect<'a, T: ShrinkCollectRefs<'a>> { pub(crate) slot: Slot, pub(crate) capacity: u64, - pub(crate) aligned_total_bytes: u64, pub(crate) unrefed_pubkeys: Vec<&'a Pubkey>, pub(crate) alive_accounts: T, /// total size in storage of all alive accounts @@ -4047,7 +4046,6 @@ impl AccountsDb { ShrinkCollect { slot, capacity: *capacity, - aligned_total_bytes, unrefed_pubkeys, alive_accounts, alive_total_bytes, @@ -4114,7 +4112,7 @@ impl AccountsDb { self.shrink_collect::>(store, &unique_accounts, &self.shrink_stats); // This shouldn't happen if alive_bytes/approx_stored_count are accurate - if Self::should_not_shrink(shrink_collect.aligned_total_bytes, shrink_collect.capacity) { + if Self::should_not_shrink(shrink_collect.alive_total_bytes as u64, shrink_collect.capacity) { self.shrink_stats .skipped_shrink .fetch_add(1, Ordering::Relaxed); @@ -4130,20 +4128,19 @@ impl AccountsDb { let total_accounts_after_shrink = shrink_collect.alive_accounts.len(); debug!( - "shrinking: slot: {}, accounts: ({} => {}) bytes: ({} ; aligned to: {}) original: {}", + "shrinking: slot: {}, accounts: ({} => {}) bytes: {} original: {}", slot, shrink_collect.total_starting_accounts, total_accounts_after_shrink, shrink_collect.alive_total_bytes, - shrink_collect.aligned_total_bytes, shrink_collect.capacity, ); let mut stats_sub = ShrinkStatsSub::default(); let mut rewrite_elapsed = Measure::start("rewrite_elapsed"); - if shrink_collect.aligned_total_bytes > 0 { + if shrink_collect.alive_total_bytes > 0 { let (shrink_in_progress, time_us) = - measure_us!(self.get_store_for_shrink(slot, shrink_collect.aligned_total_bytes)); + measure_us!(self.get_store_for_shrink(slot, shrink_collect.alive_total_bytes as u64)); stats_sub.create_and_insert_store_elapsed_us = time_us; // here, we're writing back alive_accounts. That should be an atomic operation