Skip to content

rgw: reread the olh head after replaying its log - #71924

Merged
anrao19 merged 5 commits into
ceph:mainfrom
mheler:wip-rgw-80653
Oct 19, 2026
Merged

anrao19 merged 5 commits into
ceph:mainfrom
mheler:wip-rgw-80653

Conversation

@mheler

@mheler mheler commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

A versionless read that lost a race with another OLH log replay could return ECANCELED, which was incorrectly translated into a 404. follow_olh() now rereads the OLH head after any replay and uses it to resolve the target. This adds one extra head read only when a replay runs.

The included QA test forces a replay to lose this race and verifies that reads still resolve correctly. It then allows the replay to complete and verifies that a subsequent read returns the version linked by that replay.

Fixes: https://tracker.ceph.com/issues/80653

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 x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@mheler
mheler marked this pull request as ready for review September 20, 2026 18:33
@mheler
mheler requested a review from a team as a code owner September 20, 2026 18:33
@mheler
mheler requested a review from cbodley September 20, 2026 18:34
Comment thread src/rgw/driver/rados/rgw_rados.cc Resolved
@nhoad

nhoad commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

I've re-run my reproducer against this change for a full ten minutes, and I encountered zero 404s over ~45k requests. Without the patch I can reproduce it in ~40 seconds. Awesome work, thank you Matt!

Comment thread src/rgw/driver/rados/rgw_rados.cc Resolved
@mheler
mheler force-pushed the wip-rgw-80653 branch 2 times, most recently from a4cb100 to 7bbb847 Compare September 24, 2026 12:04
@mheler
mheler requested review from a team and cbodley September 24, 2026 12:05
Comment thread src/rgw/driver/rados/rgw_rados.cc Resolved
@mheler
mheler requested a review from cbodley September 24, 2026 18:42
Comment on lines +10535 to +10539
if (state->attrset.find(RGW_ATTR_OLH_INFO) == state->attrset.end()) {
return -ENOENT; // no version was ever linked
}
obj_ctx.invalidate(olh_obj);
return -EAGAIN;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mheler you mentioned that this is getting more and more complicated as we dig into it. my understanding of the originial issue is that get requests were incorrectly returning 404s. i see that you've made this check for the ENOENT/404 case more specific

instead of adding additional recovery for the non-404 case here, perhaps we'd be better off just translating this to a retryable error code and expecting the client to come back. that could at least avoid use-after-free of RGWObjState due to this invalidate() call

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@mheler
mheler force-pushed the wip-rgw-80653 branch 2 times, most recently from 712389d to 9114c88 Compare September 27, 2026 10:57
@mheler
mheler requested a review from cbodley September 29, 2026 00:46

@cbodley cbodley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks okay, assuming qa doesn't catch any regressions

i'd still consider returning a retryable error directly, without the internal invalidate/retry logic

Comment thread src/rgw/rgw_op.cc Resolved
@yuriw

yuriw commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to wip-yuri12-testing-20261013.170323-main.

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

When concurrent olh log replays race, the canceled replay can cause a
read to return 404 even though the object still exists.

Reset the cached olh state in place so get_obj_state() rereads the olh
head and replays the log again, and return 503 after five failed
attempts. The replay that won has usually applied the log by then. The
state is reset rather than invalidated because callers hold pointers
to it. A head with no version ever linked still returns ENOENT.

Signed-off-by: Matthew N. Heler <[email protected]>
follow_olh() decodes the current version from the cached OLH_INFO,
which apply_olh_log() never updated, so a read that replayed the olh
log could still follow the version that was current before the replay.

Apply the same xattr changes to the cached olh state once the head
write succeeds, so we follow the new current version without another
read. Have follow_olh() also drop the unexpired pending entries it
found, which the log may not cover yet, so a later follow in the same
request can't pick up a newer link and switch versions.

Signed-off-by: Matthew N. Heler <[email protected]>
After clear_olh() removes the olh head, the cached state still said it
existed. A delete that replayed the olh log would then fail to write its
delete marker, and a read that replayed the removal of the last version
would still follow it.

Mark the cached head as removed once clear_olh() removes it, and have
follow_olh() return ENOENT when its replay removed the head.

Signed-off-by: Matthew N. Heler <[email protected]>
Versioned writes and delete markers look up the current version only
to check preconditions against it. Since a canceled olh log replay now
ends in 503 instead of ENOENT, a write without preconditions would fail
on a lookup it never uses, where it used to go through. The lookup also
costs extra head reads and can replay the olh log. DeleteObjects has the
same problem with its state load: it fails a key on any error but
ENOENT, while DeleteObject only fails when it needs the state for
object lock.

Only look up the current version when the request has a precondition,
and have DeleteObjects fail a key on a state load error only when it
checks object lock, as DeleteObject does.

Signed-off-by: Matthew N. Heler <[email protected]>
Raise the olh version so olh log replay fails, then delete the current
object version, delete the object with DeleteObjects, and write a new
one. Check that the deletes and the write succeed and reads return 503
while replay keeps failing, then restore the olh version and check that
reads return the new version.

Also check that a delete writes its delete marker after the olh log
replay removes the olh head.

Signed-off-by: Matthew N. Heler <[email protected]>
@anrao19

anrao19 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to wip-yuri12-testing-20261013.170323-main.

pr testing completed and approved by @ivancich, more details in : https://tracker.ceph.com/issues/81731
@mheler, if no further testing is needed then this can be merged

@anrao19
anrao19 merged commit dcd6d90 into ceph:main Oct 19, 2026
16 checks passed
batrick pushed a commit that referenced this pull request Nov 25, 2026
If an MPU is uploaded to a non-default storage class, its part heads are
located in that class, not the bucket's default pool, so
get_part_obj_state() has to resolve them with the upload's placement
instead of always looking in the bucket's default pool.

get_obj_state() now takes an optional placement rule that overrides the
bucket's, and get_part_obj_state() passes the manifest's tail placement.
GetObjectAttributes with ObjectParts goes through the same function, so for
uploads in a non-default storage class it now also reports the part
checksums, and the part sizes instead of their compressed sizes if the
class is compressed.

Fall back to the bucket's default pool if the part head isn't in the tail
placement's pool or has no etag: releases before v16.2.8
(https://tracker.ceph.com/issues/49128) wrote the part head's attrs,
including compression info, to a zero-size object in the bucket's default
pool and left the part data in the class pool without attrs, so reading
those parts from the class pool alone would return compressed data.

Fixes: https://tracker.ceph.com/issues/81780
Signed-off-by: Oguzhan Ozmen <[email protected]>
(cherry picked from commit a1775f9)

Conflicts:
	src/rgw/driver/rados/rgw_rados.cc
- Tentacle doesn't have the recent main change that retries canceled
  olh log replay #71924
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants