Account for possibility of cache flush in load() (#15454)

* Account for possibility of cache flush in load()

* More cleaning

* More cleaning

* Remove unused method and some comment cleaning

* Fix typo

* Make the detected impossible purge race panic()!

* Finally revert to original .expect()

* Fix typos...

* Add assertion for max_root for easier reasoning

* Reframe races with LoadHint as possible opt.

* Fix test

* Make race bug tests run longer for less flaky

* Delay the clone-in-lock slow path even for RPC

* Make get_account panic-free & add its onchain ver.

* Fix rebase conflicts...

* Clean up

* Clean up comment

* Revert fn name change

* Fix flaky test...

* fmt...

Co-authored-by: Ryo Onodera <ryoqun@gmail.com>
This commit is contained in:
carllin
2021-04-16 08:23:32 -07:00
committed by GitHub
parent 6dab20812e
commit d747614b27
9 changed files with 1109 additions and 266 deletions

View File

@@ -1,7 +1,10 @@
use log::*;
use rand::{thread_rng, Rng};
use rayon::prelude::*;
use solana_runtime::{accounts_db::AccountsDb, accounts_index::Ancestors};
use solana_runtime::{
accounts_db::{AccountsDb, LoadHint},
accounts_index::Ancestors,
};
use solana_sdk::genesis_config::ClusterType;
use solana_sdk::{account::AccountSharedData, clock::Slot, pubkey::Pubkey};
use std::collections::HashSet;
@@ -112,7 +115,8 @@ fn test_bad_bank_hash() {
for (key, account) in &account_refs {
assert_eq!(
db.load_account_hash(&ancestors, &key),
db.load_account_hash(&ancestors, &key, None, LoadHint::Unspecified)
.unwrap(),
AccountsDb::hash_account(some_slot, &account, &key)
);
}