From bdba36eade4cc48849bcad4a2897ed2a7a7d920d Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang Date: Wed, 20 Mar 2024 11:53:24 -0700 Subject: [PATCH] Enable accountsdb_scan_account_storage_no_bank tests for hot storage. --- accounts-db/src/accounts_db.rs | 35 +++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/accounts-db/src/accounts_db.rs b/accounts-db/src/accounts_db.rs index 1a4bcd078ca9b3..d8f5f44a4a321f 100644 --- a/accounts-db/src/accounts_db.rs +++ b/accounts-db/src/accounts_db.rs @@ -1030,7 +1030,7 @@ pub struct AccountStorageEntry { } impl AccountStorageEntry { - pub fn new( + pub fn new( path: &Path, slot: Slot, id: AccountsFileId, @@ -1038,7 +1038,7 @@ impl AccountStorageEntry { ) -> Self { let tail = AccountsFile::file_name(slot, id); let path = Path::new(path).join(tail); - let accounts = AFP::new_writable(path, file_size); + let accounts = AP::new_writable(path, file_size); Self { id, @@ -9509,6 +9509,7 @@ pub mod tests { crate::{ account_info::StoredSize, account_storage::meta::{AccountMeta, StoredMeta}, + accounts_file::{AppendVecProvider, HotStorageProvider}, accounts_hash::MERKLE_FANOUT, accounts_index::{tests::*, AccountSecondaryIndexesIncludeExclude}, ancient_append_vecs, @@ -10592,8 +10593,11 @@ pub mod tests { } } - #[test] - fn test_accountsdb_scan_account_storage_no_bank() { + #[test_case(AppendVecProvider; "append_vec")] + #[test_case(HotStorageProvider; "hot_storage")] + fn test_accountsdb_scan_account_storage_no_bank( + _accounts_file_provider: AP, + ) { solana_logger::setup(); let expected = 1; @@ -10603,10 +10607,9 @@ pub mod tests { let (_temp_dirs, paths) = get_temp_accounts_paths(1).unwrap(); let slot_expected: Slot = 0; let size: usize = 123; - let mut data = - AccountStorageEntry::new::(&paths[0], slot_expected, 0, size as u64); - let av = AccountsFile::AppendVec(AppendVec::new(&tf.path, true, 1024 * 1024)); - data.accounts = av; + let mut data = AccountStorageEntry::new::(&paths[0], slot_expected, 0, size as u64); + let accounts_file = AP::new_writable(&tf.path, 1024 * 1024); + data.accounts = accounts_file; let storage = Arc::new(data); let pubkey = solana_sdk::pubkey::new_rand(); @@ -10709,21 +10712,23 @@ pub mod tests { } } - #[test] - fn test_accountsdb_scan_account_storage_no_bank_one_slot() { + #[test_case(AppendVecProvider; "append_vec")] + #[test_case(HotStorageProvider; "hot_storage")] + fn test_accountsdb_scan_account_storage_no_bank_one_slot( + _accounts_file_provider: AP, + ) { solana_logger::setup(); let expected = 1; let tf = crate::append_vec::test_utils::get_append_vec_path( - "test_accountsdb_scan_account_storage_no_bank", + "test_accountsdb_scan_account_storage_no_bank_one_slot", ); let (_temp_dirs, paths) = get_temp_accounts_paths(1).unwrap(); let slot_expected: Slot = 0; let size: usize = 123; - let mut data = - AccountStorageEntry::new::(&paths[0], slot_expected, 0, size as u64); - let av = AccountsFile::AppendVec(AppendVec::new(&tf.path, true, 1024 * 1024)); - data.accounts = av; + let mut data = AccountStorageEntry::new::(&paths[0], slot_expected, 0, size as u64); + let accounts_file = AP::new_writable(&tf.path, 1024 * 1024); + data.accounts = accounts_file; let storage = Arc::new(data); let pubkey = solana_sdk::pubkey::new_rand();