-
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
Download incremental snapshots during bootstrap #20696
Conversation
35cccb2
to
0962313
Compare
Codecov Report
@@ Coverage Diff @@
## master #20696 +/- ##
=========================================
- Coverage 81.9% 81.7% -0.2%
=========================================
Files 496 496
Lines 138317 138952 +635
=========================================
+ Hits 113319 113607 +288
- Misses 24998 25345 +347 |
@mvines @ryoqun Thanks in advance for reviewing! Two things:
|
@mvines Definitely agree! I was thinking of getting feedback on this design before making the other PRs live (there's actually four PRs with refactoring). I'm working with @jeffwashington to do these reviews, and then I'll rebase this one. |
Got it. The design that you've written up in the PR description makes sense to me. Let's whittle this PR down to just the implementation of the design sans refactoring churn and I'll jump in on the review! |
Sounds good! I'll move this back to Draft while I refactor. |
0962313
to
4f48dfc
Compare
99b0a2f
to
b865827
Compare
Fixes solana-labs#20225 - Add fn to download incremental snapshots at bootstrap - requires `--incremental-snapshots` and _not_ `--no-incremental-snapshot-fetch` to be set
b865827
to
8f0bd5a
Compare
@mvines @jeffwashington Ok, this PR is ready for review again! Jeff, I added you as well since you mentioned you'd be willing to help review (and thanks for reviewing the refactor PRs!). |
validator/src/bootstrap.rs
Outdated
if bootstrap_config.incremental_snapshots == ConfigState::Enabled | ||
&& bootstrap_config.incremental_snapshot_fetch == ConfigState::Enabled |
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.
Could we only check for incremental_snapshot_fetch
here? That is, why would incremental_snapshots
ever be false
if incremental_snapshot_fetch
is true
.
Aside: I'm not a fan of ConfigState
, I'd prefer a plain bool
myself. But I see you/Jeff discussed that in another PR so 🙈
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 think we could check for just incremental_snapshot_fetch
here, yes. I'll make that change.
Re ConfigState
: Well, that's 2-to-1 in favor of bool
, so I'll change this to bool
instead.
TODO:
- Check only for
incremental_snapshot_fetch
- Use
bool
instead ofConfigState
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.
Done!
Right now, --incremental-snapshots
defaults to false, so I figured that fetching incremental snapshots during bootstrap should also be false by default.
And since --incremental-snapshots
is false
by default, and --no-incremental-snapshot-fetch
is also false by default, this would mean that if I only check for --no-incremental-snapshot-fetch
, then this would allow the case where the user does not set --incremental-snapshots
nor --no-incremental-snapshot-fetch
, and they would end up trying to download an incremental snapshot.
I think that would be a bit confusing. Maybe it wouldn't work out right either, if the full/incremental snapshot intervals are not multiples of eachother either...
validator/src/bootstrap.rs
Outdated
/// - ContactInfo: the rpc peer | ||
/// - (Slot, Hash): the base (i.e. full) snapshot hash | ||
/// - Option<(Slot, Hash)>: the highest incremental snapshot hash, if one exists | ||
#[allow(clippy::type_complexity)] |
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.
wanna just wrap a struct around this return type? It'll avoid the clippy and then that comment turns into sweet compile-time verified code instead of an out of date comment in 6 months :)
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.
You bet I do! Hah, I was concerned I was overdoing it on the types, which is why I didn't do it in the first place.
TODO:
- Make the return type into a struct
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.
yeah I figured it was trauma from that last type discussion! ⚔️
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.
Done!
@mvines Can you take another look and see what you think? I put the majority of this into a struct called PeerSnapshotHash
. Function names and args have also been updated to use this name instead of "incremental_snapshots", which was already overloaded a bunch.
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 is strictly better than the old version because tests exist!
Would like to the type-complexity clippy allows removed, and I think we have some discussion about the flags themselves. But that discussion doesn't need to block this PR from landing IMO
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.
Co-authored-by: Michael Vines <[email protected]>
Co-authored-by: Michael Vines <[email protected]>
Problem
Bootstrapping does not know about incremental snapshots, so it will never download an incremental snapshot.
Summary of Changes
Add methods to rpc_bootstrap() to discover and download an incremental snapshot.
When incremental snapshots is enabled (
--incremental-snapshots
) and incremental snapshot fetch is not disabled (no--no-incremental-snapshot-fetch
), then rpc_bootstrap will discover and download compatible incremental snapshots.This means:
Fixes #20225
Extra
This PR is quite large, and likely needs a lot of time to go over. I've split the implementations for with and without incremental snapshots into their own modules. This was so I could keep the exact same code for the "without" case intact, which will keep existing behavior a seamless possibility until more nodes have enabled incremental snapshots and this code has had more testing.
Please do ask questions. I'm also happy to jump on a call to go over anything. While implementing this I encountered a lot of "well what should happen in this case?" scenarios, and those likely need to be checked for correct assumptions.
Additionally, I've tried to preserve the existing behavior around retrying and timeouts. The new code path is quite different, so double checking all of that will be very valuable too. Thanks in advance!