]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd: Invalidate stats during peering if we are rolling a shard forwards.
authorJon Bailey <jonathan.bailey1@ibm.com>
Fri, 25 Jul 2025 13:16:35 +0000 (14:16 +0100)
committerAlex Ainscow <aainscow@uk.ibm.com>
Wed, 17 Sep 2025 08:43:26 +0000 (09:43 +0100)
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 <jonathan.bailey1@ibm.com>
(cherry picked from commit b178ce476f4a5b2bb0743e36d78f3a6e23ad5506)

src/osd/PeeringState.cc

index 427ed1a620585ce0ad5048d48d95d431c6c7c081..c74c7cdb09fa74f66ce62f4689e29dd6d405cec2 100644 (file)
@@ -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;