remove FoundStoredAccount.account_size (#26460)

This commit is contained in:
Jeff Washington (jwash) 2022-07-07 18:37:14 -05:00 committed by GitHub
parent 3b759bcffb
commit d9eee72edb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 17 deletions

View File

@ -210,7 +210,6 @@ pub struct AccountsDbConfig {
pub struct FoundStoredAccount<'a> {
pub account: StoredAccountMeta<'a>,
pub store_id: AppendVecId,
pub account_size: usize,
}
#[cfg(not(test))]
@ -3081,7 +3080,7 @@ impl AccountsDb {
dead += 1;
} else {
alive_accounts.push(pair);
alive_total += stored_account.account_size;
alive_total += stored_account.account.stored_size;
alive += 1;
}
}
@ -3116,11 +3115,7 @@ impl AccountsDb {
original_bytes += store.total_bytes();
let store_id = store.append_vec_id();
AppendVecAccountsIter::new(&store.accounts).for_each(|account| {
let new_entry = FoundStoredAccount {
account_size: account.stored_size,
account,
store_id,
};
let new_entry = FoundStoredAccount { account, store_id };
match stored_accounts.entry(new_entry.account.meta.pubkey) {
Entry::Occupied(mut occupied_entry) => {
if new_entry.account.meta.write_version

View File

@ -46,7 +46,7 @@ impl<'a> AccountsToStore<'a> {
// index of the first account that doesn't fit in the current append vec
let mut index_first_item_overflow = num_accounts; // assume all fit
stored_accounts.iter().for_each(|account| {
let account_size = account.1.account_size as u64;
let account_size = account.1.account.stored_size as u64;
if available_bytes >= account_size {
available_bytes = available_bytes.saturating_sub(account_size);
} else if index_first_item_overflow == num_accounts {
@ -147,7 +147,6 @@ pub mod tests {
rent_epoch: 0,
};
let offset = 3;
let stored_size = 4;
let hash = Hash::new(&[2; 32]);
let stored_meta = StoredMeta {
/// global write version
@ -162,15 +161,10 @@ pub mod tests {
account_meta: &account_meta,
data: account.data(),
offset,
stored_size,
stored_size: account_size,
hash: &hash,
};
// let account = StoredAccountMeta::new();
let found = FoundStoredAccount {
account,
store_id,
account_size,
};
let found = FoundStoredAccount { account, store_id };
let item = (pubkey, found);
let map = vec![&item];
for (selector, available_bytes) in [

View File

@ -320,7 +320,7 @@ impl<'a> SnapshotMinimizer<'a> {
let mut purge_pubkeys = Vec::with_capacity(CHUNK_SIZE);
chunk.iter().for_each(|(pubkey, account)| {
if self.minimized_account_set.contains(pubkey) {
chunk_bytes += account.account_size;
chunk_bytes += account.account.stored_size;
keep_accounts.push((pubkey, account));
} else if self
.accounts_db()