Make startup aware of Incremental Snapshots (#19550)

This commit is contained in:
Brooks Prumo
2021-09-02 19:05:15 -05:00
committed by GitHub
parent 57f51352f6
commit d45ced0a5d
8 changed files with 337 additions and 92 deletions

View File

@ -63,7 +63,7 @@ use std::{
path::{Path, PathBuf},
process::{exit, Command, Stdio},
str::FromStr,
sync::{Arc, RwLock},
sync::{mpsc::channel, Arc, RwLock},
};
mod bigtable;
@ -712,7 +712,7 @@ fn load_bank_forks(
let snapshot_archives_dir =
snapshot_archive_path.unwrap_or_else(|| blockstore.ledger_path().to_path_buf());
Some(SnapshotConfig {
full_snapshot_archive_interval_slots: 0, // Value doesn't matter
full_snapshot_archive_interval_slots: Slot::MAX,
incremental_snapshot_archive_interval_slots: Slot::MAX,
snapshot_archives_dir,
bank_snapshots_dir,
@ -740,6 +740,7 @@ fn load_bank_forks(
vec![non_primary_accounts_path]
};
let (accounts_package_sender, _) = channel();
bank_forks_utils::load(
genesis_config,
blockstore,
@ -749,6 +750,7 @@ fn load_bank_forks(
process_options,
None,
None,
accounts_package_sender,
)
}
@ -1652,7 +1654,7 @@ fn main() {
process_options,
snapshot_archive_path,
) {
Ok((bank_forks, _leader_schedule_cache, _snapshot_hash)) => {
Ok((bank_forks, ..)) => {
println!(
"{}",
compute_shred_version(
@ -1727,7 +1729,7 @@ fn main() {
process_options,
snapshot_archive_path,
) {
Ok((bank_forks, _leader_schedule_cache, _snapshot_hash)) => {
Ok((bank_forks, ..)) => {
println!("{}", &bank_forks.working_bank().hash());
}
Err(err) => {
@ -1908,7 +1910,7 @@ fn main() {
AccessType::TryPrimaryThenSecondary,
wal_recovery_mode,
);
let (bank_forks, _, _) = load_bank_forks(
let (bank_forks, ..) = load_bank_forks(
arg_matches,
&open_genesis_config_by(&ledger_path, arg_matches),
&blockstore,
@ -1947,7 +1949,7 @@ fn main() {
process_options,
snapshot_archive_path,
) {
Ok((bank_forks, _leader_schedule_cache, _snapshot_hash)) => {
Ok((bank_forks, ..)) => {
let dot = graph_forks(&bank_forks, arg_matches.is_present("include_all_votes"));
let extension = Path::new(&output_file).extension();
@ -2049,7 +2051,7 @@ fn main() {
},
snapshot_archive_path,
) {
Ok((bank_forks, _leader_schedule_cache, _snapshot_hash)) => {
Ok((bank_forks, ..)) => {
let mut bank = bank_forks
.get(snapshot_slot)
.unwrap_or_else(|| {
@ -2279,7 +2281,7 @@ fn main() {
process_options,
snapshot_archive_path,
) {
Ok((bank_forks, _leader_schedule_cache, _snapshot_hash)) => {
Ok((bank_forks, ..)) => {
let slot = bank_forks.working_bank().slot();
let bank = bank_forks.get(slot).unwrap_or_else(|| {
eprintln!("Error: Slot {} is not available", slot);
@ -2338,7 +2340,7 @@ fn main() {
process_options,
snapshot_archive_path,
) {
Ok((bank_forks, _leader_schedule_cache, _snapshot_hash)) => {
Ok((bank_forks, ..)) => {
let slot = bank_forks.working_bank().slot();
let bank = bank_forks.get(slot).unwrap_or_else(|| {
eprintln!("Error: Slot {} is not available", slot);