Repository navigation
osd/PeeringState: cap pwlc at the log head when the primary activates - #72290
Conversation
afa7fd0 to
ec97caf
Compare
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
ec97caf to
158e0d0
Compare
|
jenkins test make check |
158e0d0 to
c61ebbb
Compare
|
This PR has been added to wip-bharath17-testing-20261016.230103-main. |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
c61ebbb to
1998996
Compare
|
@aainscow just confirming, the latest changes were just to resolve the conflicts? |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
In an optimized EC pool, a sub-stripe write gives the shards it does not touch a partial_writes_last_complete (pwlc) range ending at that write. If peering later rolls the write back, a pwlc range that still ends at it is stale, and applying it moves a nonprimary shard's last_update and log head to a version that no longer exists. ceph#71579 ("osd: pwlc was able to retain values larger than the last_update") trims the pwlc copies the primary holds for divergent peers in proc_replica_log, but the primary's own copy is not trimmed. The new primary merges each peer's pwlc in update_peer_info() during GetInfo, before GetLog has decided the authoritative log, so it keeps a range ending at a write that peering then rolls back. proc_master_log() would trim it, but does not run when the primary is its own log source. activate() then stamps the stale range with a new epoch, making it the definitive copy, and sends it to the peers. The nonprimary shards apply it and move their last_update and log head to the rolled-back version, so the next write to them, which reuses that version number, asserts in IndexedLog::add; a shard left with such a last_update can also be picked later as the log source and then never be recovered. The primary's log is authoritative once it activates, so no pwlc range may end past its head. activate() now trims pwlc to the head before stamping the epoch, which also covers ranges merged after GetLog in WaitUpThru and from peers whose log head already matched. A nonprimary shard keeps its own pwlc too, and update_peer_info() applies its own range after merging only the ranges the primary sends. When no primary-capable shard of the new interval saw a partial write that skipped it, the primary sends no range for it, so the shard applies its stale range again right after the primary's MInfoRec has rewound its log. update_peer_info() now trims a nonprimary shard's pwlc to the primary's last_update before applying it. The range for its own shard that a replica applies from an MLogRec before merging the log is capped at the sender's last_update the same way. With the activate() change a primary no longer sends such a range; the cap is defensive, for mixed-version clusters during an upgrade where the primary still runs older code. Tested by TestECFailoverWithPeering.RolledBackPeeredWriteLeavesNoStalePwlc and RolledBackPeeredWriteLeavesNoStaleReplicaPwlc in the following commit. Fixes: https://tracker.ceph.com/issues/81283 Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
Tests "osd/PeeringState: cap pwlc at the log head when the primary activates". A sub-stripe write kept by a peered interval gives the unwritten nonprimary shards a pwlc range ending at that write. When the primary-capable shard that missed the write returns, the write is rolled back. RolledBackPeeredWriteLeavesNoStalePwlc checks that the new primary does not keep, stamp and send the old range it merged from another primary-capable shard, so the nonprimary shards do not move their last_update and log head to the rolled-back version, and the next write, which reuses that version number, succeeds. A nonprimary shard also keeps its own copy of that range. RolledBackPeeredWriteLeavesNoStaleReplicaPwlc covers a write that reaches no other primary-capable shard, so no primary of the next interval has a range for the nonprimary shards, and checks that they do not re-apply their own copy after the new primary's MInfoRec rewinds them. Both tests raise the pool's min_size to k + 1 so that losing two shards leaves the PG peered but not active. They check the state before the next write so a regression fails the test rather than aborting the binary. The tests do not deep-scrub the object afterwards: shard 0 is down by then, and a deep scrub of an ISA pool with a data shard missing reports data digest errors even for an object that was never partially written. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
|
Rebased onto current main (head 5759603), trivial rebase: main gained new tests and test-fixture helpers in src/test/osd/TestECFailoverWithPeering.cc at the two places where the test commit adds its own (a fixture helper and a test), so I kept both blocks; no code was changed to resolve it. |
1998996 to
f45dea8
Compare
|
jenkins test this please |
|
jenkins retest this please |
In an optimized EC pool, a partial-write-last-complete (pwlc) range can outlive
the write it covers when peering rolls that write back. A nonprimary shard then
moves its
last_updateand log head to a version that no longer exists. The nextwrite reuses that version number, and the shard aborts in
PGLog::IndexedLog::add(e.version.version > head.version). Alternatively, theshard is later chosen as the log source and is never recovered.
Fixes: https://tracker.ceph.com/issues/81283
What goes wrong
After a peered-only interval keeps a sub-stripe write, the unwritten nonprimary
shards get a pwlc range ending at that write. When the next interval rolls the
write back, the stale range survives in two places:
update_peer_info()during GetInfo, before GetLog has chosen the log. It therefore takes a range
ending at the write that is about to be rolled back. Nothing trims the
primary's own copy afterwards. When the primary is its own log source,
proc_master_log()does not run.activate()then stamps the range with thenew epoch, which makes it win every later merge, and sends it to the shards.
update_peer_info(). If no primary-capable shard of the new interval saw thewrite, the primary sends no range for it. The shard then re-applies its stale
copy right after the primary's MInfoRec has rewound its log.
The tracker has a step-by-step trace from the unit test.
Fix
The primary's log is authoritative once it activates, so no pwlc range may end
past its head.
activate()trims pwlc topg_log.get_head()before it stamps the epoch andsends the ranges. That also covers ranges merged in WaitUpThru, and ranges from
peers whose log head already matched.
last_updateinupdate_peer_info()before applying it.is capped at the sender's
last_update. With theactivate()change a primaryno longer sends such a range, so this cap is defensive: it protects replicas
during an upgrade, when the primary may still run older code.
The cap must come after all the merges and before the epoch is stamped. pwlc
epochs are unchanged, so the tie-break in
update_peer_info()is unchanged too.Why #71579 is not enough
#71579 trims the copy of the range that the primary holds for each peer with
divergent entries, in
proc_replica_log(). It does not trim:before the rollback was known;
In a trace of the k4m2 test on main, #71579 rolls the peers' ranges back from 5'2
to 5'1. The primary still activates with (5'1, 5'2] for shards 1-3.
Testing
New tests in
unittest_ecfailover_with_peering:RolledBackPeeredWriteLeavesNoStalePwlc: the primary-side case.RolledBackPeeredWriteLeavesNoStaleReplicaPwlc: the nonprimary-side case. Thewrite reaches no other primary-capable shard.
Both raise min_size to k + 1, so that losing two shards leaves the PG peered but
not active. They check pwlc and every shard's log head before the next write, so a
regression fails the test rather than aborting the binary. They skip k2m1
configurations, as intended. The test commit also adds
OSDMapTestHelpers::set_pool_min_size()andECPeeringTestFixture::set_pool_min_size().Results:
(206 passed, 24 skipped).
on the intended checks. The stale range ends past the head, and a nonprimary
log head differs from the primary's.
The tests do not deep-scrub the object afterwards. Shard 0 is down by then, and on
main a deep scrub of an ISA pool with a data shard missing reports data-digest
errors even for an object that was never partially written. That looks like a
separate bug and will be raised on its own.
Backport: tentacle, umbrella. The fix applies cleanly to both. Neither has #71579
yet, so backport that too.
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.