test_accounts_db_purge1 uses write cache (#29100)

This commit is contained in:
Jeff Washington (jwash) 2022-12-06 16:34:40 -06:00 committed by GitHub
parent e5e64c8d6e
commit 8ce6081744
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -12337,25 +12337,29 @@ pub mod tests {
let zero_lamport_account = AccountSharedData::new(zero_lamport, no_data, &owner);
let accounts = AccountsDb::new_single_for_tests();
let mut accounts = AccountsDb::new_single_for_tests();
accounts.caching_enabled = true;
accounts.add_root(0);
let mut current_slot = 1;
accounts.insert_default_bank_hash(current_slot, current_slot - 1);
accounts.store_for_tests(current_slot, &[(&pubkey, &account)]);
accounts.add_root(current_slot);
accounts.get_accounts_delta_hash(current_slot);
accounts.add_root_and_flush_write_cache(current_slot);
current_slot += 1;
accounts.insert_default_bank_hash(current_slot, current_slot - 1);
accounts.store_for_tests(current_slot, &[(&pubkey, &zero_lamport_account)]);
accounts.add_root(current_slot);
accounts.get_accounts_delta_hash(current_slot);
accounts.add_root_and_flush_write_cache(current_slot);
assert_load_account(&accounts, current_slot, pubkey, zero_lamport);
// Otherwise slot 2 will not be removed
current_slot += 1;
accounts.insert_default_bank_hash(current_slot, current_slot - 1);
accounts.add_root(current_slot);
accounts.get_accounts_delta_hash(current_slot);
accounts.add_root_and_flush_write_cache(current_slot);
accounts.print_accounts_stats("pre_purge");