Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Replace boot_from_local_state with use_snapshot_archives_at_startup #32260

Merged
merged 2 commits into from
Jun 26, 2023

Conversation

brooksprumo
Copy link
Contributor

@brooksprumo brooksprumo commented Jun 24, 2023

Problem

After merging #32217, there are still inner layers of code that use boot_from_local_state instead of the new use_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 with use_snapshot_archives_at_startup.

@brooksprumo brooksprumo self-assigned this Jun 24, 2023
@brooksprumo brooksprumo marked this pull request as ready for review June 24, 2023 02:01
@brooksprumo brooksprumo requested a review from apfitzge June 24, 2023 02:01
@codecov
Copy link

codecov bot commented Jun 24, 2023

Codecov Report

❗ No coverage uploaded for pull request base (master@64ecfaf). Click here to learn what that means.
The diff coverage is 6.9%.

@@            Coverage Diff            @@
##             master   #32260   +/-   ##
=========================================
  Coverage          ?    82.0%           
=========================================
  Files             ?      772           
  Lines             ?   209328           
  Branches          ?        0           
=========================================
  Hits              ?   171744           
  Misses            ?    37584           
  Partials          ?        0           

@@ -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 {
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Fixed in d914447.

@@ -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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same match comment here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Fixed in d914447.

Copy link
Contributor Author

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.

@brooksprumo brooksprumo requested a review from apfitzge June 26, 2023 16:13
Copy link
Contributor

@apfitzge apfitzge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@brooksprumo brooksprumo merged commit 5f1b5b8 into solana-labs:master Jun 26, 2023
@brooksprumo brooksprumo deleted the fastboot/replace branch June 26, 2023 16:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants