Commit Graph

40 Commits

Author SHA1 Message Date
Brooks Prumo
c322842257 Replace channel with Mutex<Option> for AccountsPackage (#24013) 2022-04-06 05:47:19 -05:00
Jeff Washington (jwash)
c24de17278 remove index hash calculation as an option (#23928) 2022-03-25 15:32:53 -05:00
Jeff Washington (jwash)
fb95fa68a2 cleanup api (#22845) 2022-01-31 11:39:23 -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
Jeff Washington (jwash)
70b2e5fef2 hash calc uses all threads during startup (#20735) 2021-10-15 17:41:23 -05:00
Brooks Prumo
8e3c420414 Add logging after taking a bank snapshot (#19891) 2021-09-15 07:39:21 -05:00
Brooks Prumo
4a5f83d3a7 Add fn to check when to take snapshots (#19682) 2021-09-07 23:26:35 +00: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
Jeff Washington (jwash)
98bc694606 hash calculation adds really old slots to dirty_stores (#19434) 2021-08-26 14:32:43 -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
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
Jeff Washington (jwash)
14361906ca for all tests, bank::new -> bank::new_for_tests (#19064) 2021-08-05 08:42:38 -05:00
Brooks Prumo
d1debcd971 Add incremental snapshot utils (#18504)
This commit adds high-level functions for creating and loading-from
incremental snapshots, plus all low-level functions required to perform
those tasks.  This commit **does not** add taking incremental snapshots
as part of a running validator, nor starting up a node with an
incremental snapshot; just laying ground work.

Additionally, `snapshot_utils` and `serde_snapshot` have been
refactored to use a common code paths for the different snapshots.

Also of note, some renaming has happened:
  1. Snapshots are now either `full_` or `incremental_` throughout the
     codebase.  If not specified, the code applies to both.
  2. Bank snapshots now are called "bank snapshots"
     (before they were called "slot snapshots", "bank snapshots", or
      just "snapshots").  The one exception is within `Bank`, where they
     are still just "snapshots", because they are already "bank
     snapshots".
  3. Snapshot archives now have `_archive` in the code.  This
     should clear up an ambiguity between bank snapshots and snapshot
     archives.
2021-07-22 14:40:37 -05:00
Brooks Prumo
89a3e4f91e Move SnapshotConfig into its own module (#18331)
Also move ArchiveFormat to snapshot_utils, and do not
reexport SnapshotVersion.
2021-07-01 08:55:26 -05:00
Alexander Meißner
6514096a67 chore: cargo +nightly clippy --fix -Z unstable-options 2021-06-18 10:42:46 -07:00
Jeff Washington (jwash)
5ecb30ff58 nit: rename measure (#17946) 2021-06-15 09:01:11 -05:00
carllin
ccc013e134 Handle removing slots during account scans (#17471) 2021-06-14 21:04:01 -07:00
Jeff Washington (jwash)
e6bbd4b3f0 add metrics to handle_snapshot_requests (#17937) 2021-06-14 15:46:19 -05:00
carllin
d8bc56fa51 Refactor purge_slots_from_cache_and_store() and handle_reclaims() (#17319) 2021-05-24 13:51:17 -07:00
Jeff Washington (jwash)
0486df02ba don't limit to thread pool when cleaning on startup (#17317) 2021-05-20 14:36:35 -05:00
Jeff Washington (jwash)
4aa753ff01 rename threads: 15 char limit (#16625) 2021-04-19 12:16:58 -05:00
carllin
d747614b27 Account for possibility of cache flush in load() (#15454)
* Account for possibility of cache flush in load()

* More cleaning

* More cleaning

* Remove unused method and some comment cleaning

* Fix typo

* Make the detected impossible purge race panic()!

* Finally revert to original .expect()

* Fix typos...

* Add assertion for max_root for easier reasoning

* Reframe races with LoadHint as possible opt.

* Fix test

* Make race bug tests run longer for less flaky

* Delay the clone-in-lock slow path even for RPC

* Make get_account panic-free & add its onchain ver.

* Fix rebase conflicts...

* Clean up

* Clean up comment

* Revert fn name change

* Fix flaky test...

* fmt...

Co-authored-by: Ryo Onodera <ryoqun@gmail.com>
2021-04-17 00:23:32 +09:00
Jeff Washington (jwash)
8a3135d17b Account->AccountSharedData (#15691) 2021-03-09 15:06:07 -06:00
Greg Fitzgerald
edd159e7d7 Fix typos (#15721) 2021-03-05 07:16:53 +00:00
Ryo Onodera
21b43009f6 Introduce ttl eviction for RecycleStore (#15513) 2021-02-25 17:27:27 +09:00
Michael Vines
5df36aec7d Pacify clippy 2021-02-19 20:08:41 -08:00
Jeff Washington (jwash)
ba02452d75 add validator flag no-accounts-db-index-hashing (#15350)
* add validator flag no_accounts_db_index_hashing

* add validator flag no_accounts_db_index_hashing
2021-02-16 21:13:48 +00:00
Jeff Washington (jwash)
866ce236b1 add another hash check (#15278)
* add another hash check

* update comment
2021-02-12 18:35:11 -06:00
Jeff Washington (jwash)
e59a24d9f9 pass expected capitalization to hash calculation to improve assert msg (#15191)
* cleanup if

* pass expected capitalization to hash calculation to improve assert message

* fix bank function

* one more level

* calculate_accounts_hash_helper

* add slot to error message

* success
2021-02-10 14:38:00 -06:00
Jeff Washington (jwash)
8424fe2c12 use index version of calculating hash (#15189)
* use index version of calculating hash

* invert const

* formatting
2021-02-09 10:37:50 -06:00
Jeff Washington (jwash)
600ff0d915 calculate hash from store instead of index (#15034)
* calculate hash from store instead of index

* restore update hash in abs
2021-02-04 09:00:33 -06:00
carllin
daddcd361a Snapshots missing slots from accounts cache clean optimization (#14852)
Co-authored-by: Carl Lin <carl@solana.com>
2021-01-26 20:08:55 -08:00
carllin
c77461e428 Remove unnecesary flushes in previous roots (#14596)
Co-authored-by: Carl Lin <carl@solana.com>
2021-01-23 04:02:44 -08:00
carllin
6dfad0652f Cache account stores, flush from AccountsBackgroundService (#13140) 2021-01-11 17:00:23 -08:00
Michael Vines
7be6770808 Rename CompressionType to ArchiveFormat 2021-01-09 09:07:49 -08:00
Michael Vines
7143aaa89b Clippy 2020-12-14 08:03:29 -08:00
Ryo Onodera
5788e75188 Shrink slots by sparseness of written data size (#14072) 2020-12-14 02:58:38 +09:00
carllin
55fc963595 Move slot cleanup to AccountsBackgroundService (#13911)
* Move bank drop to AccountsBackgroundService

* Send to ABS on drop instead, protects against other places banks are dropped

* Fix Abi

* test

Co-authored-by: Carl Lin <carl@solana.com>
2020-12-13 01:22:34 +00:00
sakridge
456eae6ccb Calculate accounts hash async in accounts background service (#12852) 2020-10-19 09:48:29 -07:00
carllin
06f84c65f1 Fix rooted accounts cleanup, simplify locking (#12194)
Co-authored-by: Carl Lin <carl@solana.com>
2020-09-28 16:04:46 -07:00