test_accounts_db_purge1 uses write cache (#29100)
This commit is contained in:
parent
e5e64c8d6e
commit
8ce6081744
|
@ -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");
|
||||
|
||||
|
|
Loading…
Reference in New Issue