Do not add bank snapshots for AccountsHashVerifier requests (#32589)

This commit is contained in:
Brooks 2023-07-25 18:30:06 -04:00 committed by GitHub
parent ef8d3206d7
commit 89c1f94cc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 50 additions and 20 deletions

View File

@ -386,26 +386,38 @@ impl SnapshotRequestHandler {
let mut snapshot_time = Measure::start("snapshot_time"); let mut snapshot_time = Measure::start("snapshot_time");
let snapshot_storages = snapshot_bank_utils::get_snapshot_storages(&snapshot_root_bank); let snapshot_storages = snapshot_bank_utils::get_snapshot_storages(&snapshot_root_bank);
let accounts_package = match request_type { let accounts_package = match request_type {
SnapshotRequestType::Snapshot => { SnapshotRequestType::Snapshot => match &accounts_package_type {
let bank_snapshot_info = snapshot_bank_utils::add_bank_snapshot( AccountsPackageType::Snapshot(_) => {
&self.snapshot_config.bank_snapshots_dir, let bank_snapshot_info = snapshot_bank_utils::add_bank_snapshot(
&snapshot_root_bank, &self.snapshot_config.bank_snapshots_dir,
&snapshot_storages, &snapshot_root_bank,
self.snapshot_config.snapshot_version, &snapshot_storages,
status_cache_slot_deltas, self.snapshot_config.snapshot_version,
)?; status_cache_slot_deltas,
AccountsPackage::new_for_snapshot( )?;
accounts_package_type, AccountsPackage::new_for_snapshot(
&snapshot_root_bank, accounts_package_type,
&bank_snapshot_info, &snapshot_root_bank,
&self.snapshot_config.full_snapshot_archives_dir, &bank_snapshot_info,
&self.snapshot_config.incremental_snapshot_archives_dir, &self.snapshot_config.full_snapshot_archives_dir,
snapshot_storages, &self.snapshot_config.incremental_snapshot_archives_dir,
self.snapshot_config.archive_format, snapshot_storages,
self.snapshot_config.snapshot_version, self.snapshot_config.archive_format,
accounts_hash_for_testing, self.snapshot_config.snapshot_version,
) accounts_hash_for_testing,
} )
}
AccountsPackageType::AccountsHashVerifier => {
// skip the bank snapshot, just make an accounts package to send to AHV
AccountsPackage::new_for_accounts_hash_verifier(
accounts_package_type,
&snapshot_root_bank,
snapshot_storages,
accounts_hash_for_testing,
)
}
AccountsPackageType::EpochAccountsHash => panic!("Illegal account package type: EpochAccountsHash packages must be from an EpochAccountsHash request!"),
},
SnapshotRequestType::EpochAccountsHash => { SnapshotRequestType::EpochAccountsHash => {
// skip the bank snapshot, just make an accounts package to send to AHV // skip the bank snapshot, just make an accounts package to send to AHV
AccountsPackage::new_for_epoch_accounts_hash( AccountsPackage::new_for_epoch_accounts_hash(

View File

@ -93,6 +93,24 @@ impl AccountsPackage {
) )
} }
/// Package up fields needed to verify an accounts hash
#[must_use]
pub fn new_for_accounts_hash_verifier(
package_type: AccountsPackageType,
bank: &Bank,
snapshot_storages: Vec<Arc<AccountStorageEntry>>,
accounts_hash_for_testing: Option<AccountsHash>,
) -> Self {
assert_eq!(package_type, AccountsPackageType::AccountsHashVerifier);
Self::_new(
package_type,
bank,
snapshot_storages,
accounts_hash_for_testing,
None,
)
}
/// Package up fields needed to compute an EpochAccountsHash /// Package up fields needed to compute an EpochAccountsHash
#[must_use] #[must_use]
pub fn new_for_epoch_accounts_hash( pub fn new_for_epoch_accounts_hash(