allow accounts hash calc to specify enable_rehashing (#27615)
This commit is contained in:
parent
a31d4a597d
commit
22007a3c96
|
@ -130,6 +130,8 @@ impl AccountsHashVerifier {
|
|||
};
|
||||
timings.calc_storage_size_quartiles(&accounts_package.snapshot_storages);
|
||||
|
||||
let enable_rehashing = true;
|
||||
|
||||
let (accounts_hash, lamports) = accounts_package
|
||||
.accounts
|
||||
.accounts_db
|
||||
|
@ -143,6 +145,7 @@ impl AccountsHashVerifier {
|
|||
rent_collector: &accounts_package.rent_collector,
|
||||
store_detailed_debug_info_on_failure: false,
|
||||
full_snapshot: None,
|
||||
enable_rehashing,
|
||||
},
|
||||
&sorted_storages,
|
||||
timings,
|
||||
|
@ -166,6 +169,7 @@ impl AccountsHashVerifier {
|
|||
rent_collector: &accounts_package.rent_collector,
|
||||
store_detailed_debug_info_on_failure: false,
|
||||
full_snapshot: None,
|
||||
enable_rehashing,
|
||||
},
|
||||
);
|
||||
info!(
|
||||
|
@ -186,6 +190,7 @@ impl AccountsHashVerifier {
|
|||
// now that we've failed, store off the failing contents that produced a bad capitalization
|
||||
store_detailed_debug_info_on_failure: true,
|
||||
full_snapshot: None,
|
||||
enable_rehashing,
|
||||
},
|
||||
&sorted_storages,
|
||||
HashStats::default(),
|
||||
|
|
|
@ -195,6 +195,7 @@ impl SnapshotRequestHandler {
|
|||
rent_collector: snapshot_root_bank.rent_collector(),
|
||||
store_detailed_debug_info_on_failure: false,
|
||||
full_snapshot: None,
|
||||
enable_rehashing: true,
|
||||
},
|
||||
).unwrap();
|
||||
assert_eq!(previous_hash, this_hash);
|
||||
|
|
|
@ -1840,7 +1840,11 @@ impl<'a, T: Fn(Slot) -> Option<Slot> + Sync + Send + Clone> AppendVecScan for Sc
|
|||
|
||||
let balance = loaded_account.lamports();
|
||||
let loaded_hash = loaded_account.loaded_hash();
|
||||
let new_hash = ExpectedRentCollection::maybe_rehash_skipped_rewrite(
|
||||
let new_hash = self
|
||||
.config
|
||||
.enable_rehashing
|
||||
.then(|| {
|
||||
ExpectedRentCollection::maybe_rehash_skipped_rewrite(
|
||||
loaded_account,
|
||||
&loaded_hash,
|
||||
pubkey,
|
||||
|
@ -1851,7 +1855,9 @@ impl<'a, T: Fn(Slot) -> Option<Slot> + Sync + Send + Clone> AppendVecScan for Sc
|
|||
&self.max_slot_info,
|
||||
self.find_unskipped_slot,
|
||||
self.filler_account_suffix,
|
||||
);
|
||||
)
|
||||
})
|
||||
.flatten();
|
||||
let loaded_hash = new_hash.unwrap_or(loaded_hash);
|
||||
|
||||
let source_item = CalculateHashIntermediate::new(loaded_hash, balance, *pubkey);
|
||||
|
@ -6433,7 +6439,8 @@ impl AccountsDb {
|
|||
self.find_unskipped_slot(slot, config.ancestors)
|
||||
};
|
||||
let loaded_hash = loaded_account.loaded_hash();
|
||||
let new_hash = ExpectedRentCollection::maybe_rehash_skipped_rewrite(
|
||||
let new_hash = config.enable_rehashing
|
||||
.then(|| ExpectedRentCollection::maybe_rehash_skipped_rewrite(
|
||||
&loaded_account,
|
||||
&loaded_hash,
|
||||
pubkey,
|
||||
|
@ -6444,7 +6451,7 @@ impl AccountsDb {
|
|||
&max_slot_info,
|
||||
find_unskipped_slot,
|
||||
self.filler_account_suffix.as_ref(),
|
||||
);
|
||||
)).flatten();
|
||||
let loaded_hash = new_hash.unwrap_or(loaded_hash);
|
||||
let balance = loaded_account.lamports();
|
||||
if config.check_hash && !self.is_filler_account(pubkey) { // this will not be supported anymore
|
||||
|
@ -6997,6 +7004,7 @@ impl AccountsDb {
|
|||
rent_collector,
|
||||
store_detailed_debug_info_on_failure: false,
|
||||
full_snapshot: None,
|
||||
enable_rehashing: true,
|
||||
},
|
||||
expected_capitalization,
|
||||
)
|
||||
|
@ -7295,6 +7303,7 @@ impl AccountsDb {
|
|||
rent_collector,
|
||||
store_detailed_debug_info_on_failure: store_hash_raw_data_for_debug,
|
||||
full_snapshot: None,
|
||||
enable_rehashing: true,
|
||||
},
|
||||
None,
|
||||
)?;
|
||||
|
@ -11911,6 +11920,7 @@ pub mod tests {
|
|||
rent_collector: &RENT_COLLECTOR,
|
||||
store_detailed_debug_info_on_failure: false,
|
||||
full_snapshot: None,
|
||||
enable_rehashing: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,6 +54,8 @@ pub struct CalcAccountsHashConfig<'a> {
|
|||
pub rent_collector: &'a RentCollector,
|
||||
/// used for tracking down hash mismatches after the fact
|
||||
pub store_detailed_debug_info_on_failure: bool,
|
||||
/// true if hash calculation can rehash based on skipped rewrites
|
||||
pub enable_rehashing: bool,
|
||||
/// `Some` if this is an incremental snapshot which only hashes slots since the base full snapshot
|
||||
pub full_snapshot: Option<FullSnapshotAccountsHashInfo>,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue