From cc0e9a0e5a6b5c3e86d52ac105dac743826afd9a Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 18:36:19 -0500 Subject: [PATCH] v1.17: Logs the number of storages kept alive by fastboot (backport of #34667) (#34670) Logs the number of storages kept alive by fastboot (#34667) (cherry picked from commit e84974cf63403f7e836fe95d514a97e1120eb0f0) Co-authored-by: Brooks --- core/src/accounts_hash_verifier.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/core/src/accounts_hash_verifier.rs b/core/src/accounts_hash_verifier.rs index cb87cdc513a90c..4fbacabd7bf80e 100644 --- a/core/src/accounts_hash_verifier.rs +++ b/core/src/accounts_hash_verifier.rs @@ -104,12 +104,21 @@ impl AccountsHashVerifier { )); if let Some(snapshot_storages_for_fastboot) = snapshot_storages_for_fastboot { - let num_storages = snapshot_storages_for_fastboot.len(); + // Get the number of storages that are being kept alive for fastboot. + // Looking at the storage Arc's strong reference count, we know that one + // ref is for fastboot, and one ref is for snapshot packaging. If there + // are no others, then the storage will be kept alive because of fastboot. + let num_storages_kept_alive = snapshot_storages_for_fastboot + .iter() + .filter(|storage| Arc::strong_count(storage) == 2) + .count(); + let num_storages_total = snapshot_storages_for_fastboot.len(); fastboot_storages = Some(snapshot_storages_for_fastboot); datapoint_info!( "fastboot", ("slot", slot, i64), - ("num_storages", num_storages, i64), + ("num_storages_total", num_storages_total, i64), + ("num_storages_kept_alive", num_storages_kept_alive, i64), ); }