Skip to content

Commit

Permalink
test_minimize_accounts_db uses write cache correctly (solana-labs#29333)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington authored and nickfrosty committed Jan 4, 2023
1 parent 4dbd795 commit 9a6f09c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions runtime/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16191,7 +16191,7 @@ pub mod tests {
impl AccountsDb {
/// useful to adapt tests written prior to introduction of the write cache
/// to use the write cache
fn add_root_and_flush_write_cache(&self, slot: Slot) {
pub fn add_root_and_flush_write_cache(&self, slot: Slot) {
self.add_root(slot);
self.flush_root_write_cache(slot);
}
Expand All @@ -16212,7 +16212,7 @@ pub mod tests {
}

/// callers use to call store_uncached. But, this is not allowed anymore.
fn store_for_tests(&self, slot: Slot, accounts: &[(&Pubkey, &AccountSharedData)]) {
pub fn store_for_tests(&self, slot: Slot, accounts: &[(&Pubkey, &AccountSharedData)]) {
self.store(
(slot, accounts, INCLUDE_SLOT_IN_HASH_TESTS),
true,
Expand Down
4 changes: 2 additions & 2 deletions runtime/src/snapshot_minimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,14 +657,14 @@ mod tests {
current_slot += 1;

for (index, pubkey) in pubkeys.iter().enumerate() {
accounts.store_uncached(current_slot, &[(pubkey, &account)]);
accounts.store_for_tests(current_slot, &[(pubkey, &account)]);

if current_slot % 2 == 0 && index % 100 == 0 {
minimized_account_set.insert(*pubkey);
}
}
accounts.get_accounts_delta_hash(current_slot);
accounts.add_root(current_slot);
accounts.add_root_and_flush_write_cache(current_slot);
}

assert_eq!(minimized_account_set.len(), 6);
Expand Down

0 comments on commit 9a6f09c

Please sign in to comment.