-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Replace boot_from_local_state with use_snapshot_archives_at_startup #32260
Conversation
Codecov Report
@@ Coverage Diff @@
## master #32260 +/- ##
=========================================
Coverage ? 82.0%
=========================================
Files ? 772
Lines ? 209328
Branches ? 0
=========================================
Hits ? 171744
Misses ? 37584
Partials ? 0 |
ledger-tool/src/main.rs
Outdated
@@ -980,7 +980,7 @@ fn assert_capitalization(bank: &Bank) { | |||
|
|||
/// Get the AccessType required, based on `process_options` | |||
fn get_access_type(process_options: &ProcessOptions) -> AccessType { | |||
if process_options.boot_from_local_state { | |||
if process_options.use_snapshot_archives_at_startup == UseSnapshotArchivesAtStartup::Never { |
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 should attempt to avoid if enum == ENUM
in this sort of case. We are planning on adding an additional variant, it's not immediately clear we wouldn't want to have PrimaryForMaintenance
for that variant.
Using a match in this sort of case is better imo, so we can't forget to update when adding the new variant.
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. Fixed in d914447.
ledger/src/bank_forks_utils.rs
Outdated
@@ -197,7 +198,7 @@ fn bank_forks_from_snapshot( | |||
} | |||
|
|||
let (deserialized_bank, full_snapshot_archive_info, incremental_snapshot_archive_info) = | |||
if process_options.boot_from_local_state { | |||
if process_options.use_snapshot_archives_at_startup == UseSnapshotArchivesAtStartup::Never { |
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.
same match
comment 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.
Done. Fixed in d914447.
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.
Note that I flipped the order of the code to match (heh) the enum variants ordering. The code has not changed at all, even though the diff doesn't make that easy to see. This is not necessary, so if it's not worth it, I can revert the ordering of the match arms to make the diff easier.
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
Problem
After merging #32217, there are still inner layers of code that use
boot_from_local_state
instead of the newuse_snapshot_archives_at_startup
. So that needs to be cleaned up.And then also to support "only startup from a snapshot archive if its newer than a bank snapshot", we'll need the
UseSnapshotArchivesAtStartup
enum also.Summary of Changes
Replace remaining
boot_from_local_state
bits withuse_snapshot_archives_at_startup
.