Do not use ancestors in get_snapshot_storages (#30772)
* Do not use ancestors in get_snapshot_storages * fixup verify_accounts_hash bench
This commit is contained in:
parent
8e3a30c22c
commit
8325b0f591
|
@ -99,7 +99,8 @@ fn test_accounts_hash_bank_hash(bencher: &mut Bencher) {
|
|||
let (_, total_lamports) = accounts
|
||||
.accounts_db
|
||||
.update_accounts_hash_for_tests(0, &ancestors, false, false);
|
||||
let test_hash_calculation = false;
|
||||
accounts.add_root(slot);
|
||||
accounts.accounts_db.flush_accounts_cache(true, Some(slot));
|
||||
bencher.iter(|| {
|
||||
assert!(accounts.verify_accounts_hash_and_lamports(
|
||||
0,
|
||||
|
@ -107,7 +108,7 @@ fn test_accounts_hash_bank_hash(bencher: &mut Bencher) {
|
|||
None,
|
||||
VerifyAccountsHashAndLamportsConfig {
|
||||
ancestors: &ancestors,
|
||||
test_hash_calculation,
|
||||
test_hash_calculation: false,
|
||||
epoch_schedule: &EpochSchedule::default(),
|
||||
rent_collector: &RentCollector::default(),
|
||||
ignore_mismatch: false,
|
||||
|
|
|
@ -8660,7 +8660,8 @@ impl AccountsDb {
|
|||
pub fn get_snapshot_storages(
|
||||
&self,
|
||||
requested_slots: impl RangeBounds<Slot> + Sync,
|
||||
ancestors: Option<&Ancestors>,
|
||||
// ancestors is unused and will be removed from callers next
|
||||
_ancestors: Option<&Ancestors>,
|
||||
) -> (Vec<Arc<AccountStorageEntry>>, Vec<Slot>) {
|
||||
let mut m = Measure::start("get slots");
|
||||
let mut slots_and_storages = self
|
||||
|
@ -8682,12 +8683,7 @@ impl AccountsDb {
|
|||
.map(|slots_and_storages| {
|
||||
slots_and_storages
|
||||
.iter_mut()
|
||||
.filter(|(slot, _)| {
|
||||
self.accounts_index.is_alive_root(*slot)
|
||||
|| ancestors
|
||||
.map(|ancestors| ancestors.contains_key(slot))
|
||||
.unwrap_or_default()
|
||||
})
|
||||
.filter(|(slot, _)| self.accounts_index.is_alive_root(*slot))
|
||||
.filter_map(|(slot, store)| {
|
||||
let store = std::mem::take(store).unwrap();
|
||||
store.has_accounts().then_some((store, *slot))
|
||||
|
|
Loading…
Reference in New Issue