Commit Graph

232 Commits

Author SHA1 Message Date
apfitzge cdb95a362f
update upacking thread names (#28081)
* update upacking thread names

* remove - add ht
2022-09-26 14:51:31 -05:00
behzad nouri 9a57c64f21
patches clippy errors from new rust nightly release (#27996) 2022-09-22 22:23:03 +00:00
apfitzge a846d50b6a
Interleaved snapshot unpack versioning (#27484)
* Issue #27346 - deserialize and check snapshot version before account fields

* Update comment on SnapshotFileKind

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

* SnapshotStorageRebuilderResult to RebuiltSnapshotStorage

* better error propagation from rebuild_storage

Co-authored-by: apfitzge <apfitzge@users.noreply.github.com>
Co-authored-by: Brooks Prumo <brooks@prumo.org>
2022-09-22 11:44:25 -05:00
Jeff Washington (jwash) 765c628546
use exit signal for acct idx bg threads (#27483) 2022-09-12 11:51:12 -07:00
Jeff Washington (jwash) 1f00b468e5
add enable_rehashing to AccountsPackage (#27644) 2022-09-08 09:25:25 -07:00
Brooks Prumo 6a322de845
Make Accounts Background Services aware of Epoch Accounts Hash (#27626) 2022-09-07 20:41:40 +00:00
Jeff Washington (jwash) a31d4a597d
serialize epoch_accounts_hash (#27516) 2022-09-07 10:07:00 -07:00
Brooks Prumo a2df1e95dc
Hold `PendingAccountsPackage` lock for both checking and submitting (#27613)
Hold package lock for both checking and submitting
2022-09-06 20:11:13 +00:00
apfitzge af971e63ab
Create all shared buffer readers before spawning threads (#27512)
* Create all shared buffer readers before spawning threads

* Allow 'needless' collect - clippy is wrong

* move clippy allow, spacing
2022-08-31 22:49:02 -05:00
apfitzge 49411aaae0
Feature: Interleaved Snapshot Untar and Indexing - Stage 1 (#26590)
* Add snapshot_storage_lengths_from_fields

* Add SnapshotUnpacker

* Add SnapshotStorageRebuilder

* Rebuild snapshot storage during unpack

* move snapshot unpacker back into snapshot_utils

* use SerializedAppendVecId in storage rebuilder

* create AccountStorageMap type alias

* Wrap storage and next_append_vec_id in a type

* fixed typo

* move use StorageAndNextAppendVecId

* calculate num_rebuilder_threads more concisely
2022-08-29 13:17:27 -05:00
Brennan Watt e4a7d01e10
Rust v1.63 (#27303)
* Upgrade to Rust v1.63.0

* Add nightly_clippy_allows

* Resolve some new clippy nightly lints

* Increase QUIC packets completion timeout

* Update quinn-udp crate

Co-authored-by: Michael Vines <mvines@gmail.com>
2022-08-22 18:01:03 -07:00
Brooks Prumo 510d195620
Simplify `Bank::clean_accounts()` by removing params (#27254) 2022-08-19 18:15:04 -04:00
Brennan Watt 7573000d87
Revert "Rust v1.63.0 (#27148)" (#27245)
This reverts commit a2e7bdf50a.
2022-08-19 09:19:44 +01:00
Brooks Prumo fa4122f9a8
Verifying snapshot bank must always specify the snapshot slot (#27234) 2022-08-18 17:24:23 +00:00
Brooks Prumo d2868f439d
Verify snapshot slot deltas (#26666) 2022-08-18 09:48:58 -04:00
Brennan Watt a2e7bdf50a
Rust v1.63.0 (#27148)
* Upgrade to Rust v1.63.0

* Add nightly_clippy_allows

* Resolve some new clippy nightly lints

* Increase QUIC packets completion timeout

Co-authored-by: Michael Vines <mvines@gmail.com>
2022-08-17 15:48:33 -07:00
Jeff Washington (jwash) 225cddcffb
serialize incremental_snapshot_hash (#26839)
* serialize incremental_snapshot_hash

* pr feedback
2022-08-17 15:14:31 -05:00
apfitzge c1111fa069
snapshots: serialize version file first (#27192)
serialize version file first
2022-08-17 12:57:52 -05:00
Justin Starry 69598ed4c0
Refactor: Add `RuntimeConfig` field to Bank (#26946)
* Refactor: Simplify arguments for bank constructor methods

* Refactor: Add RuntimeConfig to Bank fields

* Arc wrap runtime_config

* Arc wrap all runtime config usages

* Remove Copy trait derivation from RuntimeConfig

* Remove some arc wrapping
2022-08-05 20:49:00 +01:00
apfitzge 07f41628db
untar_snapshot_create_shared_buffer doesn't need to return a result (#26686) 2022-07-19 23:15:41 +00:00
apfitzge e7cd6daebe
Add helper fn to create shared buffer - simplify archive format matching (#26674) 2022-07-19 20:30:30 +00:00
apfitzge 77843306c7
rename parallel_archivers -> parallel_divisions for consistency (#26672)
parallel_archivers -> parallel_divisions for consistency
2022-07-19 13:15:33 -05:00
Jeff Washington (jwash) 602da5e51f
add accounts db config to bank tests (#26517) 2022-07-10 19:42:06 -05:00
carllin 90ef2cd02a
Parse snapshot for bank fields (#26016) 2022-07-06 17:30:30 -05:00
Jeff Washington (jwash) 17a99d98dd
Revert "avoid adding to 'uncleaned_roots' when generating index and c… (#26441)
Revert "avoid adding to 'uncleaned_roots' when generating index and caller passes accounts-db-skip-shrink (#25936)"

This reverts commit e24cc537a4.
2022-07-06 11:32:45 -05:00
Jeff Washington (jwash) 38216aa781
update comment for the next weary traveller (#26413) 2022-07-05 23:12:35 -05:00
Brooks Prumo 877fedadac
Remove StatusCacheRc type and use StatusCache directly (#26184) 2022-06-24 08:38:56 -05:00
Brooks Prumo 23c50a2389
Add StatusCache::root_slot_deltas() and use it (#26170) 2022-06-23 15:19:06 -05:00
Brooks Prumo 8a18e02f80
Call StatusCache::append() directly (#26125) 2022-06-22 07:42:01 -05:00
Tyera Eulberg 752c851070
Clean up feature preventing new rent-paying accounts (#26000)
* Clean up require_rent_exempt_accounts feature

* Fix tests in bank_client, system_instruction_processor

* Fix tests in snapshot_utils

* Fix bank tests

* Ignore rent tests

* Fix stake-accounts tests
2022-06-16 15:35:25 -06:00
Jeff Washington (jwash) e24cc537a4
avoid adding to 'uncleaned_roots' when generating index and caller passes accounts-db-skip-shrink (#25936) 2022-06-14 10:10:44 -05:00
apfitzge 3e1fd4dad0
snapshot_utils.rs: remove unnecessary sort (#25893) 2022-06-13 11:12:33 -05:00
apfitzge 04969a2282
serialize snapshots dir first (#25889) 2022-06-13 09:33:32 -05:00
apfitzge 56d38e4954
Add lz4 to snapshot filename regex for matching files on load (#25633)
* Add lz4 to snapshot filename regex for matching files on load

* Add tests for lz4 archive format filenames
2022-05-31 11:06:41 -05:00
HaoranYi 85a2e599bb
revert memory map for reading snapshot (#25259) 2022-05-17 09:32:18 -05:00
HaoranYi 3e44046a73
Support lz4 for snapshot archives (#25089)
* add lz4

* add cargo package file

* fix tests

* use fast lz4 compression

* report snapshot archive format

* add test

* code review feedback

* add cargo.lock

* fix var name

* refactor archive format parsing and add default compress cli arg

* clippy

* add from_cli_arg test

* update cargo.lock

* add lz4 support for mmap

* cargo.lock

* clippy
2022-05-16 12:44:15 -05:00
HaoranYi 389d78e424
Don't use mmarinus package (#25177)
* Revert "Revert "Use memory map to speed up snapshot untar (#24889)" (#25174)"

This reverts commit fc793de2dd.

* not use mmarinus

* enable secondary build

* Revert "enable secondary build"

This reverts commit 5aa43a94bbad59497506f02235597e7adc0dc47b.

* macbuild

* Revert "macbuild"

This reverts commit 0da92945a40dc5431eff4bd91054b407e22418fb.
2022-05-16 08:49:17 -05:00
Jeff Washington (jwash) fc793de2dd
Revert "Use memory map to speed up snapshot untar (#24889)" (#25174)
This reverts commit 3367e44671.
2022-05-12 14:48:29 -05:00
HaoranYi 3367e44671
Use memory map to speed up snapshot untar (#24889)
* mmap

* add no_os_memory_reporting_args to ledger-tool

* use safe memory map package for unix. use regular file for windows

* fallback to untaring with filebuf when mmap fails

* update comments
2022-05-12 13:35:19 -05:00
DimAn 2fa9bc3e70
Add options to store full and/or incremental snapshots in separate locations (#24247) 2022-05-10 16:37:41 -04:00
HaoranYi fd44198c0a
fix typo (#24937) 2022-05-03 09:57:15 -05:00
apfitzge 112a0b475a
Revert "Refactor to use EpochSchedule from within RentCollector struct" (#24893)
* Revert "Ran cargo fmt"

This reverts commit 9052e41b32.

* Revert "Fix build error introduced by my editor setup, part 2"

This reverts commit 4dfeab3b38.

* Revert "Fix build error introduced by my editor setup"

This reverts commit 87fb78dc56.

* Revert "Remove redundant epoch_schedule from AccountsPackage"

This reverts commit c2f7f2fff8.

* Revert "Fix a test"

This reverts commit 36c0bdaa78.

* Revert "Fixes to initial code"

This reverts commit ed7813e698.

* Revert "Removing redundant EpochSchedule param from fns"

This reverts commit 5472d2e605.
2022-05-02 13:46:17 -05:00
Michael Vines 74b586ae71 Always retain the highest incremental snapshot for all full snapshots 2022-05-02 07:37:55 -07:00
Jeff Washington (jwash) 94d3ec37d2
collect_rent_eagerly can just do rewrites (#24438) 2022-04-18 22:44:19 -05:00
Jason Davis c2f7f2fff8 Remove redundant epoch_schedule from AccountsPackage 2022-04-18 11:57:40 -05:00
Jeff Washington (jwash) 210f6a6fab
move hash calculation out of acct bg svc (#23689)
* move hash calculation out of acct bg svc

* pr feedback
2022-04-08 10:42:03 -05:00
Jeff Washington (jwash) c27150b1a3
reserialize_bank_fields_with_hash (#23916)
* reserialize_bank_with_new_accounts_hash

* Update runtime/src/serde_snapshot.rs

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

* Update runtime/src/serde_snapshot/tests.rs

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

* Update runtime/src/serde_snapshot/tests.rs

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

* pr feedback

Co-authored-by: Brooks Prumo <brooks@prumo.org>
2022-04-07 14:05:57 -05:00
Jeff Washington (jwash) 550ca7bf92
compare contents of serialized banks instead of exact file format (#24141)
* compare contents of serialized banks instead of exact file format

* Update runtime/src/snapshot_utils.rs

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

* Update runtime/src/snapshot_utils.rs

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

* pr feedback

* get rid of clone

* pr feedback

Co-authored-by: Brooks Prumo <brooks@prumo.org>
2022-04-06 21:55:44 -05:00
Jeff Washington (jwash) fddd162645
reserialize bank in ahv by first writing to temp file in abs (#23947) 2022-04-06 21:39:26 -05:00
Brooks Prumo c322842257
Replace channel with Mutex<Option> for AccountsPackage (#24013) 2022-04-06 05:47:19 -05:00
Jeff Washington (jwash) 9c8dad33c7
add epoch_schedule and rent_collector to hash calc (#24012) 2022-03-31 10:51:18 -05:00
Brooks Prumo 31b707b625
Specify if archive size datapoint is for full or incremental snapshots (#23941) 2022-03-26 12:29:13 -05:00
Jeff Washington (jwash) bc35e1c5f5
snapshot code needs all storages for hash calc (#23840) 2022-03-22 21:27:54 -05:00
HaoranYi 8c4f010b8d
fix logging: only walk remote dir if it exist (#23663) 2022-03-15 08:56:22 -05:00
HaoranYi 0c684721d8
Separate remotely downloaded snapshot archives (#23510)
* seperate remotely downloaded snapshot archives

* add str const for snapshot download dir

* only walk remote sub directory

* move directory creation outside of loop

* move is_remote to traits

* clippy simplify

* clippy

* clippy

* add unittest

* fix local cluster tests

* look for remote snapshot archive in remote foler

* create remote dir in tests

* use snapshot download dir constant

* extract build_remote_dir fn

* fix build

* code review - walking snapshot archived dirs explicitly

* fix build

* fix build

* fix comments

* Update runtime/src/snapshot_utils.rs

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

* clippy

* borrow to avoid copy

Co-authored-by: Brooks Prumo <brooks@prumo.org>
2022-03-14 14:03:59 -05:00
Giorgio Gambino ccff006948
Add more logs to `purge_old_snapshot_archives` (#23531) 2022-03-11 15:01:48 -06:00
Brooks Prumo 1eddb6d1e9
Move ArchiveFormat into own module (#23562) 2022-03-09 16:09:34 -06:00
Brooks Prumo 9bbccbe27c
Use `AsRef<Path>` instead of `PathBuf` for parameters (#23560) 2022-03-09 16:08:33 -06:00
Michael Vines 5599bd9442 Remove BankFromArchiveTimings from ledger/ 2022-03-08 08:11:50 -08:00
HaoranYi 181fffb916
rename status filename to be consistent (#23501) 2022-03-07 17:34:35 +00:00
HaoranYi 463cd564cf
fix typos (#23495)
* fix typos
2022-03-05 20:46:46 -06:00
Michael Vines b28acd2d4d Reduce fn visibility 2022-03-04 09:52:46 +01:00
Michael Vines 72c68695b5 Do not keep oldest full snapshot 2022-02-21 17:10:31 -07:00
Michael Vines 577fa4ec0c Generate full snapshots 4x faster to keep incremental snapshots nice and small 2022-02-15 21:09:21 -08:00
Brooks Prumo b82d71d22a
Inline DEFAULT_SNAPSHOT_VERSION constant string (#22487) 2022-01-13 18:19:15 +00:00
Brooks Prumo 2756abce39
More serde snapshot cleanup (#22449) 2022-01-13 09:20:20 -06:00
mooori 0f6e8d3385
Check file size of `snapshot_version` when unarchiving snapshot (#21925) 2021-12-17 12:27:54 -06:00
Michael Vines b8837c04ec Reformat imports to a consistent style for imports
rustfmt.toml configuration:
  imports_granularity = "One"
  group_imports = "One"
2021-12-03 09:19:13 -08:00
Michael Vines ba9dfa0d22 Remove frozen account support 2021-11-29 08:38:11 -08:00
Jack May bced07a099
Update fee api to use blockhash (#21054) 2021-10-29 13:52:59 -07:00
Justin Starry 036d7fcc81
Clean up sanitized tx creation for tests (#21006) 2021-10-27 18:09:16 +01:00
Jack May bfbbc53dac
Divorce the runtime from FeeCalculator (#20737) 2021-10-22 14:32:40 -07:00
Brooks Prumo 751b45df64
Make pub get_incremental_snapshot_archives() (#20725) 2021-10-18 13:48:50 -05:00
Jack May da45be366a
Remove blockhash from fee calculation (#20641) 2021-10-13 13:10:58 -07:00
Michael Vines 7027d56064 Resolve nightly-2021-10-05 clippy complaints 2021-10-06 10:37:58 -07:00
Lijun Wang fe97cb2ddf
AccountsDb plugin framework (#20047)
Summary of Changes

Create a plugin mechanism in the accounts update path so that accounts data can be streamed out to external data stores (be it Kafka or Postgres). The plugin mechanism allows

Data stores of connection strings/credentials to be configured,
Accounts with patterns to be streamed
PostgreSQL implementation of the streaming for different destination stores to be plugged in.

The code comprises 4 major parts:

accountsdb-plugin-intf: defines the plugin interface which concrete plugin should implement.
accountsdb-plugin-manager: manages the load/unload of plugins and provide interfaces which the validator can notify of accounts update to plugins.
accountsdb-plugin-postgres: the concrete plugin implementation for PostgreSQL
The validator integrations: updated streamed right after snapshot restore and after account update from transaction processing or other real updates.
The plugin is optionally loaded on demand by new validator CLI argument -- there is no impact if the plugin is not loaded.
2021-09-30 14:26:17 -07:00
Brooks Prumo 95fbc29500
Add stats when getting snapshot storages (#20234) 2021-09-27 13:07:00 -05:00
Brooks Prumo 21bc7e94f5
Add logging of incremental snapshots to purge_old_snapshot_archives() (#19874) 2021-09-14 17:49:15 -05:00
Brooks Prumo 7aa5f6b833
Add CLI args for incremental snapshots (#19694)
Add `--incremental-snapshots` flag to enable incremental snapshots.
This will allow setting `--full-snapshot-interval-slots` and
`--incremental-snapshot-interval-slots`.

Also added `--maximum-incremental-snapshots-to-retain`.

Co-authored-by: Michael Vines <mvines@gmail.com>
2021-09-10 15:59:26 -05:00
Jeff Washington (jwash) 456bf15012
AccountsIndexConfig -> AccountsDbConfig (#19687) 2021-09-08 04:30:38 +00:00
Brooks Prumo 4a5f83d3a7
Add fn to check when to take snapshots (#19682) 2021-09-07 23:26:35 +00:00
Brooks Prumo a0552e5b46
Make startup aware of Incremental Snapshots (#19600) 2021-09-07 20:43:43 +00:00
Brooks Prumo 9d9482b9d8
Plumb `maximum_incremental_snapshot_archives_to_retain` (#19640) 2021-09-06 18:01:56 -05:00
Brooks Prumo 333e5a9446
Make purge_old_snapshot_archives aware of maximum_incremental_snapshot_archives_to_retain (#19615) 2021-09-04 07:37:29 -05:00
Brooks Prumo 5e25ee5ebe
Add maximum_incremental_snapshot_archives_to_retain to SnapshotConfig (#19612) 2021-09-03 20:21:32 +00:00
Jack May 170927b7c4
nit: Move builtins types to builtins file (#19597) 2021-09-02 21:29:11 -07:00
Brooks Prumo e9374d32a3
Revert "Make startup aware of Incremental Snapshots (#19550)" (#19599)
This reverts commit d45ced0a5d.
2021-09-02 19:14:41 -05:00
Brooks Prumo d45ced0a5d
Make startup aware of Incremental Snapshots (#19550) 2021-09-02 19:05:15 -05:00
Brooks Prumo fe9ee9134a
Make background services aware of incremental snapshots (#19401)
AccountsBackgroundService now knows about incremental snapshots.  It is
now also in charge of deciding if an AccountsPackage is destined to be a
SnapshotPackage or not (or just used by AccountsHashVerifier).

!!! New behavior changes !!!

Taking snapshots (both bank and archive) **MUST** succeed.

This is required because of how the last full snapshot slot is
calculated, which is used by AccountsBackgroundService when calling
`clean_accounts()`.

File system calls are now unwrapped and will result in a crash. As Trent told me:

>Well I think if a snapshot fails due to some IO error, it's very likely that the operator is going to have to intervene before it works.  We should exit error in this case, otherwise the validator might happily spin for several more hours, never successfully writing a complete snapshot, before something else brings it down.  This would leave the validator's last local snapshot many more slots behind than it would be had we exited outright and potentially force the operator to abandon ledger continuity in favor of a quick catchup

Other errors will set the `exit` flag to `true`, and the node will gracefully shutdown.

Fixes #19167 
Fixes #19168
2021-08-31 18:33:27 -05:00
Brooks Prumo 1a4bede918
Remove filter_snapshot_storages_for_incremental_snapshot() (#19349)
Now that we can get just the subset of snapshot storages we want, the extra
filtering afterwards is redundant.
2021-08-23 09:45:29 -05:00
Brooks Prumo 6d939811e9
Name snapshots consistently (#19346)
#### Problem

Snapshot names are overloaded, and there are multiple terms that mean the same thing. This is confusing. Here's a list of ones in the codebase that I've found:

```
- snapshot_dir
- snapshots_dir
- snapshot_path
- snapshot_output_dir
- snapshot_package_output_path
- snapshot_archives_dir
```

#### Summary of Changes

For all the ones that are about the directory where snapshot archives are stored, ensure they are `snapshot_archives_dir`. For the ones about the (bank) snapshots directory, set to `bank_snapshots_dir`.


Co-authored-by: Michael Vines <mvines@gmail.com>
2021-08-21 15:41:03 -05:00
Brooks Prumo 234461f779
Add base_slot to get_snapshot_storages() (#19348) 2021-08-20 16:23:43 -05:00
Justin Starry c50b01cb60
Store versioned transactions in the ledger, disabled by default (#19139)
* Add support for versioned transactions, but disable by default

* merge conflicts

* trent's feedback

* bump Cargo.lock

* Fix transaction error encoding

* Rename legacy_transaction method

* cargo clippy

* Clean up casts, int arithmetic, and unused methods

* Check for duplicates in sanitized message conversion

* fix clippy

* fix new test

* Fix bpf conditional compilation for message module
2021-08-17 15:17:56 -07:00
Jeff Washington (jwash) 7c70f2158b
accounts_index_bins to AccountsIndexConfig (#19257)
* accounts_index_bins to AccountsIndexConfig

* rename param bins -> config

* rename BINS_FOR* to ACCOUNTS_INDEX_CONFIG_FOR*
2021-08-17 14:50:01 -05:00
Brooks Prumo f9986c66b8
Make SnapshotPackagerService aware of Incremental Snapshots (#19254)
Add a field to SnapshotPackage that is an enum for SnapshotType, so archive_snapshot_package() will do the right thing.

Fixes #19166
2021-08-17 13:01:59 -05:00
Brooks Prumo 176036aa58
Rename AccountsPacakge to SnapshotPackage and AccountsPackagePre to AccountsPackage (#19231)
Renaming these types to better communicate their usages, which will
further diverge as incremental snapshot support is added.

With the new names, AccountsPacakge now refers to the type between
AccountsBackgroundProcess and AccountsHashVerifier, and SnapshotPackage
refers to the type between AccountsHashVerifier and
SnapshotPackagerService.
2021-08-13 16:08:09 -05:00
Tyera Eulberg 01b00bc593
Fix crossed PRs; remove deprecated fee_calculator usage (#19228) 2021-08-13 11:14:00 -06:00
steviez 772341dccb
fixup! Handle cleaning of zero-lamport accounts w.r.t. Incremental Snapshots (#18870) (#19213) 2021-08-12 17:29:58 -05:00
Brooks Prumo 5fb6b341c4
Handle cleaning of zero-lamport accounts w.r.t. Incremental Snapshots (#18870)
* Handle cleaning zero-lamport accounts

Handle cleaning zero-lamport accounts in slots higher than the last full
snapshot slot.  This is part of the Incremental Snapshot work.

Fixes #18825
2021-08-12 15:56:08 -05:00
Brooks Prumo faf99f4760
Move Bank::get_incremental_snapshot_storages() into snapshot_utils (#19155)
Filtering out storages for incremental snapshots will be needed by the
background services for incremental snapshot support, but there is not a
Bank at that point.  Since the filtering doesn't apply only to Bank, and
more to snapshots, move the functionality into snapshot_utils.
2021-08-10 14:04:11 -05:00