From 0355647cdd2c3457847fec05d30324d93d3486f9 Mon Sep 17 00:00:00 2001 From: Tao Zhu <82401714+taozhu-chicago@users.noreply.github.com> Date: Thu, 28 Sep 2023 09:53:17 -0500 Subject: [PATCH] reduce WARN logging to only necessary scenario (#33408) (cherry picked from commit cc4e9283dbb9e85aaa058e3f46d8fc96dfc5ab93) --- runtime/src/prioritization_fee_cache.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/runtime/src/prioritization_fee_cache.rs b/runtime/src/prioritization_fee_cache.rs index e67b2b789b56d0..75397969ba6589 100644 --- a/runtime/src/prioritization_fee_cache.rs +++ b/runtime/src/prioritization_fee_cache.rs @@ -314,14 +314,17 @@ impl PrioritizationFeeCache { // block minimum fee. let (result, slot_finalize_time) = measure!( { + // Only retain priority fee reported from optimistically confirmed bank let pre_purge_bank_count = slot_prioritization_fee.len() as u64; slot_prioritization_fee.retain(|id, _| id == bank_id); let post_purge_bank_count = slot_prioritization_fee.len() as u64; metrics.accumulate_total_purged_duplicated_bank_count( pre_purge_bank_count.saturating_sub(post_purge_bank_count), ); - if post_purge_bank_count == 0 { - warn!("Prioritization fee cache unexpected finalized on non-existing bank. slot {slot} bank id {bank_id}"); + // It should be rare that optimistically confirmed bank had no prioritized + // transactions, but duplicated and unconfirmed bank had. + if pre_purge_bank_count > 0 && post_purge_bank_count == 0 { + warn!("Finalized bank has empty prioritization fee cache. slot {slot} bank id {bank_id}"); } let mut block_prioritization_fee = slot_prioritization_fee