Repository navigation
osd: keep a newer entry's missing item for skipped partial writes - #72260
SrinivasaBharath merged 1 commit into
Conversation
|
Thank you for your contribution. Since you are not yet a member of the Ceph organization with write permissions on ceph/ceph.git, our CI will not automatically run. Any member of the Ceph organization may label this PR |
729a955 to
6d22d63
Compare
|
We are still looking into this. |
|
This PR has been added to wip-bharath14-testing-20261027.071324-main. |
aainscow
left a comment
There was a problem hiding this comment.
LGTM
Please add the extra test. We don't need to re-run QA for an additional test - just make check passing is good enough.
merge_log() adds the authoritative entries after the divergence point to missing before it merges the divergent ones. When every divergent entry of an object is a partial write that skipped this shard, _merge_object_divergent_entries() bypasses its "more recent entry found, already merged" case, which since commit f4237ca ("osd: Divergent logs for pure partial writes should roll back mising list when merged") needs a kept entry, and falls through to case 2 or 3. That undoes the newer entry's missing item: - missing.have == prior_version (the object was not missing before): the item is removed, so the shard is never recovered to the newer version; - otherwise need is rolled back to prior_version, below the version the authoritative log requires; - the divergent entry created the object (prior_version 0): the item is removed as for a create; - a newer partial write that also skipped this shard precedes the newer full write: have is that partial write's version (the full write's prior_version), and need is rolled back below have. The divergent entries did not touch the object on this shard, and missing already reflects the newer entries, so leave both alone. Test case 7 of merge_object_divergent_entries_partial_writes meant to cover this case but never reached it: its log did not index objects. Index it and check need. merge_log_skipped_partial_write_then_newer_entry runs the four cases above through merge_log(), plus the case that f4237ca fixed (no newer entry: need rolls back to prior_version). Fixes: https://tracker.ceph.com/issues/81225 Assisted-by: claude-code:claude-opus-5.5 Signed-off-by: Vitaly Goot <[email protected]>
6d22d63 to
d9cd09f
Compare
|
It seems this change has introduced a test failure: the test builds a 4+2 EC pool but never sets pool.size (stays 0). After the stretch-zone change, is_nonprimary_shard calls get_relative_shard, which does shard.id % get_zone_size() with get_zone_size() == 0 results in div-by-zero 13:44:52 [ RUN ] PGLogTest.merge_log_skipped_partial_write_then_newer_entry |
|
It is a bug in the test only, not in the fix. The test built its 4+2 pool by hand without It is fixed on main by #73945 (222b177, For the backports of https://tracker.ceph.com/issues/81225: 222b177 should go along wherever #72644 is present |
Fixes: https://tracker.ceph.com/issues/81225
With
allow_ec_optimizations,PGLog::_merge_object_divergent_entries()can undo the missing entry thatmerge_log()has just added for a newer authoritative update of an object. This happens on a shard where every divergent entry of the object is a partial write that skipped the shard.It is a regression from #68727 (f4237ca, https://tracker.ceph.com/issues/75962). Since that change, the "more recent entry found, already merged" case requires a kept entry (
!entries.empty()). These objects therefore fall through to case 2 or 3 with the skipped entry'sprior_version. Example: shard 2 of a 4+2 pool, a divergent 10'100 (prior_version 10'99) that skipped it, and 11'110 in the authoritative log:merge_log()added 11'110The fourth row comes from Alex Ainscow's fault-injection testing on a 4+2 pool: it tripped the "unexpected need for missing item" assert in
MissingLoc::add_active_missing(), the assert of https://tracker.ceph.com/issues/73249, with a different cause.Only nonprimary shards are affected, because partial writes always write shard 0 and the parity shards. In the current interval the primary still recovers the object, because it computed the peer's missing before this merge. But the shard persists the wrong missing set. If the PG re-peers before the object is recovered, the object is not recovered on that shard. The tracker has the sequence and the logs.
Affected:
It needs backports to umbrella and tentacle before tentacle's next release.
Fix
When every divergent entry skipped the shard and the log has a newer entry for the object, return before cases 2 and 3. The divergent entries never touched the object on this shard, and missing already reflects the newer entries. Without a newer entry the merge still rolls missing back, as #68727 intended.
Testing
Unit tests in
src/test/osd/TestPGLog.cc:PGLogTest.merge_log_skipped_partial_write_then_newer_entryruns the three rows above throughmerge_log()on shard 2 of a 4+2 pool. It also runs the case osd: Correct missing list on divergent merge of partial writes #68727 fixed (no newer entry: need goes back toprior_version).PGLogTest.merge_object_divergent_entries_partial_writeswas meant to cover case 1 with a partial write. Its log did not index objects, so case 1 never ran. The log is now indexed, and the test also checksneed.Both fail without the fix and pass with it, and the rest of
unittest_pglogpasses. These runs used a v20.2.4 tree with the tentacle backport of #68727 (#70570). On main,_merge_object_divergent_entries()differs only in whitespace and intrim_after_remove(), which this path does not reach.TODO:
unittest_pglogresult on this branch.Review notes
have, marks the object dirty and removes it, which is right for an object the divergent entries changed. Here they did not change it. If the newer entries also skipped the shard, the object is not in missing, and removing it would drop data that nothing recovers.entriesis empty only when every non-error divergent entry was skipped, solastis the newest skipped entry.Checklist