(cherry picked from commit e6bbd4b3f0
)
Co-authored-by: Jeff Washington (jwash) <75863576+jeffwashington@users.noreply.github.com>
This commit is contained in:
@ -220,7 +220,7 @@ mod tests {
|
|||||||
// set_root should send a snapshot request
|
// set_root should send a snapshot request
|
||||||
bank_forks.set_root(bank.slot(), &request_sender, None);
|
bank_forks.set_root(bank.slot(), &request_sender, None);
|
||||||
bank.update_accounts_hash();
|
bank.update_accounts_hash();
|
||||||
snapshot_request_handler.handle_snapshot_requests(false, false, false);
|
snapshot_request_handler.handle_snapshot_requests(false, false, false, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,11 +89,13 @@ impl SnapshotRequestHandler {
|
|||||||
accounts_db_caching_enabled: bool,
|
accounts_db_caching_enabled: bool,
|
||||||
test_hash_calculation: bool,
|
test_hash_calculation: bool,
|
||||||
use_index_hash_calculation: bool,
|
use_index_hash_calculation: bool,
|
||||||
|
non_snapshot_time_us: u128,
|
||||||
) -> Option<u64> {
|
) -> Option<u64> {
|
||||||
self.snapshot_request_receiver
|
self.snapshot_request_receiver
|
||||||
.try_iter()
|
.try_iter()
|
||||||
.last()
|
.last()
|
||||||
.map(|snapshot_request| {
|
.map(|snapshot_request| {
|
||||||
|
let mut total_time = Measure::start("wallclock time elapsed");
|
||||||
let SnapshotRequest {
|
let SnapshotRequest {
|
||||||
snapshot_root_bank,
|
snapshot_root_bank,
|
||||||
status_cache_slot_deltas,
|
status_cache_slot_deltas,
|
||||||
@ -188,6 +190,7 @@ impl SnapshotRequestHandler {
|
|||||||
let mut purge_old_snapshots_time = Measure::start("purge_old_snapshots_time");
|
let mut purge_old_snapshots_time = Measure::start("purge_old_snapshots_time");
|
||||||
snapshot_utils::purge_old_snapshots(&self.snapshot_config.snapshot_path);
|
snapshot_utils::purge_old_snapshots(&self.snapshot_config.snapshot_path);
|
||||||
purge_old_snapshots_time.stop();
|
purge_old_snapshots_time.stop();
|
||||||
|
total_time.stop();
|
||||||
|
|
||||||
datapoint_info!(
|
datapoint_info!(
|
||||||
"handle_snapshot_requests-timing",
|
"handle_snapshot_requests-timing",
|
||||||
@ -205,6 +208,8 @@ impl SnapshotRequestHandler {
|
|||||||
purge_old_snapshots_time.as_us(),
|
purge_old_snapshots_time.as_us(),
|
||||||
i64
|
i64
|
||||||
),
|
),
|
||||||
|
("total_us", total_time.as_us(), i64),
|
||||||
|
("non_snapshot_time_us", non_snapshot_time_us, i64),
|
||||||
);
|
);
|
||||||
snapshot_root_bank.block_height()
|
snapshot_root_bank.block_height()
|
||||||
})
|
})
|
||||||
@ -251,6 +256,7 @@ impl AbsRequestHandler {
|
|||||||
accounts_db_caching_enabled: bool,
|
accounts_db_caching_enabled: bool,
|
||||||
test_hash_calculation: bool,
|
test_hash_calculation: bool,
|
||||||
use_index_hash_calculation: bool,
|
use_index_hash_calculation: bool,
|
||||||
|
non_snapshot_time_us: u128,
|
||||||
) -> Option<u64> {
|
) -> Option<u64> {
|
||||||
self.snapshot_request_handler
|
self.snapshot_request_handler
|
||||||
.as_ref()
|
.as_ref()
|
||||||
@ -259,6 +265,7 @@ impl AbsRequestHandler {
|
|||||||
accounts_db_caching_enabled,
|
accounts_db_caching_enabled,
|
||||||
test_hash_calculation,
|
test_hash_calculation,
|
||||||
use_index_hash_calculation,
|
use_index_hash_calculation,
|
||||||
|
non_snapshot_time_us,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -297,7 +304,9 @@ impl AccountsBackgroundService {
|
|||||||
let mut last_expiration_check_time = Instant::now();
|
let mut last_expiration_check_time = Instant::now();
|
||||||
let t_background = Builder::new()
|
let t_background = Builder::new()
|
||||||
.name("solana-bg-accounts".to_string())
|
.name("solana-bg-accounts".to_string())
|
||||||
.spawn(move || loop {
|
.spawn(move || {
|
||||||
|
let mut last_snapshot_end_time = None;
|
||||||
|
loop {
|
||||||
if exit.load(Ordering::Relaxed) {
|
if exit.load(Ordering::Relaxed) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -315,6 +324,12 @@ impl AccountsBackgroundService {
|
|||||||
|
|
||||||
Self::expire_old_recycle_stores(&bank, &mut last_expiration_check_time);
|
Self::expire_old_recycle_stores(&bank, &mut last_expiration_check_time);
|
||||||
|
|
||||||
|
let non_snapshot_time = last_snapshot_end_time
|
||||||
|
.map(|last_snapshot_end_time: Instant| {
|
||||||
|
last_snapshot_end_time.elapsed().as_micros()
|
||||||
|
})
|
||||||
|
.unwrap_or_default();
|
||||||
|
|
||||||
// Check to see if there were any requests for snapshotting banks
|
// Check to see if there were any requests for snapshotting banks
|
||||||
// < the current root bank `bank` above.
|
// < the current root bank `bank` above.
|
||||||
|
|
||||||
@ -336,7 +351,12 @@ impl AccountsBackgroundService {
|
|||||||
accounts_db_caching_enabled,
|
accounts_db_caching_enabled,
|
||||||
test_hash_calculation,
|
test_hash_calculation,
|
||||||
use_index_hash_calculation,
|
use_index_hash_calculation,
|
||||||
|
non_snapshot_time,
|
||||||
);
|
);
|
||||||
|
if snapshot_block_height.is_some() {
|
||||||
|
last_snapshot_end_time = Some(Instant::now());
|
||||||
|
}
|
||||||
|
|
||||||
if accounts_db_caching_enabled {
|
if accounts_db_caching_enabled {
|
||||||
// Note that the flush will do an internal clean of the
|
// Note that the flush will do an internal clean of the
|
||||||
// cache up to bank.slot(), so should be safe as long
|
// cache up to bank.slot(), so should be safe as long
|
||||||
@ -378,6 +398,7 @@ impl AccountsBackgroundService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
sleep(Duration::from_millis(INTERVAL_MS));
|
sleep(Duration::from_millis(INTERVAL_MS));
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
Self { t_background }
|
Self { t_background }
|
||||||
|
Reference in New Issue
Block a user