Waits to handle snapshot requests until after startup verification is complete (#28481)
This commit is contained in:
parent
5c53206fc4
commit
70e83e82c6
|
@ -273,14 +273,11 @@ impl SnapshotRequestHandler {
|
||||||
let SnapshotRequest {
|
let SnapshotRequest {
|
||||||
snapshot_root_bank,
|
snapshot_root_bank,
|
||||||
status_cache_slot_deltas,
|
status_cache_slot_deltas,
|
||||||
request_type,
|
request_type: _,
|
||||||
} = snapshot_request;
|
} = snapshot_request;
|
||||||
|
|
||||||
// we should not rely on the state of this validator until startup verification is complete (unless handling an EAH request)
|
// we should not rely on the state of this validator until startup verification is complete
|
||||||
assert!(
|
assert!(snapshot_root_bank.is_startup_verification_complete());
|
||||||
snapshot_root_bank.is_startup_verification_complete()
|
|
||||||
|| request_type == SnapshotRequestType::EpochAccountsHash
|
|
||||||
);
|
|
||||||
|
|
||||||
if accounts_package_type == AccountsPackageType::Snapshot(SnapshotType::FullSnapshot) {
|
if accounts_package_type == AccountsPackageType::Snapshot(SnapshotType::FullSnapshot) {
|
||||||
*last_full_snapshot_slot = Some(snapshot_root_bank.slot());
|
*last_full_snapshot_slot = Some(snapshot_root_bank.slot());
|
||||||
|
@ -609,13 +606,22 @@ impl AccountsBackgroundService {
|
||||||
// request for `N` to the snapshot request channel before setting a root `R > N`, and
|
// request for `N` to the snapshot request channel before setting a root `R > N`, and
|
||||||
// snapshot_request_handler.handle_requests() will always look for the latest
|
// snapshot_request_handler.handle_requests() will always look for the latest
|
||||||
// available snapshot in the channel.
|
// available snapshot in the channel.
|
||||||
let snapshot_block_height_option_result = request_handlers
|
//
|
||||||
.handle_snapshot_requests(
|
// NOTE: We must wait for startup verification to complete before handling
|
||||||
|
// snapshot requests. This is because startup verification and snapshot
|
||||||
|
// request handling can both kick off accounts hash calculations in background
|
||||||
|
// threads, and these must not happen concurrently.
|
||||||
|
let snapshot_block_height_option_result = bank
|
||||||
|
.is_startup_verification_complete()
|
||||||
|
.then(|| {
|
||||||
|
request_handlers.handle_snapshot_requests(
|
||||||
accounts_db_caching_enabled,
|
accounts_db_caching_enabled,
|
||||||
test_hash_calculation,
|
test_hash_calculation,
|
||||||
non_snapshot_time,
|
non_snapshot_time,
|
||||||
&mut last_full_snapshot_slot,
|
&mut last_full_snapshot_slot,
|
||||||
);
|
)
|
||||||
|
})
|
||||||
|
.flatten();
|
||||||
if snapshot_block_height_option_result.is_some() {
|
if snapshot_block_height_option_result.is_some() {
|
||||||
last_snapshot_end_time = Some(Instant::now());
|
last_snapshot_end_time = Some(Instant::now());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue