]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Optimized EC missing call to apply_pwlc after updating pwlc
authorBill Scales <bill_scales@uk.ibm.com>
Fri, 1 Aug 2025 08:56:23 +0000 (09:56 +0100)
committerAlex Ainscow <aainscow@uk.ibm.com>
Wed, 17 Sep 2025 08:43:26 +0000 (09:43 +0100)
update_peer_info was updating pwlc with a newer version received
from another shard, but failed to update the peer_info's to
reflect the new pwlc by calling apply_pwlc.

Scenario was primary receiving an update from shard X which had
newer information about shard Y. The code was calling apply_pwlc
for shard X but not for shard Y.

The fix simplifies the logic in update_peer_info - if we are
the primary update all peer_info's that have pwlc. If we
are a non-primary and there is pwlc then update info.

Signed-off-by: Bill Scales <bill_scales@uk.ibm.com>
(cherry picked from commit d19f3a3bcbb848e530e4d31cbfe195973fa9a144)

src/osd/PeeringState.cc

index 3672f2a0be55708eeefd61e4b41c4cb3d5342f33..b3fc1599d13519e1bbd80f47d889b3cbabe5e582 100644 (file)
@@ -410,27 +410,21 @@ void PeeringState::update_peer_info(const pg_shard_t &from,
       }
     }
     if (updated) {
-      psdout(10) << "pwlc=" << info.partial_writes_last_complete << dendl;
-    }
-    // Update last updated epoch
-    info.partial_writes_last_complete_epoch = std::max(
-        info.partial_writes_last_complete_epoch,
-        oinfo.partial_writes_last_complete_epoch);
-  }
-  // 3 cases:
-  // 1. This is the primary, from is the shard that sent the oinfo which may
-  // have more up to date pwlc. There may be multiple peer_info's for the
-  // shard id that can be updated by applying pwlc
-  // 2. This is a replica/stray - from is the primary (which never has pwlc
-  // information), there is nothing to update
-  // 3. This is a merge - from is pg_whoami, there is nothing to update
-  if ((from != pg_whoami) &&
-      info.partial_writes_last_complete.contains(from.shard)) {
+      // Update last updated epoch
+      info.partial_writes_last_complete_epoch = std::max(
+           info.partial_writes_last_complete_epoch,
+           oinfo.partial_writes_last_complete_epoch);
+
+      psdout(10) << "pwlc=e" << info.partial_writes_last_complete_epoch
+                << ":" << info.partial_writes_last_complete << dendl;
+    }
+  }
+  // Primary shards might need to apply pwlc to non-primary peer_info's
+  if (is_primary()) {
     for (auto & [shard, peer] : peer_info) {
-      if (shard.shard != from.shard) {
-       continue;
+      if (info.partial_writes_last_complete.contains(shard.shard)) {
+       apply_pwlc(info.partial_writes_last_complete[shard.shard], shard, peer);
       }
-      apply_pwlc(info.partial_writes_last_complete[from.shard], shard, peer);
     }
   }
   // Non-primary shards might need to apply pwlc to update info