-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test_bank_forks_incremental_snapshot() #18565
Add test_bank_forks_incremental_snapshot() #18565
Conversation
2d001a3
to
d0c3f66
Compare
Codecov Report
@@ Coverage Diff @@
## master #18565 +/- ##
=======================================
Coverage 82.8% 82.8%
=======================================
Files 443 443
Lines 126301 126318 +17
=======================================
+ Hits 104675 104694 +19
+ Misses 21626 21624 -2 |
7c86926
to
b1eb040
Compare
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
b1eb040
to
d13bf96
Compare
d13bf96
to
aafec57
Compare
f8ed393
to
87a7667
Compare
@ryoqun @carllin @lijunwangs Here's the next PR for incremental snapshots. This one is just a test, and should be much easier to review. Thanks in advance! |
false, | ||
None, | ||
accounts_db::AccountShrinkThreshold::default(), | ||
false, |
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.
This flag to not check the hash was introduced here: https://github.com/solana-labs/solana/pull/17939/files#diff-b5dead0a38e5f63447595bbeda1428d3aa851d33954343bb1bc38b4b00add5fdR149, not sure why it's not safe to check the hash here.
Maybe the hash is verified elsewhere already? Would be good to check the accounts state is being verified to match the snapshot hash somewhere in the test.
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.
heh, looks like in the normal path, the hash is verified after the call to bank_from_snapshot_archives()
solana/ledger/src/bank_forks_utils.rs
Lines 149 to 171 in 86bda02
if let Some(shrink_paths) = shrink_paths { | |
deserialized_bank.set_shrink_paths(shrink_paths); | |
} | |
let deserialized_bank_slot_and_hash = ( | |
deserialized_bank.slot(), | |
deserialized_bank.get_accounts_hash(), | |
); | |
if deserialized_bank_slot_and_hash | |
!= ( | |
*full_snapshot_archive_info.slot(), | |
*full_snapshot_archive_info.hash(), | |
) | |
{ | |
error!( | |
"Snapshot has mismatch:\narchive: {:?}\ndeserialized: {:?}", | |
( | |
full_snapshot_archive_info.slot(), | |
full_snapshot_archive_info.hash() | |
), | |
deserialized_bank_slot_and_hash | |
); |
Can we extract this piece of logic (the unpacking and the hash verify), into a separate function like deserialize_and_verify_bank
and call that function from here
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.
@carllin Sure thing. Can I break this out into a separate PR/issue instead of fixing inside this PR?
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.
If extracting the above logic into a function and calling it from the test works, I think it makes sense to include in this PR, as testing the accounts hash seems important to the snapshot tests.
If somethings broken/hash doesn't verify, then a separate PR makes sense to me.
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.
Carl and I talked. I've created a new issue to track this request: #18973.
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.
Thanks, looks much cleaner!
While reviewing PR solana-labs#18565, as issue was brought up to refactor some code around verifying the bank after rebuilding from snapshots. A new top-level function has been added to get the latest snapshot archives and load the bank then verify. Additionally, new tests have been written and existing tests have been updated to use this new function. Fixes solana-labs#18973 While resolving the issue, it became clear there was some additional low-hanging fruit this change enabled. Specifically, the functions `bank_to_xxx_snapshot_archive()` now return their respective `SnapshotArchiveInfo`. And on the flip side, `bank_from_snapshot_archives()` now takes `SnapshotArchiveInfo`s instead of separate paths and archive formats. This bundling simplifies bank rebuilding.
While reviewing PR solana-labs#18565, as issue was brought up to refactor some code around verifying the bank after rebuilding from snapshots. A new top-level function has been added to get the latest snapshot archives and load the bank then verify. Additionally, new tests have been written and existing tests have been updated to use this new function. Fixes solana-labs#18973 While resolving the issue, it became clear there was some additional low-hanging fruit this change enabled. Specifically, the functions `bank_to_xxx_snapshot_archive()` now return their respective `SnapshotArchiveInfo`. And on the flip side, `bank_from_snapshot_archives()` now takes `SnapshotArchiveInfo`s instead of separate paths and archive formats. This bundling simplifies bank rebuilding.
While reviewing PR solana-labs#18565, as issue was brought up to refactor some code around verifying the bank after rebuilding from snapshots. A new top-level function has been added to get the latest snapshot archives and load the bank then verify. Additionally, new tests have been written and existing tests have been updated to use this new function. Fixes solana-labs#18973 While resolving the issue, it became clear there was some additional low-hanging fruit this change enabled. Specifically, the functions `bank_to_xxx_snapshot_archive()` now return their respective `SnapshotArchiveInfo`. And on the flip side, `bank_from_snapshot_archives()` now takes `SnapshotArchiveInfo`s instead of separate paths and archive formats. This bundling simplifies bank rebuilding.
While reviewing PR solana-labs#18565, as issue was brought up to refactor some code around verifying the bank after rebuilding from snapshots. A new top-level function has been added to get the latest snapshot archives and load the bank then verify. Additionally, new tests have been written and existing tests have been updated to use this new function. Fixes solana-labs#18973 While resolving the issue, it became clear there was some additional low-hanging fruit this change enabled. Specifically, the functions `bank_to_xxx_snapshot_archive()` now return their respective `SnapshotArchiveInfo`. And on the flip side, `bank_from_snapshot_archives()` now takes `SnapshotArchiveInfo`s instead of separate paths and archive formats. This bundling simplifies bank rebuilding.
While reviewing PR solana-labs#18565, as issue was brought up to refactor some code around verifying the bank after rebuilding from snapshots. A new top-level function has been added to get the latest snapshot archives and load the bank then verify. Additionally, new tests have been written and existing tests have been updated to use this new function. Fixes solana-labs#18973 While resolving the issue, it became clear there was some additional low-hanging fruit this change enabled. Specifically, the functions `bank_to_xxx_snapshot_archive()` now return their respective `SnapshotArchiveInfo`. And on the flip side, `bank_from_snapshot_archives()` now takes `SnapshotArchiveInfo`s instead of separate paths and archive formats. This bundling simplifies bank rebuilding.
While reviewing PR #18565, as issue was brought up to refactor some code around verifying the bank after rebuilding from snapshots. A new top-level function has been added to get the latest snapshot archives and load the bank then verify. Additionally, new tests have been written and existing tests have been updated to use this new function. Fixes #18973 While resolving the issue, it became clear there was some additional low-hanging fruit this change enabled. Specifically, the functions `bank_to_xxx_snapshot_archive()` now return their respective `SnapshotArchiveInfo`. And on the flip side, `bank_from_snapshot_archives()` now takes `SnapshotArchiveInfo`s instead of separate paths and archive formats. This bundling simplifies bank rebuilding.
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.