Skip to content

Commit

Permalink
stop page aligning shrunk append vecs
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington committed Nov 10, 2023
1 parent 69ab8a8 commit 02356fd
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -4047,7 +4046,6 @@ impl AccountsDb {
ShrinkCollect {
slot,
capacity: *capacity,
aligned_total_bytes,
unrefed_pubkeys,
alive_accounts,
alive_total_bytes,
Expand Down Expand Up @@ -4114,7 +4112,7 @@ impl AccountsDb {
self.shrink_collect::<AliveAccounts<'_>>(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);
Expand All @@ -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
Expand Down

0 comments on commit 02356fd

Please sign in to comment.