From 7e4a694c7fa688a6c32149526a45c5ef610df472 Mon Sep 17 00:00:00 2001 From: Bill Scales Date: Fri, 1 Aug 2025 09:56:23 +0100 Subject: [PATCH] osd: Optimized EC missing call to apply_pwlc after updating pwlc 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 (cherry picked from commit d19f3a3bcbb848e530e4d31cbfe195973fa9a144) --- src/osd/PeeringState.cc | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index 3672f2a0be557..b3fc1599d1351 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -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 -- 2.39.5