Repository navigation
rgw: stop leaving refcount tags behind on shared tails - #72314
Conversation
An appendable object writes each new part under its manifest's prefix. A copy or dedup target that shares another object's tails would append under that object's prefix. Copy the data when the source is appendable, and skip appendable objects at dedup ingress. Signed-off-by: Matthew N. Heler <[email protected]>
|
|
||
| objr.refs[op.tag] = true; | ||
| // a tag that another object may get again must stay retired after its put | ||
| objr.refs[op.tag] |= !op.unique; |
There was a problem hiding this comment.
can you help me understand the need for this new op.unique argument? it looks like the CopyObject path was changed to pass unique=true, but not the dedup path. i thought dedup was using the same refcount strategy as server-side copy, so why does it need special treatment here?
There was a problem hiding this comment.
yes, it's the same strategy, the difference is the tag. unique says the tag will never come back, so its put doesn't have to retire it. that's true for copy, which makes a new tag each time, but dedup reuses the target's tail tag, and other objects can have that same tag.
There was a problem hiding this comment.
cc @benhanokh
how is it safe for multiple objects to share the same refcount tag? if you then delete those, doesn't that mean cls_refcount_put() would only deref once, so orphan tails from the other copies?
There was a problem hiding this comment.
or maybe the issue is that multiple calls to cls_refcount_get() would only add a single ref for that tag, so the first cls_refcount_put() could remove the tails while other copies still reference them
There was a problem hiding this comment.
it isn't, that's a dedup bug, and this pr works around it by not marking dedup tags unique so they stay retired
There was a problem hiding this comment.
Can you please explain the problem?
How does dedup share ref_tag between objects?
What does it mean "...dedup reuses the target's tail tag" ?
Can you please point me to the code where it happens?
There was a problem hiding this comment.
rgw: give fetched and restored objects a tail tag of their own
@mheler am i correct in assuming that it was these cases that would cause a problem with dedup?
There was a problem hiding this comment.
@cbodley yes. fetched and restored objects could keep the tail tag of an older object, and this PR gives them their own. the other case is swift bulk upload, which gives every file in one upload the same tail tag, so that's where tracker 81574 could hit. it can't happen today only because bulk upload saves the etag with an extra null byte, so dedup's etag check fails and it never shares tails for those files. If the swift behavior is fixed (imho it probably should be fixed), then this is a legitimate concern.
There was a problem hiding this comment.
Should I add a sanity check the SRC and TGT reftag are different ?
There was a problem hiding this comment.
@benhanokh I added 71755a9 which can prevent this scenario for new writes if the ETag issue is ever fixed for swift bulk uploads (I will likely put a follow-up PR for that once this PR merges).
| // a source with a ref of its own, live or retired, doesn't own the wildcard | ||
| if (objr.refs.count(wildcard_tag) && objr.wildcard_owner.empty() && | ||
| !objr.refs.count(op.src_tag) && !objr.retired_refs.count(op.src_tag)) { | ||
| objr.wildcard_owner = op.src_tag; |
There was a problem hiding this comment.
in this case where we can assign a wildcard owner, might we also
a) clear existing retired_refs? and
b) convert other preexisting refs to false?
this seems like a good opportunity to clean up existing objects effected by this issue
There was a problem hiding this comment.
how would we know which retired tags are safe to drop? retired_refs is what stops a replayed put from gc from dropping a newer ref with the same tag, so we can only clear a tag that nothing will add again. a dedup tag can be added again, and the xattr doesn't say which tags came from dedup. converting refs to false has the same problem.
There was a problem hiding this comment.
i was assuming that retired_refs was only protecting that wildcard ref
c47ab64 to
293d404
Compare
459a326 to
146445d
Compare
|
Adding my old PR as reference. |
fetch_remote_obj() and restore_obj_from_cloud() write new tail objects but keep the tail tag from the attrs they copy. An object fetched by sync can carry the tag of a copy in this zone, and every restore of a cloud object reuses the tag of its stub. Dedup can then add that tag back to older tails after a delete already removed it. Drop the tail tag from those attrs so the object keeps the tag its own write made. Signed-off-by: Matthew N. Heler <[email protected]>
146445d to
f67b76c
Compare
RGWBulkUploadOp and RGWPostObj write every file in a request with s->req_id as its tag, so all of those files share one tail tag. When dedup points two of them at the same tails they share a single ref, and deleting one of them and the source frees tails the other still uses. Add a random suffix to the request id so each file gets its own tag. Bulk upload files that are already written keep their shared tag. Dedup skips them only because their etag attr ends in a null byte. Signed-off-by: Matthew N. Heler <[email protected]>
Copying and deleting an object repeatedly keeps adding retired tags to its tails. We need those tags to stop a repeated put from removing the source object's wildcard reference. Record which source tag owns the wildcard. A put for another tag can then leave it alone, so tags only need to stay retired while the wildcard has no owner. Drop the retired tags once it has one or is gone, which also cleans up tails that already have them. An older osd would drop the owner when it rewrites the xattr, so encode with compat 3 once the owner is set and make it fail to decode instead. Signed-off-by: Matthew N. Heler <[email protected]>
Check that only the first eligible source becomes the wildcard owner. A source with a live or retired reference must not become the owner. Exercise repeated puts with and without an owner, check that retired tags are dropped once the wildcard has an owner or is gone, and that an owner forces compat 3. Signed-off-by: Matthew N. Heler <[email protected]>
Pass the source's tail tag to cls_refcount_get() so it can own the wildcard on the source's tails. This lets deleted copies release their references without leaving a retired tag on every tail. Fall back to copying data when the source has no tail tag. Without one the wildcard gets no owner, and deleted copies would still leave retired tags on the source's tails. Signed-off-by: Matthew N. Heler <[email protected]>
Pass the source's tail tag to cls_refcount_get(), like a copy does. Dedup and copies of a dedup target can then drop their references without leaving retired tags. A record without a tail tag holds the id tag instead, which can change on a self-copy or attribute update, so pass the tag only when it came from the tail tag. Signed-off-by: Matthew N. Heler <[email protected]>
f67b76c to
f133d55
Compare
| void encode(ceph::buffer::list& bl) const { | ||
| ENCODE_START(2, 1, bl); | ||
| // require decoders to recognize v3 when the owner is set | ||
| const uint8_t compat = wildcard_owner.empty() ? 1 : 3; | ||
| ENCODE_START(3, compat, bl); |
There was a problem hiding this comment.
so if an upgraded osd sets a wildcard_owner and removes refs without recording them in retired_refs, and then an old osd takes over as primary, this prevents it from treating a repeated put() as the wildcard ref
instead, the old osd would return -EIO on decode failure. what does rgw do with these errors?
for CopyObject, the cls_refcount_get() errors would cause it to roll back any successful gets with puts and fail the copy request
for garbage collection, the cls_refcount_put() errors are treated as fatal to RGWGC::process(), so it leaves that entry in the queue and refuses to process later entries. this will resolve itself once the upgrade completes. if the cluster is left this way for an extended period, the gc queue will fill up and we'll rely on inline deletes
overall i think this is reasonable 👍
|
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 |
Every time an object is copied and the copy deleted, cls_refcount keeps the copy's tag in a retired list on every tail object, forever. On EC pools that whole xattr goes into each pg log entry, so osd_pglog grows quickly once an object has been copied many times.
This series has cls_refcount remember which tag owns the tails. Copies get unique tags, which are removed outright when the copy is deleted. CopyObject and dedup pass the source tail tag. Objects fetched by sync get a tail tag of their own instead of keeping the source's. Objects without a tail tag, and appendable objects, have their data copied (CopyObject) or are skipped (dedup) instead of sharing tails.
Tracker: https://tracker.ceph.com/issues/81312
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.