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

Commit

Permalink
Do not purge bank snapshots in AccountsBackgroundService (#31647)
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo authored May 15, 2023
1 parent 4ac0ffc commit dd4cfe9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 20 deletions.
15 changes: 12 additions & 3 deletions core/src/accounts_hash_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,18 @@ impl AccountsHashVerifier {
//
// If we are *not* generating snapshots, then purge old bank snapshots here.
if !snapshot_config.should_generate_snapshots() {
snapshot_utils::purge_bank_snapshots_older_than_slot(
&snapshot_config.bank_snapshots_dir,
accounts_package.slot,
let (_, purge_bank_snapshots_time_us) =
measure_us!(snapshot_utils::purge_bank_snapshots_older_than_slot(
&snapshot_config.bank_snapshots_dir,
accounts_package.slot,
));
datapoint_info!(
"accounts_hash_verifier",
(
"purge_old_snapshots_time_us",
purge_bank_snapshots_time_us,
i64
),
);
}

Expand Down
7 changes: 4 additions & 3 deletions core/src/snapshot_packager_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl SnapshotPackagerService {
info!("handling snapshot package: {snapshot_package:?}");
let enqueued_time = snapshot_package.enqueued.elapsed();

let (_, handling_time_us) = measure_us!({
let (purge_bank_snapshots_time_us, handling_time_us) = measure_us!({
// Archiving the snapshot package is not allowed to fail.
// AccountsBackgroundService calls `clean_accounts()` with a value for
// last_full_snapshot_slot that requires this archive call to succeed.
Expand All @@ -99,10 +99,10 @@ impl SnapshotPackagerService {
// all bank snapshots older than this slot. We want to keep the bank
// snapshot *at this slot* so that it can be used during restarts, when
// booting from local state.
snapshot_utils::purge_bank_snapshots_older_than_slot(
measure_us!(snapshot_utils::purge_bank_snapshots_older_than_slot(
&snapshot_config.bank_snapshots_dir,
snapshot_package.slot(),
);
)).1
});

datapoint_info!(
Expand All @@ -119,6 +119,7 @@ impl SnapshotPackagerService {
),
("enqueued_time_us", enqueued_time.as_micros(), i64),
("handling_time_us", handling_time_us, i64),
("purge_old_snapshots_time_us", purge_bank_snapshots_time_us, i64),
);
}
info!("SnapshotPackagerService has stopped");
Expand Down
14 changes: 0 additions & 14 deletions runtime/src/accounts_background_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use {
crossbeam_channel::{Receiver, SendError, Sender},
log::*,
rand::{thread_rng, Rng},
snapshot_utils::MAX_BANK_SNAPSHOTS_TO_RETAIN,
solana_measure::measure::Measure,
solana_sdk::clock::{BankId, Slot},
stats::StatsManager,
Expand Down Expand Up @@ -389,14 +388,6 @@ impl SnapshotRequestHandler {
snapshot_root_bank.hash(),
);

// Cleanup outdated snapshots
let mut purge_old_snapshots_time = Measure::start("purge_old_snapshots_time");
snapshot_utils::purge_old_bank_snapshots(
&self.snapshot_config.bank_snapshots_dir,
MAX_BANK_SNAPSHOTS_TO_RETAIN,
None,
);
purge_old_snapshots_time.stop();
total_time.stop();

datapoint_info!(
Expand All @@ -409,11 +400,6 @@ impl SnapshotRequestHandler {
("shrink_time", shrink_time.as_us(), i64),
("clean_time", clean_time.as_us(), i64),
("snapshot_time", snapshot_time.as_us(), i64),
(
"purge_old_snapshots_time",
purge_old_snapshots_time.as_us(),
i64
),
("total_us", total_time.as_us(), i64),
("non_snapshot_time_us", non_snapshot_time_us, i64),
);
Expand Down

0 comments on commit dd4cfe9

Please sign in to comment.