Bug #79706
closedosd/PeeringState: fix proc_master_log divergence check vs olog.head
0%
Description
The FastEC changes introduced in tentacle have a bug in proc_master_log which merges the definitive log into the primary's log during peering where it creates an iterator that points to the end sentinel of olog and then de-references it which is not allowed. The code was meant to be looking at the last entry in olog.
This bug only affects FastEC. It is very rare for olog not to be empty because EC chooses the definitive log as the the shard which is furthest behind, and normally GetLog::GetLog only requests log entries that are ahead of the Primary - which will result in olog being empty. There is however an exception in GetLog::GetLog when there is a backfilling shard and the definitive log has entries which could be used to perform recovery instead of a backfill.
@@ -3467,25 +3467,28 @@ void PeeringState::proc_master_log(
// of p->version. So long as there are no entries in olog between
// p->version and olog.head we can still try to wind forward
// partially written entries
auto op = olog.log.end(); <<< NOTE op iterator initialized to end sentinel
if (op == olog.log.begin()) { <<< THIS IS THE NORMAL PATH
// Other log is emtpy
if (p->version <= olog.head) {
consider_adjusting_pwlc(p->version);
++p;
} else {
consider_adjusting_pwlc(pg_log.get_tail());
}
} else if (op->version == p->version) { <<< BUG
// Normal case - both logs have this entry
consider_adjusting_pwlc(p->version);
++p;
} else if (op->version < p->version) { <<< BUG
// Last entry in other log is before this entry
consider_adjusting_pwlc(pg_log.get_tail());
} else {
// Other log is ahead of the primary log - give up
p = pg_log.get_log().log.end();
}
BS Updated by Bill Scales 3 months ago
- Status changed from New to Fix Under Review
- Pull request ID set to 70149
KS Updated by Kamoltat (Junior) Sirivadhna 3 months ago
needs testing
LF Updated by Laura Flores 3 months ago
- Backport changed from tentacle umbrella to tentacle,umbrella
Bill has written that he is planning to push some unit tests to the PR.
LF Updated by Laura Flores 3 months ago ยท Edited
Scrub note: Status is still the same.
KS Updated by Kamoltat (Junior) Sirivadhna 3 months ago
scrub: still waiting for the same status
LF Updated by Laura Flores 2 months ago
Same
LF Updated by Laura Flores 2 months ago
- Has duplicate Bug #80359: Undefined end() iterator in proc_master_log can cause pwlc values to be set incorrectly added
BS Updated by Bill Scales 2 months ago
2nd commit added with unit tests. Ready for QA testing
VG Updated by Vitaly Goot 2 months ago
We hit this on v20.2.4 (8+3, allow_ec_optimizations) in a full-cluster restart test, in a PG that had a backfilling shard, which is the exception described above. With a non-empty olog, proc_master_log() called consider_adjusting_pwlc(pg_log.get_tail()) and rolled the pwlc of shards 1-7 back to the primary's log tail. The replicas' logs looked identical, so activate() sent them only the info, and five replicas asserted at the same moment:
PeeringState.cc: 7334: FAILED ceph_assert(ps->info.last_update >= pwlc.first)
Partial writes had skipped those shards for longer than the log, so their own last_update was older than the tail. As far as we can tell from the code, the logic in #70149 would roll forward here instead. When data shards go unwritten for a long time, the result is several OSDs down at once, so this may deserve more than minor severity. We have the primary's debug_osd 10 log for that peering if it helps.
Related: #81183, a separate peering bug in the same area, found in the same tests.
KS Updated by Kamoltat (Junior) Sirivadhna 2 months ago
- Status changed from Fix Under Review to Pending Backport
UB Updated by Upkeep Bot 2 months ago
- Copied to Backport #81227: umbrella: osd/PeeringState: fix proc_master_log divergence check vs olog.head added
UB Updated by Upkeep Bot 2 months ago
- Copied to Backport #81228: tentacle: osd/PeeringState: fix proc_master_log divergence check vs olog.head added
UB Updated by Upkeep Bot 2 months ago
- Status changed from Pending Backport to Backporting
- Merge Commit set to 375511523ed523b6bb434806c85b97283d0704f0
- Fixed In set to v21.3.0-3870-g375511523e
- Upkeep Timestamp set to 2026-09-30T20:28:25+00:00