From 07d8434b749577b3aa2dd39d68cb2cddcdc3570e Mon Sep 17 00:00:00 2001 From: Jon Bailey Date: Fri, 25 Jul 2025 14:16:35 +0100 Subject: [PATCH] osd: Invalidate stats during peering if we are rolling a shard forwards. This change will mean we always recalculate stats upon rolling stats forwards. This prevent the situation where we end up with incorrect statistics due to where we always take the stats of the oldest shard during peering; causing outdated pg stats being applied for cases where the oldest shards are shards that don't see partial writes where num_bytes has changed on other places after that point on that shard. Signed-off-by: Jon Bailey (cherry picked from commit b178ce476f4a5b2bb0743e36d78f3a6e23ad5506) --- src/osd/PeeringState.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index 427ed1a6205..c74c7cdb09f 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -3333,6 +3333,9 @@ void PeeringState::proc_master_log( apply_pwlc(info.partial_writes_last_complete[from.shard], from, oinfo, &olog); } + + bool invalidate_stats = false; + // For partial writes we may be able to keep some of the divergent entries if (olog.head < pg_log.get_head()) { // Iterate backwards to divergence @@ -3410,6 +3413,7 @@ void PeeringState::proc_master_log( // This entry can be kept, only shards that didn't participate in // the partial write missed the update psdout(20) << "keeping entry " << p->version << dendl; + invalidate_stats = true; eversion_t previous_version; if (p == pg_log.get_log().log.begin()) { previous_version = pg_log.get_tail(); @@ -3427,6 +3431,7 @@ void PeeringState::proc_master_log( // log to be authoritative (i.e., their entries are by definitely // non-divergent). merge_log(t, oinfo, std::move(olog), from); + info.stats.stats_invalid |= invalidate_stats; peer_info[from] = oinfo; psdout(10) << " peer osd." << from << " now " << oinfo << " " << omissing << dendl; -- 2.39.5