Enable accountsdb_scan_account_storage_no_bank tests for hot storage#344
Conversation
| // promote this to panic soon. | ||
| // disabled due to many false positive warnings while running tests. | ||
| // blocked by rpc's upgrade to jsonrpc v17 | ||
| /* | ||
| panic!( | ||
| "TieredStorage failed to remove backing storage file '{}': {err}", | ||
| self.path.display(), | ||
| ); | ||
| );*/ | ||
| inc_new_counter_info!("append_vec_drop_fail", 1); |
There was a problem hiding this comment.
This section was copied from the AppendVec. The test will fail without this as some tests sometimes create an empty AccountsFile instance without writing it causing nothing to be dropped.
There was a problem hiding this comment.
Which test(s) fail? Can we usually ManuallyDrop, like we do in the append vec tests here?
agave/accounts-db/src/append_vec.rs
Lines 1205 to 1206 in b2f4fb3
There was a problem hiding this comment.
Also, when we talked about this offline, can you check if the error is for "file not found" or not? If the error is something else, maybe panic still is the right call.
There was a problem hiding this comment.
The counter name should not be "append_vec" though.
There was a problem hiding this comment.
The enabled tests here will fail because of this. But I think skipping no-such-file-or-directory error should address the problem as we previously discussed.
Manual-drop works as well.
thread 'accounts_db::tests::test_accountsdb_scan_account_storage_no_bank_one_slot' panicked at accounts-db/src/tiered_storage.rs:67:13:
TieredStorage failed to remove backing storage file '/var/folders/2_/848_htk13yb0b_r0wg105t400000gn/T/.tmpFVnzMY/run/0.0': No such file or directory (os error 2)
There was a problem hiding this comment.
Fixed in #446 that keeps the panic behavior but exclude io::ErrorKind::NotFound.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #344 +/- ##
=======================================
Coverage 81.8% 81.8%
=======================================
Files 843 843
Lines 228586 228677 +91
=======================================
+ Hits 187124 187209 +85
- Misses 41462 41468 +6 🚀 New features to boost your workflow:
|
| #[test] | ||
| fn test_accountsdb_scan_account_storage_no_bank() { | ||
| accountsdb_scan_account_storage_no_bank_test_case::<WritableAppendVecProvider>(); | ||
| accountsdb_scan_account_storage_no_bank_test_case::<WritableHotStorageProvider>(); | ||
| } | ||
|
|
There was a problem hiding this comment.
@brooksprumo: Just want to get quick feedback from you. Here's the way that I am currently developing to enable accounts-db tests for both AppendVec and TieredStorage. Does it look good to you?
There was a problem hiding this comment.
You may be able to use test_case to generate these easier. It'll also then create two proper tests, so we can see pass/fail on each accounts file type separately.
Here's an example with generics: https://github.com/frondeus/test-case/blob/master/tests/acceptance_cases/cases_support_generics/src/lib.rs
There was a problem hiding this comment.
Neat! This is great! Thanks for the pointer!
There was a problem hiding this comment.
Changed the test to use test_case
brooksprumo
left a comment
There was a problem hiding this comment.
I can't think of anything better, so seems good for now. The non-test code should be monomorphized and the compiler should optimize any indirection away (I believe/hope!).
| // promote this to panic soon. | ||
| // disabled due to many false positive warnings while running tests. | ||
| // blocked by rpc's upgrade to jsonrpc v17 | ||
| /* | ||
| panic!( | ||
| "TieredStorage failed to remove backing storage file '{}': {err}", | ||
| self.path.display(), | ||
| ); | ||
| );*/ | ||
| inc_new_counter_info!("append_vec_drop_fail", 1); |
There was a problem hiding this comment.
Also, when we talked about this offline, can you check if the error is for "file not found" or not? If the error is something else, maybe panic still is the right call.
| footer::{AccountBlockFormat, AccountMetaFormat}, | ||
| hot::{HotStorageWriter, HOT_FORMAT}, | ||
| index::IndexBlockFormat, | ||
| log::log_enabled, |
| // promote this to panic soon. | ||
| // disabled due to many false positive warnings while running tests. | ||
| // blocked by rpc's upgrade to jsonrpc v17 | ||
| /* | ||
| panic!( | ||
| "TieredStorage failed to remove backing storage file '{}': {err}", | ||
| self.path.display(), | ||
| ); | ||
| );*/ | ||
| inc_new_counter_info!("append_vec_drop_fail", 1); |
There was a problem hiding this comment.
The counter name should not be "append_vec" though.
| #[test] | ||
| fn test_accountsdb_scan_account_storage_no_bank() { | ||
| accountsdb_scan_account_storage_no_bank_test_case::<WritableAppendVecProvider>(); | ||
| accountsdb_scan_account_storage_no_bank_test_case::<WritableHotStorageProvider>(); | ||
| } | ||
|
|
There was a problem hiding this comment.
You may be able to use test_case to generate these easier. It'll also then create two proper tests, so we can see pass/fail on each accounts file type separately.
Here's an example with generics: https://github.com/frondeus/test-case/blob/master/tests/acceptance_cases/cases_support_generics/src/lib.rs
|
|
||
| impl AccountStorageEntry { | ||
| pub fn new(path: &Path, slot: Slot, id: AppendVecId, file_size: u64) -> Self { | ||
| pub fn new<T: WritableAccountsFileProvider>( |
There was a problem hiding this comment.
Please only use T when it's a container and the container can hold any arbitrary type.
How about something like AF instead?
There was a problem hiding this comment.
Done. Used AP (stands for AccountsFile Provider).
02462f9 to
ec97e39
Compare
|
Rebased on top of the updated #334. Used |
351322c to
bdba36e
Compare
bdba36e to
9b60781
Compare
|
@brooksprumo I think the other changes are no longer part of this pr. |
brooksprumo
left a comment
There was a problem hiding this comment.
![]()
To make sure this PR still built, I checked it out and rebased on master. It successfully passed cargo clippy --tests.
Problem
test_accountsdb_scan_account_storage_no_bank_one_slot and
test_accountsdb_scan_account_storage_no_bank only run for AppendVec.
Summary of Changes
Enable the above two tests to cover both AppendVec and HotStorage.
Test Plan
Run the newly enabled tests.
Dependency
#334, #446