-
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
Create-snapshot check if slot is available on startup #25329
Create-snapshot check if slot is available on startup #25329
Conversation
…snapshot slot is available
Codecov Report
@@ Coverage Diff @@
## master #25329 +/- ##
=========================================
Coverage 82.0% 82.1%
=========================================
Files 598 614 +16
Lines 165882 169323 +3441
=========================================
+ Hits 136125 139029 +2904
- Misses 29757 30294 +537 |
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 like the thinking behind adding this check; however, I think we should go even further and check to make sure we have full slots all the way up to (and including) snapshot_slot
. It may not be super common to have "gaps" on a validator (although there are instances where we purge slots), a common case is copying a ledger contents (shreds + snapshot) off of validator onto some other machine to debug. Checking the full range would be good to prevent human error in this scenario.
This would definitely add some overhead, but my gut says that in relation to the amount of time it takes to verify and create the snapshot, this extra overhead should be relatively small
ledger-tool/src/main.rs
Outdated
@@ -2332,6 +2332,11 @@ fn main() { | |||
value_t_or_exit!(arg_matches, "snapshot_slot", Slot) | |||
}; | |||
|
|||
if blockstore.meta(snapshot_slot).unwrap().is_none() { |
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.
In addition to confirming we have a meta, we should make sure that the slot is also full with SlotMeta::is_full()
I think that's reasonable. We'd need to check the slots in the range And if we are using the |
Correct; I think there is some logic in
Correct |
While testing this change, I found a bug w/ the --no-snapshot option in ledger-tool due to the recent addition of --snapshot-archive-format. Opened a PR here: #25368 |
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.
LGTM assuming you've done some testing (including cases where slots was not full and/or missing)
Problem
create-snapshot will load bank_forks from a snapshot and try to replay up to snapshot_slot. If snapshot_slot does not exist, it will replay everything available and then fail. This can be slow.
Summary of Changes
Add a check to see if
snapshot_slot
is available in the blockstore BEFORE trying to load the bank_forks. If it's not we exit since we won't be able to create a snapshot.Preliminary PR for minimized snapshot mode.
Fixes #