test_lazy_gc_slot can use write cache (#29080)
This commit is contained in:
parent
8c47e2168e
commit
9746eb2c8d
|
@ -11569,11 +11569,14 @@ pub mod tests {
|
|||
//This test is pedantic
|
||||
//A slot is purged when a non root bank is cleaned up. If a slot is behind root but it is
|
||||
//not root, it means we are retaining dead banks.
|
||||
let accounts = AccountsDb::new(Vec::new(), &ClusterType::Development);
|
||||
let mut accounts = AccountsDb::new(Vec::new(), &ClusterType::Development);
|
||||
accounts.caching_enabled = true;
|
||||
let pubkey = solana_sdk::pubkey::new_rand();
|
||||
let account = AccountSharedData::new(1, 0, AccountSharedData::default().owner());
|
||||
//store an account
|
||||
accounts.store_uncached(0, &[(&pubkey, &account)]);
|
||||
accounts.store_from_test(0, &[(&pubkey, &account)]);
|
||||
accounts.add_root_and_flush_write_cache(0);
|
||||
|
||||
let ancestors = vec![(0, 0)].into_iter().collect();
|
||||
let id = {
|
||||
let (lock, idx) = accounts
|
||||
|
@ -11583,7 +11586,6 @@ pub mod tests {
|
|||
lock.slot_list()[idx].1.store_id()
|
||||
};
|
||||
accounts.get_accounts_delta_hash(0);
|
||||
accounts.add_root(1);
|
||||
|
||||
//slot is still there, since gc is lazy
|
||||
assert!(accounts
|
||||
|
@ -11596,13 +11598,14 @@ pub mod tests {
|
|||
.is_some());
|
||||
|
||||
//store causes clean
|
||||
accounts.store_uncached(1, &[(&pubkey, &account)]);
|
||||
accounts.store_from_test(1, &[(&pubkey, &account)]);
|
||||
|
||||
// generate delta state for slot 1, so clean operates on it.
|
||||
accounts.get_accounts_delta_hash(1);
|
||||
|
||||
//slot is gone
|
||||
accounts.print_accounts_stats("pre-clean");
|
||||
accounts.add_root_and_flush_write_cache(1);
|
||||
accounts.clean_accounts_for_tests();
|
||||
assert!(accounts.storage.map.get(&0).is_none());
|
||||
|
||||
|
|
Loading…
Reference in New Issue