-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Add incremental snapshot utils #18504
Add incremental snapshot utils #18504
Conversation
b82ec32
to
5ebbc4a
Compare
Codecov Report
@@ Coverage Diff @@
## master #18504 +/- ##
=========================================
- Coverage 82.8% 82.8% -0.1%
=========================================
Files 443 443
Lines 125343 125957 +614
=========================================
+ Hits 103895 104389 +494
- Misses 21448 21568 +120 |
5ebbc4a
to
4f45db6
Compare
@lijunwangs @ryoqun @carllin Checks have passed, and all review comments have been addressed. I've replied with answers/questions to any outstanding review comments. PR is ready for another round of reviewing. Thanks in advance! |
@brooksprumo as a context, we want to support untrusted snapshots eventually in the (distant) future. so, panic! shouldn't be reachable when consuming (= untaring) any downloaded snapshots. #7167 That context might help to decide panic!/error? Also, well-groomed pr description. :) |
@ryoqun Yes, thank you. Makes sense!
Thanks :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
d048750
to
4cfdeac
Compare
Pull request has been modified.
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" everywhere too (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` everywhere in the code. This should clear up an ambiguity between bank snapshots and snapshot archives.
4cfdeac
to
34c6bdc
Compare
@carllin @lijunwangs I had to fix a merge conflict, so your approvals were removed. Nothing else changed, but let me know if you'd like me to wait for you to re-review before I merge. @ryoqun Would you like to re-review before I merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say a masterpiece of plumbing pr ever. xD
I only left some minor comments. merge anytime without needing another review round.
This commit builds on PR #18504 by adding a test to core/tests/snapshot.rs for Incremental Snapshots. The test adds banks to bank forks in a loop and takes both full snapshots and incremental snapshots at intervals, and validates they are rebuild-able. For background info about Incremental Snapshots, see #17088. Fixes #18829 and #18972
This commit adds high-level functions (
bank_to_incremental_snapshot()
andbank_from_incremental_snapshot()
), and additionallyrefactors snapshot_utils and serde_snapshot to use a common code path for
snapshots. New tests were added to snapshot_utils for incremental snapshots.
This PR grabs bits from PR #17875, and incorporated feedback from that PR review. This PR is another in the pursuit of Incremental Snapshots (#17088), and this PR finally/actually adds the ability to both load-from and store-to an incremental snapshot. Yay!
This PR is quite big. A lot of the deserialization code was touched to support incremental snapshots and avoid code duplication. The diff may be easier to read when ignoring whitespace.
The next PR in this series will add new integration-style tests to
core/tests/
, and will address new issues those tests uncover (likelyclean_accounts()
).Additional Bits
Care has been taken to rename (almost) everything around snapshots.
full_
orincremental_
unless they work for both.Outstanding Questions
deserialize_snapshot_data_file_capped()
? Thread hereNew Issues Created
snapshot_version
when unarchiving snapshot #18841