remove type SnapshotStoragesOne (#29750)
This commit is contained in:
parent
df92d8ff3d
commit
9d2c71b9a3
|
@ -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<Vec<Arc<AccountStorageEntry>>>;
|
||||
/// exactly 1 append vec per slot
|
||||
pub type SnapshotStoragesOne = Vec<Arc<AccountStorageEntry>>;
|
||||
|
||||
type AccountSlots = HashMap<Pubkey, HashSet<Slot>>;
|
||||
type AppendVecOffsets = HashMap<AppendVecId, HashSet<usize>>;
|
||||
|
@ -8257,7 +8254,7 @@ impl AccountsDb {
|
|||
&self,
|
||||
requested_slots: impl RangeBounds<Slot> + Sync,
|
||||
ancestors: Option<&Ancestors>,
|
||||
) -> (SnapshotStoragesOne, Vec<Slot>) {
|
||||
) -> (Vec<Arc<AccountStorageEntry>>, Vec<Slot>) {
|
||||
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<CalculateHashIntermediate>) {
|
||||
) -> (
|
||||
Vec<Arc<AccountStorageEntry>>,
|
||||
Vec<CalculateHashIntermediate>,
|
||||
) {
|
||||
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<CalculateHashIntermediate>) {
|
||||
) -> (
|
||||
Vec<Arc<AccountStorageEntry>>,
|
||||
Vec<CalculateHashIntermediate>,
|
||||
) {
|
||||
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<Arc<AccountStorageEntry>>, 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<AccountStorageEntry>],
|
||||
pubkey: &Pubkey,
|
||||
write_version: StoredMetaWriteVersion,
|
||||
) {
|
||||
|
@ -10157,7 +10160,7 @@ pub mod tests {
|
|||
write_version: StoredMetaWriteVersion,
|
||||
slot: Slot,
|
||||
pubkey: &Pubkey,
|
||||
) -> SnapshotStoragesOne {
|
||||
) -> Vec<Arc<AccountStorageEntry>> {
|
||||
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<Arc<AccountStorageEntry>> {
|
||||
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);
|
||||
|
|
|
@ -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<AccountStorageEntry>]) {
|
||||
let mut sum = 0;
|
||||
let mut sizes = storages
|
||||
.iter()
|
||||
|
|
|
@ -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<Slot>) -> SnapshotStoragesOne {
|
||||
pub fn get_snapshot_storages(&self, base_slot: Option<Slot>) -> Vec<Arc<AccountStorageEntry>> {
|
||||
// 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
|
||||
|
|
|
@ -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<Arc<AccountStorageEntry>>,
|
||||
pub expected_capitalization: u64,
|
||||
pub accounts_hash_for_testing: Option<AccountsHash>,
|
||||
pub accounts: Arc<Accounts>,
|
||||
|
@ -62,7 +62,7 @@ impl AccountsPackage {
|
|||
slot_deltas: Vec<BankSlotDelta>,
|
||||
full_snapshot_archives_dir: impl AsRef<Path>,
|
||||
incremental_snapshot_archives_dir: impl AsRef<Path>,
|
||||
snapshot_storages: SnapshotStoragesOne,
|
||||
snapshot_storages: Vec<Arc<AccountStorageEntry>>,
|
||||
archive_format: ArchiveFormat,
|
||||
snapshot_version: SnapshotVersion,
|
||||
accounts_hash_for_testing: Option<AccountsHash>,
|
||||
|
@ -125,7 +125,7 @@ impl AccountsPackage {
|
|||
pub fn new_for_epoch_accounts_hash(
|
||||
package_type: AccountsPackageType,
|
||||
bank: &Bank,
|
||||
snapshot_storages: SnapshotStoragesOne,
|
||||
snapshot_storages: Vec<Arc<AccountStorageEntry>>,
|
||||
accounts_hash_for_testing: Option<AccountsHash>,
|
||||
) -> 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<Arc<AccountStorageEntry>>,
|
||||
accounts_hash_for_testing: Option<AccountsHash>,
|
||||
snapshot_info: Option<SupplementalSnapshotInfo>,
|
||||
) -> 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<BankSlotDelta>,
|
||||
pub snapshot_links: TempDir,
|
||||
pub snapshot_storages: SnapshotStoragesOne,
|
||||
pub snapshot_storages: Vec<Arc<AccountStorageEntry>>,
|
||||
pub snapshot_version: SnapshotVersion,
|
||||
pub snapshot_type: SnapshotType,
|
||||
}
|
||||
|
|
|
@ -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<Path>) {
|
|||
}
|
||||
|
||||
/// Get the snapshot storages for this bank
|
||||
pub fn get_snapshot_storages(bank: &Bank) -> SnapshotStoragesOne {
|
||||
pub fn get_snapshot_storages(bank: &Bank) -> Vec<Arc<AccountStorageEntry>> {
|
||||
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<Path>,
|
||||
full_snapshot_archives_dir: impl AsRef<Path>,
|
||||
incremental_snapshot_archives_dir: impl AsRef<Path>,
|
||||
snapshot_storages: SnapshotStoragesOne,
|
||||
snapshot_storages: Vec<Arc<AccountStorageEntry>>,
|
||||
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<Path>,
|
||||
full_snapshot_archives_dir: impl AsRef<Path>,
|
||||
incremental_snapshot_archives_dir: impl AsRef<Path>,
|
||||
snapshot_storages: SnapshotStoragesOne,
|
||||
snapshot_storages: Vec<Arc<AccountStorageEntry>>,
|
||||
archive_format: ArchiveFormat,
|
||||
snapshot_version: SnapshotVersion,
|
||||
maximum_full_snapshot_archives_to_retain: usize,
|
||||
|
|
Loading…
Reference in New Issue