Commit Graph

377 Commits

Author SHA1 Message Date
Jeff Washington (jwash) dcc195e060
when flushing write cache, ignore reclaims (#581) 2024-04-04 16:13:00 -05:00
Jeff Washington (jwash) ccdfd9a4d2
rework remove_dead_accounts.reclaimed_offsets (#571) 2024-04-04 12:28:07 -05:00
steviez a088364eb0
Use std::num::Saturating over saturating_add_assign!() (#523)
std::num::Saturating allows us to create integers that will override
the standard arithmetic operators to use saturating math. This removes
the need for a custom macro as well as reduces mental load as someone
only needs to remember that they want saturating math once.

This PR introduces std::num::Saturating integers to replace all
use of saturating_add_assign!() in the accounts-db crate
2024-04-04 10:14:53 -05:00
Jeff Washington (jwash) 527cad2b22
don't try to ancient pack already large storages (#548) 2024-04-04 10:05:13 -05:00
Jeff Washington (jwash) 854a5b4929
stop once we need 10 storages (#549) 2024-04-03 14:56:02 -05:00
Jeff Washington (jwash) f610e7a06a
rework handle_reclaims ReclaimResult (#563) 2024-04-03 13:47:58 -05:00
Jeff Washington (jwash) 51c51ddf6d
cleanup `handle_reclaims` (#552)
get rid of `Option` on clean path
2024-04-03 11:46:33 -05:00
Brooks afa65c6690
Removes write version from StorableAccountsWithHashesAndWriteVersions (#561) 2024-04-03 12:41:20 -04:00
Brooks ce1f41e547
Removes write version from StorableAccounts (#542) 2024-04-03 10:21:11 -04:00
Jeff Washington (jwash) 57572d59c8
add scan_index for improving index generation (#524)
* add scan_index for improving index generation

* pr feedback

* rework some stuff from pr feedback

* get rid of redundant if

* deal with rent correctly
2024-04-03 09:19:01 -05:00
Brooks 4247a8a546
Archives storages directly (#503) 2024-04-02 18:43:38 +00:00
Jeff Washington (jwash) ccb09866b5
stop requiring data allocation to check for rent (#543) 2024-04-02 13:25:43 -05:00
HaoranYi 9ea627c16d
Recompute hash on load if default hash is stored for the account (#519)
recompute hash on load if default hash is stored for the account

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2024-04-02 13:10:18 -05:00
Jeff Washington (jwash) c59143b980
add get_stored_account to append vec (#508)
* add get_stored_account to append vec

* Update accounts-db/src/append_vec.rs

Co-authored-by: Brooks <brooks@prumo.org>

* renames

* accountshash -> accounthash

---------

Co-authored-by: Brooks <brooks@prumo.org>
2024-04-02 11:39:11 -05:00
Jeff Washington (jwash) 90999017a4
no need to call handle_reclaims if reclaims was not populated (#527) 2024-04-02 11:22:49 -05:00
Brooks 01855eda43
Sets write version to 0 when storing accounts (#476) 2024-04-02 11:27:23 -04:00
Yueh-Hsuan Chiang e8159251e9
Enable accountsdb_scan_account_storage_no_bank tests for hot storage (#344)
Enable accountsdb_scan_account_storage_no_bank tests for hot storage.
2024-04-02 08:58:13 -05:00
Yueh-Hsuan Chiang b47a4ec74d
[TieredStorage] Make TieredStorage's Offset compatible with AccountsDB's offset (#74)
* [TieredStorage] Handles reduced-offset and offset conversion

* fix comment

---------

Co-authored-by: jeff washington <jeff.washington@solana.com>
2024-04-01 16:26:41 -05:00
Yueh-Hsuan Chiang 8153c52938
[TieredStorage] enum-based AccountsFileProvider (#457)
* [TieredStorage] enum-based AccountsFileProvider

* derive traits

* remove refs

---------

Co-authored-by: jeff washington <jeff.washington@solana.com>
2024-04-01 20:54:45 +00:00
Yueh-Hsuan Chiang a5aee48722
Rename append vec to accounts file for CurrentAncientAppendVec (#447) 2024-04-01 15:54:14 -05:00
Jeff Washington (jwash) d9dfe0f8ca
rework account load with check_and_get_loaded_account_shared_data (#506) 2024-04-01 19:48:17 +00:00
Jeff Washington (jwash) 620f5658da
introduce scan_pubkeys for clean storage iteration (#507)
* introduce pubkey_iter for clean storage iteration

* rename scan_pubkeys

* pr feedback

* pr feedback
2024-04-01 12:07:41 -05:00
Brooks 288d5ba121
Moves where modules are included in accounts_db.rs (#515) 2024-04-01 09:51:59 -04:00
sakridge e0e659680a
Remove duplicated token ids and use a shared inline-spl crate (#456) 2024-04-01 14:31:04 +02:00
Jeff Washington (jwash) e56d314df5
determine if account is in write cache earlier (#504) 2024-03-29 17:10:02 -05:00
Jeff Washington (jwash) 18c32aba35
disable read cache while populating stakes cache on load (#482)
* dsiable read cache while populating stakes cache on load

* use struct with drop as api

* use LoadHint

* remove disable_read_cache_updates_count

* add comment

* fmt
2024-03-29 15:20:38 -05:00
Jeff Washington (jwash) e261e2704a
store only removes from read cache if slot is possibly present (#452)
* store only removes from read cache if slot is possibly present

* remove_assume_not_present
2024-03-28 17:00:48 -05:00
Brooks d5c0c0b1c2
Removes support for loading snapshots with > 1 append vec per slot (#474) 2024-03-28 16:32:17 -04:00
Yueh-Hsuan Chiang 4b9e1e0ab3
[TieredStorage] Exclude NotFound in reporting storage leakage on drop() (#446)
#### Problem
TieredStorage::drop() currently panic when it fails to delete the
underlying file to raise awareness of possible storage resource
leakage, including io::ErrorKind::NotFound.  But sometimes the
TieredStorage (or AccountsFile in general) instance is created
then dropped without any file being created.  This causes some
false-alarms including unit-tests.

#### Summary of Changes
This PR excludes NotFound in reporting storage leakage on
TieredStorage::drop().
2024-03-27 09:43:38 -07:00
Brooks 21fbde741a
Uses Into<PathBuf> for path in AccountsFile::new_from_file() (#434) 2024-03-26 16:19:06 -04:00
Brooks 21b6821885
Uses Into<PathBuf> for path in AppendVec::new() (#433) 2024-03-26 14:44:17 -04:00
Brooks b2b159ad92
Adds bench for writing accounts to append vecs and hot storage (#421) 2024-03-26 10:44:23 -04:00
Brooks 8e37ad7665
Removes unused dependencies from accounts-db crate (#416) 2024-03-26 09:30:06 -04:00
Yueh-Hsuan Chiang c7dba30f4f
[TieredStorage] Disable accounts-file type check before enabling tiered-storage (#418)
#### Problem
As #72 introduced AccountsFile::TieredStorage, it also performs
file-type check when opening an accounts-file to determine whether
it is a tiered-storage or an append-vec.  But before tiered-storage is
enabled, this opening check is unnecessary.

#### Summary of Changes
Remove the accounts-file type check code and simply assume everything
is append-vec on AccountsFile::new_from_file().
2024-03-25 12:08:48 -07:00
Yueh-Hsuan Chiang a916edb7a2
[TieredStorage] Add AccountsFile::TieredStorage (#72)
#### Problem
AccountsFile currently doesn't have an implementation for TieredStorage.
To enable AccountsDB tests for the TieredStorage, we need AccountsFile
to support TieredStorage.

#### Summary of Changes
This PR implements a AccountsFile::TieredStorage, a thin wrapper between
AccountsFile and TieredStorage.
2024-03-24 16:41:36 -07:00
Yueh-Hsuan Chiang 602471257e
[TieredStorage] Add capacity() API and limit file size to 16GB (#401)
#### Problem
The TieredStorage has not yet implemented the AccountsFile::capacity()
API.

#### Summary of Changes
Implement capacity() API for TieredStorage and limit file size to 16GB,
same as the append-vec file.
2024-03-23 22:14:19 -07:00
Yueh-Hsuan Chiang e9cc9f8379
[TieredStorage] Refactor file_size() code path (#400)
#### Problem
TieredStorage::file_size() essentially supports AccountsFile::len(),
but its API is inconsistent with AccountsFile's.

#### Summary of Changes
Refactor TieredStorage::file_size() to ::len() and share the same API
as AccountsFile's.

#### Test Plan
Build
Existing unit-tests.
2024-03-22 14:21:24 -07:00
Yueh-Hsuan Chiang f1a82cb666
[TieredStorage] Use mmap.len() in TieredStorage::file_size() for HotStorage (#381)
#### Problem
The current implementation of TieredStorage::file_size() requires
a sys-call to provide the file size.

#### Summary of Changes
Add len() API to TieredStorageReader, and have HotStorageReader()
implement the API using Mmap::len().

#### Test Plan
Update existing unit-test to also verify HotStorageReader::len().
2024-03-22 11:56:30 -07:00
Yueh-Hsuan Chiang 977b1b836f
Rename AppendVecId to AccountsFileId (#383)
#### Problem
The current AppendVecId actually refers to an accounts file id.

#### Summary of Changes
Rename AppendVecId to AccountsFileId.

#### Test Plan
Build
2024-03-22 11:25:30 -07:00
Brooks 24fe473b46
clippy: Automated fixes for Rust 1.77.0 (#390) 2024-03-22 13:48:46 -04:00
Brooks cbd0369da1
Uses AppendVecId in AccountsFIle::file_name() (#372) 2024-03-21 21:27:03 -04:00
Brooks 8b66a670b7
Removes AccountsFile::is_recyclable() (#359) 2024-03-21 15:09:26 -04:00
Yueh-Hsuan Chiang 3038d47f1c
[TieredStorage] Store account address range (#172)
#### Problem
The TieredStorageFooter has the min_account_address and
max_account_address fields to describe the account address
range in its file.  But the current implementation hasn't updated
the fields yet.

#### Summary of Changes
This PR enables the TieredStorage to persist address range
information into its footer via min_account_address and
max_account_address.

#### Test Plan
Updated tiered-storage test to verify persisted account address range.
2024-03-20 12:17:12 -07:00
Yueh-Hsuan Chiang 0e932c7308
[TieredStorage] Refactor TieredStorage::new_readonly() code path (#195)
#### Problem
The TieredStorage::new_readonly() function currently has the following
problems:

* It opens the file without checking the magic number before checking and loading the footer.
* It opens the file twice: first to load the footer, then open again by the reader.

#### Summary of Changes
This PR refactors TieredStorage::new_readonly() so that it first performs all
checks inside the constructor of TieredReadableFile.  The TieredReadableFile
instance is then passed to the proper reader (currently HotStorageReader)
when all checks are passed.

#### Test Plan
* Added a new test to check MagicNumberMismatch.
* Existing tiered-storage tests
2024-03-20 10:39:25 -07:00
Jon C 261b3e9ee7
CI: Add windows clippy job and fix clippy errors (#330)
* CI: Run clippy on windows

* Update cargo-clippy-before-script.sh for Windows

* Pacify clippy
2024-03-20 13:21:00 +01:00
Alessandro Decina 8df80d9c12
accounts-db: unpack_archive: unpack accounts straight into their final destination (#289)
* accounts-db: unpack_archive: avoid extra iteration on each path

We used to do a iterator.clone().any(...) followed by
iterator.collect(). Merge the two and avoid an extra iteration and
re-parsing of the path.

* accounts-db: unpack_archive: unpack accounts straight into their final destination

We used to unpack accounts into account_path/accounts/<account> then
rename to account_path/<account>. We now unpack them into their final
destination directly and avoid the rename syscall.
2024-03-20 09:39:33 +11:00
Yueh-Hsuan Chiang 7c49b9c59e
[TieredStorage] Use BufWriter in TieredWritableFile (#261)
#### Problem
TieredWritableFile currently uses File instead of BufWriter.
This will introduce more syscall when doing file writes.

#### Summary of Changes
This PR makes TieredWritableFile uses BufWriter to allow the
write-call to be more optimized to reduce the number of syscalls.

#### Test Plan
Existing tiered-storage test.
Will run experiments to verify its performance improvement.

#### Dependency
https://github.com/anza-xyz/agave/pull/260
2024-03-18 14:27:55 -07:00
Yueh-Hsuan Chiang 6441209682
[TieredStorage] TieredStorageFile -> TieredReadonlyFile and TieredWritableFIle (#260)
#### Problem
TieredStorageFile struct currently offers new_readonly() and new_writable()
to allow both read and write work-load to share the same struct.  However,
as we need the writer to use BufWriter to improve performance as well as
enable Hasher on writes.  There is a need to refactor TieredStorageFile to
split its usage for read-only and writable.

#### Summary of Changes
Refactor TieredStorageFile to TieredReadonlyFIle and TieredWritableFile.

#### Test Plan
Existing tiered-storage tests.
2024-03-18 12:24:19 -07:00
Jeff Washington (jwash) 1fc4e38a4f
add stats for write cache flushing (#233)
* add stats for write cache flushing

* some renames
2024-03-18 09:53:44 -05:00
HaoranYi dcc6f1eb3a
fix typos (#247)
Co-authored-by: HaoranYi <haoran.yi@solana.com>
2024-03-15 09:15:23 -05:00