Commit Graph

1098 Commits

Author SHA1 Message Date
Yueh-Hsuan Chiang 71b6370426
Abstract out StoredAccountMeta as an Enum (#30478)
#### Problem
The existing StoredAccountMeta requires the file and in-memory layout of
account metadata to match StoredMeta and AccountMeta.  This limits the
flexibility to implement different accounts storage file formats.

#### Summary of Changes
This PR abstracts out StoredAccountMeta as an Enum.
2023-03-09 15:52:51 -08:00
Illia Bobyr 82288d4457
accounts_db::get_all_accounts: Select slots with an iterator (#30581)
As `Range` is a special case of an `Iterator`, this is a generalization
that makes `get_all_accounts()` accept other kinds of ranges.  Such as
`RangeInclusive`.
2023-03-06 12:30:50 -08:00
Yueh-Hsuan Chiang a78ef393bf
Generalize the return value of append_accounts() (#30571)
#### Problem
The existing append_accounts returns a vector of offsets, which accounts-db
later uses it to infer the storage size of each account.  However, such inference
does not apply to the new hot/cold storage format.

#### Summary of Changes
This PR changes the return value of append_accounts() to `Vec<StoredAccountInfo>`,
which includes both offset and storage size information of an account.
2023-03-06 09:52:05 -08:00
Jeff Washington (jwash) b26d470b02
support loading snapshots with > 1 append vec per slot (#30570)
* support loading snapshots with > 1 append vec per slot

* pr feedback

* drain to into_values

* unwrap() -> expect()

* loop to find non-conflicting file and add test
2023-03-06 06:08:57 -08:00
Jeff Washington (jwash) fbcb82dcf8
add index_entries_being_shrunk to ShrinkCollect (#30518) 2023-03-01 17:09:42 -08:00
Yueh-Hsuan Chiang 33e179905f
getter functions for StoredAccountMeta (#30447)
This PR makes all the StoredAccountMeta fields pub(crate)
and provides getter functions to access its member fields.

This PR is a preparation step for abstracting out StoredAccountMeta.
2023-02-27 10:03:22 -08:00
Jeff Washington (jwash) 45a34f637b
move BankCreationFreezingProgress to its own file (#30510) 2023-02-24 14:05:39 -08:00
Jeff Washington (jwash) 31573beb2d
use slot instead of store_id in clean (#30472)
* use slot instead of store_id in clean

* update debug
2023-02-24 12:01:16 -08:00
Jeff Washington (jwash) 9080b36192
use local for store_id in write_accounts_to_storage (#30500) 2023-02-24 11:50:57 -08:00
Brooks e0abad43c3
Removes checks for bank_hash_stats in test (#30480) 2023-02-24 14:35:36 -05:00
Jeff Washington (jwash) 7c086ca42d
add DiskIndexValue trait for disk index (#30503) 2023-02-24 11:02:06 -08:00
Jeff Washington (jwash) 0a75be399b
dirty_stores key is slot and not AppendVecId (#30474) 2023-02-24 07:17:09 -08:00
Brooks b7d31e134c
Refactors Accounts::new_from_parent() (#30475) 2023-02-23 16:50:51 -05:00
Jeff Washington (jwash) 2c7d9f988e
use slot with store id in some clean paths (#30473) 2023-02-23 13:50:25 -08:00
Jeff Washington (jwash) 9ddb89226c
remove_dead_accounts uses slot instead of AppendVecId (#30471) 2023-02-23 13:20:33 -08:00
Jeff Washington (jwash) e39626ab14
add second type to accounts index for disk (#30446) 2023-02-23 13:05:06 -08:00
Jeff Washington (jwash) 6df160bedd
get stored_size from StoredAccountMeta (#30456) 2023-02-23 12:33:35 -08:00
Jeff Washington (jwash) c032dc2754
add bank progress stats (#30405)
* add bank progress stats

* handle more bank creation code paths

* use wrapping sub
2023-02-23 06:29:02 -08:00
Jeff Washington (jwash) 9ecc4462f8
cleanup test type (#30453) 2023-02-23 06:26:55 -08:00
Yueh-Hsuan Chiang ac7e7aa8f0
Move account-meta structs from append_vec.rs to account_meta.rs (#30443)
#### Problem
As we start supporting new storage formats, those account-meta
structs will be shared by different storage formats and thus need
a new home.

#### Summary of Changes
This PR creates meta.rs under account_storage and moves all the account-meta
structs out from append_vec.rs.
2023-02-22 16:10:34 -08:00
Jeff Washington (jwash) 6a66d4631c
remove 'stored_size' from account info (#30407) 2023-02-22 07:04:21 -08:00
Brooks 35328ca63d
Makes AccountsHash an enum (#30416) 2023-02-21 15:20:51 -05:00
Jeff Washington (jwash) 568a4b1ca0
move AccountInfo bits from size to offset (#30408)
* move AccountInfo bits from size to offset

* feedback
2023-02-21 10:08:37 -08:00
Jeff Washington (jwash) 46b42e1888
add hash calc scan_chunks metric (#30333) 2023-02-20 12:55:48 -08:00
Brooks ec288ded9b
Serde snapshot uses own types (#30391) 2023-02-20 12:25:15 -05:00
Brooks ad6a3abd8b
Uses set_accounts_{delta,}_hash_for_tests() in serde tests (#30390) 2023-02-17 16:00:25 -05:00
Brooks f91e63dfe9
Upgrades Rust to 1.67.1 (#29947) 2023-02-17 14:08:27 -05:00
Yueh-Hsuan Chiang aeb6df3507
Abstract out AppendVec into AccountsFile enum (#29815)
Abstracts out AppendVec into AccountsFile enum.
This will allow different implementations of AccountsFile that support the AccountsDB.
2023-02-15 17:24:04 -08:00
HaoranYi 615d1a8b69
Extract BankHashLamportsVerifyConfig (#30320)
* refactor BankHashLamportsVerifyConfig

* clippy

* comments

* fix bench
2023-02-15 16:03:50 -06:00
Andrew Fitzgerald b86bfbb5c5
measure_us! use Instant and duration_to_us internally (#30339) 2023-02-15 12:43:47 -08:00
Pankaj Garg 3bea5fc326
Return index of matching owner for a program account (#30337) 2023-02-15 19:41:29 +00:00
Xiang Zhu 4909267c88
Add accounts hard-link files into the bank snapshot directory (#29496)
* Add accounts hard-link files into the bank snapshot directory

* Small adjustments and fixes.

* Address some of the review issues

* Fix compilation issues

* Change the latest slot snapshot storage from VecDeque to Option

* IoWithSourceAndFile and expanded comments on accounts

* last_slot_snapshot_storages in return value

* Update comments following the review input

* rename dir_accounts_hard_links to hard_link_path

* Add dir_full_state flag for add_bank_snapshot

* Let appendvec files hardlinking work with multiple accounts paths across multiple partitions

* Fixes for rebasing

* fix tests which generates account_path without adding run/

* rebasing fixes

* fix account path test failures

* fix test test_concurrent_snapshot_packaging

* review comments.  renamed the path setup function

* Addressed most of the review comments

* update with more review comments

* handle error from create_accounts_run_and_snapshot_dirs

* fix rebasing duplicate

* minor accounts_dir path cleanup

* minor cleanup, remove commented code

* misc review comments

* build error fix

* Fix test_incremental_snapshot_download_with_crossing_full_snapshot_interval_at_startup

* fix build error on MAX_BANK_SNAPSHOTS_TO_RETAIN

* rebase fix, update hardlink filename

* minor comment spelling fix

* rebasing fixes

* fix rebase issues; with_extension

* comments changes for review

* misc minor review issues

* bank.fill_bank_with_ticks_for_tests

* error handling on appendvec path

* fix use_jit

* minor comments refining

* Remove type AccountStorages

* get_account_path_from_appendvec_path return changed to Option

* removed appendvec_path.to_path_buf in create_accounts_run_and_snapshot_dirs

* add test_get_snapshot_accounts_hardlink_dir

* update last_snapshot_storages comment

* update last_snapshot_storages comment

* symlink map_err

* simplify test_get_snapshot_accounts_hardlink_dir with fake paths

* log last_snapshot_storages at the end of the loop
2023-02-15 09:52:07 -08:00
Brooks 2e885cf99a
Removes calls to insert_default_bank_hash_stats() in tests (#30311) 2023-02-14 15:00:38 -05:00
HaoranYi 27f18f96e8
typos, clippy and saturating_add_assign (#30272)
* typo

* remove clippy allow

---------

Co-authored-by: haoran <haoran@mbook>
2023-02-14 10:03:16 -06:00
Jeff Washington (jwash) 253517cba3
add combine_ancient_slots_packed (#30276)
* add combine_ancient_slots_new

* pr feedback

* implement ==
2023-02-14 06:53:31 -08:00
Jeff Washington (jwash) a46ba32e9a
remove unused metric (#30248) 2023-02-10 13:36:22 -08:00
Jeff Washington (jwash) 157a9d725f
add ancient pack_ancient_storages (#30235)
* add ancient pack_ancient_storages

* cleanup
2023-02-10 12:06:36 -08:00
Jeff Washington (jwash) 12411e5215
pass shrink_can_be_active through shrink fns (#30244) 2023-02-10 10:06:40 -08:00
Jeff Washington (jwash) fc8c590375
improve debugging test fn compare_all_accounts (#30218) 2023-02-09 15:06:09 -08:00
ivandzen 2f9146e8c8
Replace txn_signature in ReplicaAccountInfo with transaction (#30189)
#### Current implementation of ReplicaAccountInfo restricts
possibilities for inflight account filtration
Current implementation includes transaction signature in
ReplicaAccountInfo. This approach does not allow to filter accounts by
matching other accounts in transaction in-flight (e. g. accept only
those accounts included in transactions for specific programs). Current
implementation forces to collect ALL accounts and transactions for some
period of time and perform such complex filtration afterwards.

#### Pass reference to transaction object instead of transaction
signature into ReplicaAccountInfo
Advanced in-flight filtration can be implemented in plugins by passing
reference to transaction for every update_account event. This change
doesn't bring any overhead comparing to current implementation (only
data type of reference is changed) and brings only minor changes in
source code.
2023-02-09 12:00:33 -08:00
Jeff Washington (jwash) 62b93df1c7
change ancient tests to correct size (#30221)
#### Problem
fix tests to be more realistic

#### Summary of Changes
allocate correctly sized append vecs

Fixes #
<!-- OPTIONAL: Feature Gate Issue: # -->
<!-- Don't forget to add the "feature-gate" label -->
2023-02-09 11:41:36 -08:00
Jeff Washington (jwash) e0d354f542
fix bug in test fn compare_all_accounts (#30217)
#### Problem
test code compares sets of accounts after clean/shrink operations.
The indexing was off and new tests were giving false positives.
The test code was equivalent as long as everything was in the same
order.

#### Summary of Changes
Fix test code comparison indexes.

Fixes #
<!-- OPTIONAL: Feature Gate Issue: # -->
<!-- Don't forget to add the "feature-gate" label -->
2023-02-09 11:28:53 -08:00
Jeff Washington (jwash) 68b2b1badd
add ancient calc_accounts_to_combine (#30195)
#### Problem
Building new algorithm for packing ancient storage. Packing will occur
in 1 pass across multiple ancient slots.
This will be put in 1 dead code piece at a time with tests until all
pieces are present. Switch between current packing algorithm and this
new one is in a validator cli argument. Resulting append vecs are
correct and compatible (as a set) either way. When a new storage format
optimized for cold storage becomes available, it will only work with
this new packing algorithm, so the change will need to be complete prior
to the new storage format.

#### Summary of Changes
Add `ancient calc_accounts_to_combine` to separate accounts to prepare
for creating packed ancient append vecs. This will be used soon.

Fixes #
<!-- OPTIONAL: Feature Gate Issue: # -->
<!-- Don't forget to add the "feature-gate" label -->
2023-02-09 11:06:17 -08:00
Jeff Washington (jwash) a4fb1834d1
AliveAccounts includes source slot (#30208) 2023-02-09 05:57:58 -08:00
Jeff Washington (jwash) 0ca638648b
add shrink_can_be_active to remove (#30191) 2023-02-08 11:32:18 -08:00
Jeff Washington (jwash) b4fe1280b3
add Debug to some structs (#30193) 2023-02-08 10:17:07 -08:00
Jeff Washington (jwash) 427bd62642
handle_dropped_roots_for_ancient takes iter (#30190) 2023-02-08 09:40:49 -08:00
Jeff Washington (jwash) 0da4697b2f
add ancient write_ancient_accounts (#30182) 2023-02-08 09:40:17 -08:00
Jeff Washington (jwash) e14d0638e7
add ancient get_unique_accounts_from_storage_for_combining_ancient_slots (#30176) 2023-02-07 18:22:54 -08:00
Pankaj Garg d0623a38c8
API to match account owner against a set of owners (#30154) 2023-02-07 17:48:10 -08:00