diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index 5c838a87b5..8e729b1f3f 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -600,9 +600,6 @@ impl<'a> MultiThreadProgress<'a> { /// An offset into the AccountsDb::storage vector pub type AtomicAppendVecId = AtomicU32; pub type AppendVecId = u32; -pub type SnapshotStorages = Vec>>; -/// exactly 1 append vec per slot -pub type SnapshotStoragesOne = Vec>; type AccountSlots = HashMap>; type AppendVecOffsets = HashMap>; @@ -8257,7 +8254,7 @@ impl AccountsDb { &self, requested_slots: impl RangeBounds + Sync, ancestors: Option<&Ancestors>, - ) -> (SnapshotStoragesOne, Vec) { + ) -> (Vec>, Vec) { let mut m = Measure::start("get slots"); let mut slots_and_storages = self .storage @@ -9556,7 +9553,10 @@ pub mod tests { fn sample_storages_and_account_in_slot( slot: Slot, accounts: &AccountsDb, - ) -> (SnapshotStoragesOne, Vec) { + ) -> ( + Vec>, + Vec, + ) { let pubkey0 = Pubkey::new(&[0u8; 32]); let pubkey127 = Pubkey::new(&[0x7fu8; 32]); let pubkey128 = Pubkey::new(&[0x80u8; 32]); @@ -9618,7 +9618,10 @@ pub mod tests { fn sample_storages_and_accounts( accounts: &AccountsDb, - ) -> (SnapshotStoragesOne, Vec) { + ) -> ( + Vec>, + Vec, + ) { sample_storages_and_account_in_slot(1, accounts) } @@ -9963,7 +9966,7 @@ pub mod tests { assert_eq!(result, (expected_accounts_hash, sum)); } - fn sample_storage() -> (SnapshotStoragesOne, usize, Slot) { + fn sample_storage() -> (Vec>, usize, Slot) { let (_temp_dirs, paths) = get_temp_accounts_paths(1).unwrap(); let slot_expected: Slot = 0; let size: usize = 123; @@ -10144,7 +10147,7 @@ pub mod tests { } fn append_sample_data_to_storage( - storages: &SnapshotStoragesOne, + storages: &[Arc], pubkey: &Pubkey, write_version: StoredMetaWriteVersion, ) { @@ -10157,7 +10160,7 @@ pub mod tests { write_version: StoredMetaWriteVersion, slot: Slot, pubkey: &Pubkey, - ) -> SnapshotStoragesOne { + ) -> Vec> { sample_storage_with_entries_id(tf, write_version, slot, pubkey, 0) } @@ -10167,7 +10170,7 @@ pub mod tests { slot: Slot, pubkey: &Pubkey, id: AppendVecId, - ) -> SnapshotStoragesOne { + ) -> Vec> { let (_temp_dirs, paths) = get_temp_accounts_paths(1).unwrap(); let size: usize = 123; let mut data = AccountStorageEntry::new(&paths[0], slot, id, size as u64); diff --git a/runtime/src/accounts_hash.rs b/runtime/src/accounts_hash.rs index 97a7ed6f08..3134c7fbc1 100644 --- a/runtime/src/accounts_hash.rs +++ b/runtime/src/accounts_hash.rs @@ -1,6 +1,6 @@ use { crate::{ - accounts_db::{SnapshotStoragesOne, PUBKEY_BINS_FOR_CALCULATING_HASHES}, + accounts_db::{AccountStorageEntry, PUBKEY_BINS_FOR_CALCULATING_HASHES}, ancestors::Ancestors, rent_collector::RentCollector, }, @@ -22,7 +22,7 @@ use { io::{BufWriter, Write}, sync::{ atomic::{AtomicU64, AtomicUsize, Ordering}, - Mutex, + Arc, Mutex, }, }, tempfile::tempfile, @@ -162,7 +162,7 @@ pub struct HashStats { pub count_ancient_scans: AtomicU64, } impl HashStats { - pub fn calc_storage_size_quartiles(&mut self, storages: &SnapshotStoragesOne) { + pub fn calc_storage_size_quartiles(&mut self, storages: &[Arc]) { let mut sum = 0; let mut sizes = storages .iter() diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index d011e3ccda..2849aacde7 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -44,8 +44,8 @@ use { TransactionLoadResult, }, accounts_db::{ - AccountShrinkThreshold, AccountsDbConfig, CalcAccountsHashDataSource, - IncludeSlotInHash, SnapshotStoragesOne, ACCOUNTS_DB_CONFIG_FOR_BENCHMARKS, + AccountShrinkThreshold, AccountStorageEntry, AccountsDbConfig, + CalcAccountsHashDataSource, IncludeSlotInHash, ACCOUNTS_DB_CONFIG_FOR_BENCHMARKS, ACCOUNTS_DB_CONFIG_FOR_TESTING, }, accounts_hash::AccountsHash, @@ -6828,7 +6828,7 @@ impl Bank { /// Get this bank's storages to use for snapshots. /// /// If a base slot is provided, return only the storages that are *higher* than this slot. - pub fn get_snapshot_storages(&self, base_slot: Option) -> SnapshotStoragesOne { + pub fn get_snapshot_storages(&self, base_slot: Option) -> Vec> { // if a base slot is provided, request storages starting at the slot *after* let start_slot = base_slot.map_or(0, |slot| slot.saturating_add(1)); // we want to *include* the storage at our slot diff --git a/runtime/src/snapshot_package.rs b/runtime/src/snapshot_package.rs index 54fdbb46e9..00ba3b6bef 100644 --- a/runtime/src/snapshot_package.rs +++ b/runtime/src/snapshot_package.rs @@ -1,7 +1,7 @@ use { crate::{ accounts::Accounts, - accounts_db::SnapshotStoragesOne, + accounts_db::AccountStorageEntry, accounts_hash::AccountsHash, bank::{Bank, BankSlotDelta}, epoch_accounts_hash::EpochAccountsHash, @@ -36,7 +36,7 @@ pub struct AccountsPackage { pub package_type: AccountsPackageType, pub slot: Slot, pub block_height: Slot, - pub snapshot_storages: SnapshotStoragesOne, + pub snapshot_storages: Vec>, pub expected_capitalization: u64, pub accounts_hash_for_testing: Option, pub accounts: Arc, @@ -62,7 +62,7 @@ impl AccountsPackage { slot_deltas: Vec, full_snapshot_archives_dir: impl AsRef, incremental_snapshot_archives_dir: impl AsRef, - snapshot_storages: SnapshotStoragesOne, + snapshot_storages: Vec>, archive_format: ArchiveFormat, snapshot_version: SnapshotVersion, accounts_hash_for_testing: Option, @@ -125,7 +125,7 @@ impl AccountsPackage { pub fn new_for_epoch_accounts_hash( package_type: AccountsPackageType, bank: &Bank, - snapshot_storages: SnapshotStoragesOne, + snapshot_storages: Vec>, accounts_hash_for_testing: Option, ) -> Self { assert_eq!(package_type, AccountsPackageType::EpochAccountsHash); @@ -141,7 +141,7 @@ impl AccountsPackage { fn _new( package_type: AccountsPackageType, bank: &Bank, - snapshot_storages: SnapshotStoragesOne, + snapshot_storages: Vec>, accounts_hash_for_testing: Option, snapshot_info: Option, ) -> Self { @@ -167,7 +167,7 @@ impl AccountsPackage { package_type: AccountsPackageType::AccountsHashVerifier, slot: Slot::default(), block_height: Slot::default(), - snapshot_storages: SnapshotStoragesOne::default(), + snapshot_storages: Vec::default(), expected_capitalization: u64::default(), accounts_hash_for_testing: Option::default(), accounts: Arc::new(Accounts::default_for_tests()), @@ -239,7 +239,7 @@ pub struct SnapshotPackage { pub block_height: Slot, pub slot_deltas: Vec, pub snapshot_links: TempDir, - pub snapshot_storages: SnapshotStoragesOne, + pub snapshot_storages: Vec>, pub snapshot_version: SnapshotVersion, pub snapshot_type: SnapshotType, } diff --git a/runtime/src/snapshot_utils.rs b/runtime/src/snapshot_utils.rs index 17e9f53cef..6e9e3d0c7d 100644 --- a/runtime/src/snapshot_utils.rs +++ b/runtime/src/snapshot_utils.rs @@ -3,7 +3,7 @@ use { account_storage::AccountStorageMap, accounts_db::{ AccountShrinkThreshold, AccountStorageEntry, AccountsDbConfig, AtomicAppendVecId, - CalcAccountsHashDataSource, SnapshotStoragesOne, + CalcAccountsHashDataSource, }, accounts_index::AccountSecondaryIndexes, accounts_update_notifier_interface::AccountsUpdateNotifier, @@ -2181,7 +2181,7 @@ pub fn purge_old_bank_snapshots(bank_snapshots_dir: impl AsRef) { } /// Get the snapshot storages for this bank -pub fn get_snapshot_storages(bank: &Bank) -> SnapshotStoragesOne { +pub fn get_snapshot_storages(bank: &Bank) -> Vec> { let mut measure_snapshot_storages = Measure::start("snapshot-storages"); let snapshot_storages = bank.get_snapshot_storages(None); measure_snapshot_storages.stop(); @@ -2297,7 +2297,7 @@ pub fn package_and_archive_full_snapshot( bank_snapshots_dir: impl AsRef, full_snapshot_archives_dir: impl AsRef, incremental_snapshot_archives_dir: impl AsRef, - snapshot_storages: SnapshotStoragesOne, + snapshot_storages: Vec>, archive_format: ArchiveFormat, snapshot_version: SnapshotVersion, maximum_full_snapshot_archives_to_retain: usize, @@ -2349,7 +2349,7 @@ pub fn package_and_archive_incremental_snapshot( bank_snapshots_dir: impl AsRef, full_snapshot_archives_dir: impl AsRef, incremental_snapshot_archives_dir: impl AsRef, - snapshot_storages: SnapshotStoragesOne, + snapshot_storages: Vec>, archive_format: ArchiveFormat, snapshot_version: SnapshotVersion, maximum_full_snapshot_archives_to_retain: usize,