Do not purge bank snapshots in AccountsBackgroundService (#31647)

This commit is contained in:
Brooks 2023-05-15 13:53:48 -04:00 committed by GitHub
parent 4ac0ffcace
commit dd4cfe9924
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 20 deletions

View File

@ -329,9 +329,18 @@ impl AccountsHashVerifier {
// //
// If we are *not* generating snapshots, then purge old bank snapshots here. // If we are *not* generating snapshots, then purge old bank snapshots here.
if !snapshot_config.should_generate_snapshots() { if !snapshot_config.should_generate_snapshots() {
snapshot_utils::purge_bank_snapshots_older_than_slot( let (_, purge_bank_snapshots_time_us) =
measure_us!(snapshot_utils::purge_bank_snapshots_older_than_slot(
&snapshot_config.bank_snapshots_dir, &snapshot_config.bank_snapshots_dir,
accounts_package.slot, accounts_package.slot,
));
datapoint_info!(
"accounts_hash_verifier",
(
"purge_old_snapshots_time_us",
purge_bank_snapshots_time_us,
i64
),
); );
} }

View File

@ -75,7 +75,7 @@ impl SnapshotPackagerService {
info!("handling snapshot package: {snapshot_package:?}"); info!("handling snapshot package: {snapshot_package:?}");
let enqueued_time = snapshot_package.enqueued.elapsed(); 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. // Archiving the snapshot package is not allowed to fail.
// AccountsBackgroundService calls `clean_accounts()` with a value for // AccountsBackgroundService calls `clean_accounts()` with a value for
// last_full_snapshot_slot that requires this archive call to succeed. // last_full_snapshot_slot that requires this archive call to succeed.
@ -99,10 +99,10 @@ impl SnapshotPackagerService {
// all bank snapshots older than this slot. We want to keep the bank // 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 // snapshot *at this slot* so that it can be used during restarts, when
// booting from local state. // 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_config.bank_snapshots_dir,
snapshot_package.slot(), snapshot_package.slot(),
); )).1
}); });
datapoint_info!( datapoint_info!(
@ -119,6 +119,7 @@ impl SnapshotPackagerService {
), ),
("enqueued_time_us", enqueued_time.as_micros(), i64), ("enqueued_time_us", enqueued_time.as_micros(), i64),
("handling_time_us", handling_time_us, i64), ("handling_time_us", handling_time_us, i64),
("purge_old_snapshots_time_us", purge_bank_snapshots_time_us, i64),
); );
} }
info!("SnapshotPackagerService has stopped"); info!("SnapshotPackagerService has stopped");

View File

@ -16,7 +16,6 @@ use {
crossbeam_channel::{Receiver, SendError, Sender}, crossbeam_channel::{Receiver, SendError, Sender},
log::*, log::*,
rand::{thread_rng, Rng}, rand::{thread_rng, Rng},
snapshot_utils::MAX_BANK_SNAPSHOTS_TO_RETAIN,
solana_measure::measure::Measure, solana_measure::measure::Measure,
solana_sdk::clock::{BankId, Slot}, solana_sdk::clock::{BankId, Slot},
stats::StatsManager, stats::StatsManager,
@ -389,14 +388,6 @@ impl SnapshotRequestHandler {
snapshot_root_bank.hash(), 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(); total_time.stop();
datapoint_info!( datapoint_info!(
@ -409,11 +400,6 @@ impl SnapshotRequestHandler {
("shrink_time", shrink_time.as_us(), i64), ("shrink_time", shrink_time.as_us(), i64),
("clean_time", clean_time.as_us(), i64), ("clean_time", clean_time.as_us(), i64),
("snapshot_time", snapshot_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), ("total_us", total_time.as_us(), i64),
("non_snapshot_time_us", non_snapshot_time_us, i64), ("non_snapshot_time_us", non_snapshot_time_us, i64),
); );