Remove last_full_snapshot_slot return value when it can be derived by the caller
This commit is contained in:
parent
cf5048faaa
commit
63324be5b3
|
@ -2,8 +2,8 @@ use {
|
||||||
crate::{
|
crate::{
|
||||||
blockstore::Blockstore,
|
blockstore::Blockstore,
|
||||||
blockstore_processor::{
|
blockstore_processor::{
|
||||||
self, BlockstoreProcessorError, CacheBlockMetaSender,
|
self, BlockstoreProcessorError, CacheBlockMetaSender, ProcessOptions,
|
||||||
ProcessOptions, TransactionStatusSender,
|
TransactionStatusSender,
|
||||||
},
|
},
|
||||||
leader_schedule_cache::LeaderScheduleCache,
|
leader_schedule_cache::LeaderScheduleCache,
|
||||||
},
|
},
|
||||||
|
@ -72,7 +72,7 @@ pub fn load(
|
||||||
false
|
false
|
||||||
};
|
};
|
||||||
|
|
||||||
let (bank_forks, last_full_snapshot_slot, starting_snapshot_hashes) = if snapshot_present {
|
let (bank_forks, starting_snapshot_hashes) = if snapshot_present {
|
||||||
bank_forks_from_snapshot(
|
bank_forks_from_snapshot(
|
||||||
genesis_config,
|
genesis_config,
|
||||||
account_paths,
|
account_paths,
|
||||||
|
@ -103,7 +103,6 @@ pub fn load(
|
||||||
accounts_update_notifier,
|
accounts_update_notifier,
|
||||||
),
|
),
|
||||||
None,
|
None,
|
||||||
None,
|
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -115,10 +114,11 @@ pub fn load(
|
||||||
cache_block_meta_sender,
|
cache_block_meta_sender,
|
||||||
snapshot_config,
|
snapshot_config,
|
||||||
accounts_package_sender,
|
accounts_package_sender,
|
||||||
last_full_snapshot_slot,
|
|
||||||
)
|
)
|
||||||
.map(
|
.map(
|
||||||
|(bank_forks, leader_schedule_cache, last_full_snapshot_slot)| {
|
|(bank_forks, leader_schedule_cache, last_full_snapshot_slot)| {
|
||||||
|
let last_full_snapshot_slot =
|
||||||
|
last_full_snapshot_slot.or_else(|| starting_snapshot_hashes.map(|x| x.full.hash.0));
|
||||||
(
|
(
|
||||||
bank_forks,
|
bank_forks,
|
||||||
leader_schedule_cache,
|
leader_schedule_cache,
|
||||||
|
@ -137,7 +137,7 @@ fn bank_forks_from_snapshot(
|
||||||
snapshot_config: &SnapshotConfig,
|
snapshot_config: &SnapshotConfig,
|
||||||
process_options: &ProcessOptions,
|
process_options: &ProcessOptions,
|
||||||
accounts_update_notifier: Option<AccountsUpdateNotifier>,
|
accounts_update_notifier: Option<AccountsUpdateNotifier>,
|
||||||
) -> (BankForks, Option<Slot>, Option<StartingSnapshotHashes>) {
|
) -> (BankForks, Option<StartingSnapshotHashes>) {
|
||||||
// Fail hard here if snapshot fails to load, don't silently continue
|
// Fail hard here if snapshot fails to load, don't silently continue
|
||||||
if account_paths.is_empty() {
|
if account_paths.is_empty() {
|
||||||
error!("Account paths not present when booting from snapshot");
|
error!("Account paths not present when booting from snapshot");
|
||||||
|
@ -168,7 +168,7 @@ fn bank_forks_from_snapshot(
|
||||||
deserialized_bank.set_shrink_paths(shrink_paths);
|
deserialized_bank.set_shrink_paths(shrink_paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
let starting_full_snapshot_hash = FullSnapshotHash {
|
let full_snapshot_hash = FullSnapshotHash {
|
||||||
hash: (
|
hash: (
|
||||||
full_snapshot_archive_info.slot(),
|
full_snapshot_archive_info.slot(),
|
||||||
*full_snapshot_archive_info.hash(),
|
*full_snapshot_archive_info.hash(),
|
||||||
|
@ -177,22 +177,20 @@ fn bank_forks_from_snapshot(
|
||||||
let starting_incremental_snapshot_hash =
|
let starting_incremental_snapshot_hash =
|
||||||
incremental_snapshot_archive_info.map(|incremental_snapshot_archive_info| {
|
incremental_snapshot_archive_info.map(|incremental_snapshot_archive_info| {
|
||||||
IncrementalSnapshotHash {
|
IncrementalSnapshotHash {
|
||||||
base: starting_full_snapshot_hash.hash,
|
base: full_snapshot_hash.hash,
|
||||||
hash: (
|
hash: (
|
||||||
incremental_snapshot_archive_info.slot(),
|
incremental_snapshot_archive_info.slot(),
|
||||||
*incremental_snapshot_archive_info.hash(),
|
*incremental_snapshot_archive_info.hash(),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let starting_snapshot_hashes = Some(StartingSnapshotHashes {
|
let starting_snapshot_hashes = StartingSnapshotHashes {
|
||||||
full: starting_full_snapshot_hash,
|
full: full_snapshot_hash,
|
||||||
incremental: starting_incremental_snapshot_hash,
|
incremental: starting_incremental_snapshot_hash,
|
||||||
});
|
};
|
||||||
let last_full_snapshot_slot = Some(full_snapshot_archive_info.slot());
|
|
||||||
|
|
||||||
(
|
(
|
||||||
BankForks::new(deserialized_bank),
|
BankForks::new(deserialized_bank),
|
||||||
last_full_snapshot_slot,
|
Some(starting_snapshot_hashes),
|
||||||
starting_snapshot_hashes,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -590,7 +590,6 @@ pub fn test_process_blockstore(
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
accounts_package_sender,
|
accounts_package_sender,
|
||||||
None,
|
|
||||||
)
|
)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
@ -639,7 +638,6 @@ pub(crate) fn process_blockstore_from_root(
|
||||||
cache_block_meta_sender: Option<&CacheBlockMetaSender>,
|
cache_block_meta_sender: Option<&CacheBlockMetaSender>,
|
||||||
snapshot_config: Option<&SnapshotConfig>,
|
snapshot_config: Option<&SnapshotConfig>,
|
||||||
accounts_package_sender: AccountsPackageSender,
|
accounts_package_sender: AccountsPackageSender,
|
||||||
mut last_full_snapshot_slot: Option<Slot>,
|
|
||||||
) -> BlockstoreProcessorResult {
|
) -> BlockstoreProcessorResult {
|
||||||
if let Some(num_threads) = opts.override_num_threads {
|
if let Some(num_threads) = opts.override_num_threads {
|
||||||
PAR_THREAD_POOL.with(|pool| {
|
PAR_THREAD_POOL.with(|pool| {
|
||||||
|
@ -699,6 +697,8 @@ pub(crate) fn process_blockstore_from_root(
|
||||||
leader_schedule_cache.set_max_schedules(std::usize::MAX);
|
leader_schedule_cache.set_max_schedules(std::usize::MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut last_full_snapshot_slot = None;
|
||||||
|
|
||||||
if let Some(start_slot_meta) = blockstore
|
if let Some(start_slot_meta) = blockstore
|
||||||
.meta(start_slot)
|
.meta(start_slot)
|
||||||
.unwrap_or_else(|_| panic!("Failed to get meta for slot {}", start_slot))
|
.unwrap_or_else(|_| panic!("Failed to get meta for slot {}", start_slot))
|
||||||
|
|
Loading…
Reference in New Issue