Skip to content

Commit d19f3a3

Browse files
bill-scalesaainscow
authored andcommitted
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 <[email protected]>
1 parent d634f82 commit d19f3a3

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

src/osd/PeeringState.cc

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -410,27 +410,21 @@ void PeeringState::update_peer_info(const pg_shard_t &from,
410410
}
411411
}
412412
if (updated) {
413-
psdout(10) << "pwlc=" << info.partial_writes_last_complete << dendl;
414-
}
415-
// Update last updated epoch
416-
info.partial_writes_last_complete_epoch = std::max(
417-
info.partial_writes_last_complete_epoch,
418-
oinfo.partial_writes_last_complete_epoch);
419-
}
420-
// 3 cases:
421-
// 1. This is the primary, from is the shard that sent the oinfo which may
422-
// have more up to date pwlc. There may be multiple peer_info's for the
423-
// shard id that can be updated by applying pwlc
424-
// 2. This is a replica/stray - from is the primary (which never has pwlc
425-
// information), there is nothing to update
426-
// 3. This is a merge - from is pg_whoami, there is nothing to update
427-
if ((from != pg_whoami) &&
428-
info.partial_writes_last_complete.contains(from.shard)) {
413+
// Update last updated epoch
414+
info.partial_writes_last_complete_epoch = std::max(
415+
info.partial_writes_last_complete_epoch,
416+
oinfo.partial_writes_last_complete_epoch);
417+
418+
psdout(10) << "pwlc=e" << info.partial_writes_last_complete_epoch
419+
<< ":" << info.partial_writes_last_complete << dendl;
420+
}
421+
}
422+
// Primary shards might need to apply pwlc to non-primary peer_info's
423+
if (is_primary()) {
429424
for (auto & [shard, peer] : peer_info) {
430-
if (shard.shard != from.shard) {
431-
continue;
425+
if (info.partial_writes_last_complete.contains(shard.shard)) {
426+
apply_pwlc(info.partial_writes_last_complete[shard.shard], shard, peer);
432427
}
433-
apply_pwlc(info.partial_writes_last_complete[from.shard], shard, peer);
434428
}
435429
}
436430
// Non-primary shards might need to apply pwlc to update info

0 commit comments

Comments
 (0)